wxTextCtrl problems Topic is solved

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Post Reply
delrocco
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu Nov 17, 2005 11:20 pm

wxTextCtrl problems

Post by delrocco »

Hello, I'm new to wxWidgets and this board.
I apologize if this question has been answered already..

When adding wxTextCtrl to my custom frame, I get an assert on cleanup after closing the frame. This happens whether I use any sizer or even a panel to put it on.

Could anyone tell me why this works? ( wxButton )

Code: Select all

wxPanel *testPanel = new wxPanel( this, -1 );
btnBrowseFile = new wxButton( testPanel, ID_BTN_Browse, "..." );
btnBrowseModel = new wxButton( testPanel, ID_BTN_Browse, "..." );
But this gives an assert on closing the frame? ( wxTextCtrl )

Code: Select all

wxPanel *testPanel = new wxPanel( this, -1 );
tfFileName = new wxTextCtrl( testPanel, ID_TF_File, "kdsjflkds" );
tfModelName = new wxTextCtrl( testPanel, ID_TF_Model, "kdsjflskd" );
This is the first wxTextCtrl I've attempted to add and I can't figure out why I keep getting this assert on cleanup. The rest of my application seems to be working well, including menus, slider, custom window w/ Gamebryo render, etc..
tsaphah
Earned a small fee
Earned a small fee
Posts: 16
Joined: Mon Jul 04, 2005 1:31 am

Re: wxTextCtrl problems

Post by tsaphah »

delrocco wrote:This is the first wxTextCtrl I've attempted to add and I can't figure out why I keep getting this assert on cleanup.
Could you explain what you mean by cleanup maybe? Are explicitly calling Destroy() on the controls? Manually 'delete'ing the pointers? Let wx take care of it all?

The code you have posted looks fine to be, but I've not played with wxWidgets enough to make all the "dumb" mistakes and remember them :D
delrocco
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu Nov 17, 2005 11:20 pm

Post by delrocco »

For this particular frame (which really should be a dialog, but I already had one frame working, so thinking the problem was the dialog I switched it ) the only creation code I have is:

Code: Select all

wxPanel *testPanel = new wxPanel( this, -1 );
tfFileName = new wxTextCtrl( testPanel, ID_TF_File, "kdsjflkds" );
Image

I only call "Destroy" on the frame itself in the OnClose even handler, but not on the wxTextCtrl itself ( which I thought was the standard )?
I have tried wxButton, wxStaticText, wxStaticLine, wxPanel, various sizers including wxGridSizer, wxGridBagSizer, wxBoxSizer which all seem to work.
I have even copied the code out of wxTextEntryDialog ( textdlgg.cpp ).. but whenever I add a wxTextCtrl I get that nasty assert. It's a very dangerous looking assert like memory overwrite error or something..

Image
Image
lowjoel
Part Of The Furniture
Part Of The Furniture
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel »

i know this sounds stupid, but have you tried rebuilding your project? sometimes these things occur when you made changes to your class decl and you havn't rebuilt
delrocco
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu Nov 17, 2005 11:20 pm

Post by delrocco »

yea.. in fact I don't even use PCH and typically do a full rebuild for those very reaons. Though I haven't rebuild wxWidgets... maybe I should?

I've even stripped out the Gamebryo window now and the IdleEvent handlers I had.. and now I don't get the error on close of the new frame, but I still get it on close of the application or main frame. And if I spawn the new frame 2 or 3 times, I get that error 2 or 3 times as well... which makes me think its the wxTextCtrl itself, but I don't know.
delrocco
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu Nov 17, 2005 11:20 pm

Post by delrocco »

Ok, I'm completely lost as to what the problem is...

I've ripped everything out of "textdlgg.h/cpp" and made my own dialog with that code in an attempt to recreate the wxTextEntryDialog. I spawn the dialog from my main frame. I've even ripped out the Gamebryo window... but I still get the same error on closing it ( or even dissmissing modal with OK/Cancel ).

What I can't understand is that wxTextEntryDialog works when I spawn that... but when I take that code and create my own dialog and spawn it, I get the memory error...

Has anyone had a problem similar to this?
delrocco
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu Nov 17, 2005 11:20 pm

Post by delrocco »

Ok, I came back to wxTextCtrl ( since I couldn't put it off any longer in the app ) and finally made some progress.

Thanks for the library rebuild suggestion actually..
I should of thought of this earlier but I guess when I was building and testing the samples/demos, I forgot they were rebuilding core and other sections and copying over the resulting .libs and headers ( stomping on my previous wxWidgets full build? ).

Not sure, but after a full build of wxWidgets, my same code is working.
Post Reply