list box controls in dialog box

list box controls in dialog box

Post by Jimb » Tue, 03 Jul 2001 06:27:25



hi I am writing in a MDI that calls up a dialog box , when I try to use MFC
String functions  such as   .Addstring   Everything compiles ok , but I get
a debug ASSERT failure when I run the program ...  I used the class wizard
to attach a class to the dialog box and have no idea what the problem might
be , Anyone have any ideas ???
 
 
 

list box controls in dialog box

Post by Scott McPhillip » Tue, 03 Jul 2001 06:42:17



> hi I am writing in a MDI that calls up a dialog box , when I try to use MFC
> String functions  such as   .Addstring   Everything compiles ok , but I get
> a debug ASSERT failure when I run the program ...  I used the class wizard
> to attach a class to the dialog box and have no idea what the problem might
> be , Anyone have any ideas ???

This usually means you are trying to access the list box before it has
been created.  For example, you cannot call AddString before calling
DoModal, and you cannot call it from the dialog constructor.  The actual
Windows control does not exist until the OnInitDialog function has
called CDialog::OnInitDialog.  You can access the list box after that
call.

--
Scott McPhillips [VC++ MVP]

 
 
 

list box controls in dialog box

Post by Jimb » Tue, 03 Jul 2001 16:26:24


you know that sounds like it was something like that .When I created the
dialog box i used   Insert//Resource//dialog  and put a listbox control ,etc
in it .. I then called up the class wizard ,which told me that I had created
a new resource and allowed me to create a new class for it and associated it
with the class ...I selected no automation ...and then hit  OK  ... the
CDialog derived class is created ....When I look at it thru ClassView,  I
only see a constructor member and no
OnInitDialog function ... I guess I have to create it or associate it    ...
** after I fixed the problem **   wahoo!!!
Looks like I needed to create an WM_INITDIALOG inside my class ... I put my
code there instead of in the constructor and all works well !!!!  This MFC
kinda wants you to massage the data b4 you can get all to work fluently ...
I wonder why the class wizard doesnt include the OnInitDialog member when it
creates the class... I know it does when you have a dialog only based
project..



> > hi I am writing in a MDI that calls up a dialog box , when I try to use
MFC
> > String functions  such as   .Addstring   Everything compiles ok , but I
get
> > a debug ASSERT failure when I run the program ...  I used the class
wizard
> > to attach a class to the dialog box and have no idea what the problem
might
> > be , Anyone have any ideas ???

> This usually means you are trying to access the list box before it has
> been created.  For example, you cannot call AddString before calling
> DoModal, and you cannot call it from the dialog constructor.  The actual
> Windows control does not exist until the OnInitDialog function has
> called CDialog::OnInitDialog.  You can access the list box after that
> call.

> --
> Scott McPhillips [VC++ MVP]

 
 
 

1. Resizing dialog Box or Elastic control tool for Dialog Boxes.

Hi
        I desperately need an elastic control tools/classes for my dialog boxes.
I'm compiling my application with UNICODE. Are there any product like this
available on the market ? I need them for Visual C++ 4.2 or higher.

Please help me
Aparna
--
Software Moguls Inc

URL :http://www.moguls.com

2. 3com509 NIC ISA - How to?

3. Access 2002 List Box Wizard(1st dialog box) 3rd Option missing

4. Printing

5. Unloading List box contents from a dialog box

6. disable DDI??????????

7. VISUAL BASIC LIST BOX / GRID BOX CUSTOM CONTROLS

8. Access 97 and Win XP

9. Scrolling event of list box and list view control

10. SetFont and List common controls (not list boxes)

11. How to catch the del and ins key in an list box

12. dialog box confirmation box

13. Windows Dialog Boxes Lost Characters, Check boxes, etc.