Guidance Forums / wxWidgets (wxWindows) in C++ / wxCheckListBox and runtime errors

Search 搜索
Home Home

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxCheckListBox and runtime errors
Posted by: 2004-03-05 01:55:50
Hi, I'm happily using devcpp ( 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.

Message2. Re: wxCheckListBox and runtime errors
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.

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
© Tue 2024-7-23  Guidance Laboratory Inc. Hits:0