Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / wxCheckListBox and runtime errors

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxCheckListBox and runtime errors
#3456
Posted by: 2004-03-05 01:55:50
Hi, I'm happily using devcpp (4.9.8.7) with wxwindows (2.4).

Recently I needed to use in a simple application a wxCheckListBox with client data, and experimented some troubles.

I built a data class (let's call it configData), deriving it from wxClientData, whose members are simply some wxString objects.

Then derived a class from wxCheckListBox (let's call it mainList), whose constructor calls a public member function that opens a file, reads some strings from it, then creates (using 'new') a data object for each line in the file, filling it with the values read from the file, then adds a new line in the wxCheckListBox, and sets the new created client data item as the client data item.

I create a new mainList object as child of the classical MyFrame object (from the devcpp wxwindows template).

The program compiles and links correctly, but as I try to execute it I obtain an access violation runtime error. Worknig with the debugger I've seen that the error occurs when the program tries to show the frame.
The strange thing is that if I leave all the code untouched and simply remove the instruction that sets the configData object as the client  data of the mainList item.

Any idea?

Thanks in advance.

Al
Message2. Re: wxCheckListBox and runtime errors
#3467
Posted by: 2004-03-06 00:45:02
BTW, I tried to compile the same code with the only difference that I derived my mainList class from wxListBox instead of wxCheckListBox, and everything works fine (except, obviously, that I don't have the checkboxes in the list lines...).

At this point I guess that probably the wxCheckListBox makes somehow use of the clientData pointer of his ancestor, that conflicts with the use of it by the application...

Any idea?

Thanks in advance.

kalb
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,420.00 ·
 
 
¥950.00 ·
 
 
¥288.00 ·
 
 
¥738.00 ·
 
 
¥397.00 ·
 
 
¥750.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0