|
Which is why I specifically stated "compile-time version."
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I guess he wants the decision about the used button class during runtime and not during compile time...
cheers,
mykel
OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."
|
|
|
|
|
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i want to diaplay a modeless listbox on button click.i m gvng my listbox which in one class from some other class. i hav made a new class in which i have made my own addstring function which is like this:
int CMyList::Addition(LPCTSTR lpszItem)
{
return CListBox::AddString(lpszItem);
}
i have declared an object of CMyList as:
CMyList myobj;
obj.Addition("hye");
but i m getting exception error.
can anyone tell me how to rectify this exception.
is there any other method to do so??
NT
|
|
|
|
|
I guess you have to call the CListBox member function Create(...) before adding items to the list.
Regards
Marcus
|
|
|
|
|
why and how???????????????
NT
|
|
|
|
|
Before calling Create(...) no window exists for the list box. And you can't add items to the list before creating a corresponding window. See MSDN for how to use the function.
Regards,
Marcus.
|
|
|
|
|
Did your MyListBox class derive from CListBox?
Then the Create()-code should already be there and be used.
But then you could simply write AddString() in you class function, as "public derivation" means the derived class *IS A* base class in every respect.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
yes i have derived my new class from CListBox
nw do i hav to use create() function????????
NT
|
|
|
|
|
Yes. When you want to Create your Listbox. From your description, that would be the button-click-handler.
Remember, though, that a local MyListBox variable would be destroyed on leaving the Button-click-handler. But you wanted your ListBox modeless and staying on the screen even when your program continues.
You would possibly need to make a member variable in its parent for it.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
It depends. If in your case myobj is a member of your dialog where the list box belongs to and if myobj is associated with that list box, then no. If you created myobj in some function locally, then yes. Maybe you can have a look at the MFC Controls -> List controls section for some sample code to study.
Regards
Marcus
|
|
|
|
|
Learn to better look at the exception, I think the ASSERT is yelling coz theres is not window. In Window you gotta create first the window and THEN work with them. I do loading often in the CWnd::OnShowWindow(...) function
Greetings from Germany
|
|
|
|
|
KarstenK wrote: Learn to better look at the exception, I think the ASSERT...
While it very well may be an assertion that fired (i.e., nonexistent window), the OP stated it was an exception that was thrown.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Get a book on MFC. You're not using the class correctly in the first place. All MFC objects that wrap Win32 primitives like HWND, HDC, etc, have a similar pattern:
CWnd wnd; //make a new instance
or
CWnd* wnd = new CWnd();
//"create" the instance
wnd.Create(......);
or
wnd->Create(.....);
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
can i use DoModal function...
i dnt knw how to use create...can anybody tell me????
NT
|
|
|
|
|
Again, you're using terms incorrectly. Saying you want to use a "modeless listbox" doesn't make any sense. I suspect what you want is to display a modeless *dialog* with a list box in it. Look up CDialog, and the differences between DoModal and a modeless dialog in MSDN.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Hi,
I'm need a class or sample code for the vertical text into the Edit Control. How to make it?
Help me if you can!
|
|
|
|
|
there are several articles about that on Codeproject. have you searched a little around there ?
|
|
|
|
|
I'm not found this solution in the captions of the "Edit Controls" articles. Can you get a link?
|
|
|
|
|
Draw vertical text is very very simple:
CFont VertFont;
LOGFONT LogFont;
HorzFont->GetLogFont(&LogFont);
LogFont.lfEscapement=900;
VertFont.CreateFontIndirect(&LogFont);
tmpDC.SelectObject(&VertFont);
tmpDC.TextOut(x, y, "bye bye, Russell");
Russell
|
|
|
|
|
Your sample for drawing and not for the CEdit-derived classes. Changes CEdit font by SetFont methods hasn't effect.
|
|
|
|
|
Another way then is to put a normal CEdit control invisible somewhere, then drow it and on a tmp DC, rotate it 90 degrees and than draw it in the real DC.
But, then, probally you have also to wrap (and rotate) the mouse interaction to send right information to the real CEdit control.
Russell
|
|
|
|
|
Hi I have developed a program in C++ and I would now like to implement a sort of uninstall function which will delete all the files created so far by the application, including the application itself. How can I do it, since the application can't delete itself if it is still running?
Any advice please!
jEDI
|
|
|
|
|
actually, it can, as the program is loaded in memory when it runs...
|
|
|
|
|
toxcct wrote: actually, it can
Actually, no, as the exe is locked.
Windows handles this different from Linux.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|