|
If it's anything like vector you should be able to pass an initial size into the constructor, then it won't reallocate until you go over that size. That naturally removes one of the main advantages of a dynamic array.
By the way, CArray is absolute trash, you should ditch it and use vector instead.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Hello, the codegurus around the world.;)
Generally speaking, we can define Find function to find CArray index.
So, without the pointer of CArray, we can find any index with some
key value.
This means if we derived some class from CObject, we can insert
this class in CArray template.
(Or, I misunderstand something? )
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
Store the index instead of the pointer. You can always get the pointer back.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
I see that This method is used by class CWinApp to translate window messages before they are dispatched to the Windows CE TranslateMessage and DispatchMessage functions from the MSDN but what in the world is the meaning of translate in this case? I cant find a technical definition of translate anywhere....
Thanks,
ns
|
|
|
|
|
You're reading the documentation for the CE version. Here's the Win32 doc:
The TranslateMessage function translates virtual-key messages into character messages. The character messages are posted to the calling thread's message queue, to be read the next time the thread calls the GetMessage or PeekMessage function.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks much! BTW I'm having a heck of a time with overriding the OnOK() and bad behavior (see my thread). I'm going to have to use the pretranslate msg I've tried and tried! If the OnOK() is blank (no base handler) all is well. But try to get rid of the OK button and it behaves bizzaerely...enter dismisses agin!
|
|
|
|
|
I'm having no luck preventing the dismissal of my modal dlg with the Enter key press by overriding the OnOk of the class. SO I am going to go with pretranslatemessage. Question before I invest time in the UI of the modal dlg:
There wil be a listcontrol on it and the user chooses an item which gets written to a textbox. associated with this textbox is another CEdit where the user enters a value. then I press a "Done" button which calls EndDialog(nRet);
Will pretranslate message interfere with any of these functionalities?
BOOL CLog::PreTranslateMessage(MSG* pMsg)
{
if ((pMsg->message == WM_KEYDOWN))// && (pMsg->hwnd == m_hWnd))
{
if (pMsg->wParam == VK_RETURN)
{
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
Thanks,
ns
|
|
|
|
|
OnOK() is the way to do this. If you don't want the dialog to close simply don't call the parent class OnOK().
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
|
Really, I did - my OnOK for the OK button is empty and Enter is ignored. But I dont want that button around. I want my own button that does some stuff then exits. So if I make the default Ok button invisible or delete it after making sure that OnOK() is blank (no CDialog::OnOK() being callled in it), the Enter dismisses it again! I cant keep a useless OK button around, and deleting it brings back the bad behavior.....
Thanks,
ns
|
|
|
|
|
You also need to add a new button (see my previous reply) with id IDC_DONE . That button's handler should eventually call CDialog::OnOK() .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
The new button is all very well. its the old OK button that doesnt want to be deleted or invisibled....and I really dont want a useless buttonaround...Really the enter behavior returns if you get rid of the OK button.
|
|
|
|
|
nss wrote:
ts the old OK button that doesnt want to be deleted or invisibled....
Sorry, I don't understand you're saying! There seems to be a disconnect between what you're trying and what's been suggested.
I've been doing the "get rid off the OK button and use a substitute" thing for years to provide precisely the behavior you want.
If you want, I can send you a little code example.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Let me try to explain more clearly. First I cleared out the OnOK() handler for my dlg class OK button. Then ran it - fine. No dismissal on Enter. Then added a done button, called CDialog::OnOK() in it. Works fine. Still no dismissal.
Then I deleted the old OK button and ran it. Hit enter! Viola - the dlg vanishes!
I'll email you my latest atttempt...
thanks for checking this out!
|
|
|
|
|
|
nss wrote:
Then I deleted the old OK button and ran it. Hit enter! Viola - the dlg vanishes!
Hitting Enter actually does one of two things:
1. If a push button has the focus, clicks that button.
2. If some other kind of control has the focus, clicks the default push button in the dialog.
It sounds like you saw one of those cases. Hitting Enter clicked your new button, and the handler called OnOK(), thus closing the dialog.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I've mailed you a sample.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks - yours works great (though its got nothing in the DEbug folder even though I built it! Thats something I've not seen before). ANyways - I sent you mine. It doesnt work! I even put in the return in my OnOK() that i didnt have. What do you think is the problem with my attempts?
aaaaargh!
|
|
|
|
|
nss wrote:
though its got nothing in the DEbug folder even though I built it! Thats something I've not seen before
WAH! MOMMMMMMMY!
There's something very wrong with your system! I suggest a reboot. Really. Are you pulling another all-nighter?
nss wrote:
What do you think is the problem with my attempts?
Did you get my email (not thru CP)?
Whatever happened to Avis? Has he disappeared off the face of the earth? A web search has yielded NULL.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I will reboot. But I have stuff in my Debug Folders....
Avis: faint glimmerings of memory. What is Bhaya doing do you know? (That was his name right?). gosh - ghosts from the past.
Actually going to sleep tonight. Didnt do too much but planned next design stages today. Did you get some food into you? I soon shall. Nothing exciting though. Hey thanks for the zillions of emails and sample and all the help. No one could have predicted it was my tab order that was the culprit! All this time i've been doing pretranslate with bated breath...
Adios! I'll treboot now and go scout out the kitchen...
|
|
|
|
|
nss wrote:
What is Bhaya doing
I haven't a clue - I lost touch with him when I left.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have created a class now and want to test it. But the compiler says:
fatal error C1010: unexpected end of file while looking for precompiled header directive
In the .cpp file for my class I have in the beginning of the file
#include "MyHeaderFile.h"
and what can be wrong!?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Typically in MFC Apps you have a "stdafx.h" header file which is used as the precompiled header. Then in Project|Settings |C/C++ |Precompiled Headers you set "Use precompiled header file (.pch)" - "Through header: stdafx"
If you aren't using precompiled headers then set "Not using precompiled headers" instead.
See the VC++ Help for info on precompiled headers.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
I will try that out!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|