Buggy button activity

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
phil99
In need of some credit
In need of some credit
Posts: 8
Joined: Fri Apr 26, 2013 9:45 pm

Buggy button activity

Post by phil99 »

I created a fairly simple form that has 2 grids on it and 2 combo boxes and 2 buttons, as well as static text components. The button's both do the same thing, they take the selection from the relevant combo box and put it in the relevant grid (meaning they do not use the same combo box or the same grid). I defined the first button's click event and it worked as intended but after i defined the second buttons click event now both buttons use the second buttons click event. It may be worth noting that when i went to create the first buttons event, i doubled clicked the first button in the forms designer and it first gave me an error saying "can not create event", then i double clicked it again and it seemed to work normally, did not have the same problem with the second button. Both click functions are defined in the .h file and have their implementation in the .cpp file. It seems like maybe a problem with the event table (?) but i have no idea how to look at that to see... not sure id understand it even if i did. That being said im fairly new to wxWidgets and this is my first attempt at a program with it. any help would be appreciated.
tbreina
Moderator
Moderator
Posts: 1289
Joined: Thu Nov 25, 2004 7:38 pm
Location: Coronado, CA

Re: Buggy button activity

Post by tbreina »

In the form designer, select the button that is calling the wrong event function. Then, in the designer "property inspector" panel, select the "events" tab. This tab lists all of the events (e.g. mouse clicks) that are associated with the button. Whatever function name is listed in the "OnClick" event is the code that will run when the button is clicked. To change, just click on that name to get the dropdown box. There should be scripts to "remove function" and "add new function". Or, if your function is already written (but not linked to the button), you can just select it from the dropdown box.

Don't forget to save all and do a rebuild all when finished.

-Tony
Everybody's got something to hide except for me and my monkey.
phil99
In need of some credit
In need of some credit
Posts: 8
Joined: Fri Apr 26, 2013 9:45 pm

Re: Buggy button activity

Post by phil99 »

Thanks for the advice, although upon checking i discovered they were both set to their own events, so i checked the class event table and noticed both functions had the same ID used... so i ended up deleting both buttons and recreating them and their functions and now it works. I may have copied the first button to create the second as they both had the same text and i wanted them to look identical #-o . Wont be doing that again. But thanks for the help, if you hadn't have said anything i dont think i would have bothered to look further as i felt really stumped.
Post Reply