News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

wxSmith: Slider event not fired

Started by MortenMacFly, January 07, 2009, 11:50:24 AM

Previous topic - Next topic

MortenMacFly

Dear Byo,
I am using wxSmith to embed a slider in a configuration dialog.
I have attched to the EVT_COMMAND_SCROLL which creates this code:
Connect(ID_SLD_MINUTES,wxEVT_SCROLL_TOP|wxEVT_SCROLL_BOTTOM|wxEVT_SCROLL_LINEUP|wxEVT_SCROLL_LINEDOWN|wxEVT_SCROLL_PAGEUP|wxEVT_SCROLL_PAGEDOWN|wxEVT_SCROLL_THUMBTRACK|wxEVT_SCROLL_THUMBRELEASE|wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&TimeDlg::OnMinutesChanged);
unfortunately the method is never called. If I add the "same" manually into the event table like:
BEGIN_EVENT_TABLE(TimeDlg,wxDialog)
  EVT_COMMAND_SCROLL(ID_SLD_MINUTES, TimeDlg::OnMinutesChanged)
END_EVENT_TABLE()

...then it works.
Probably it_'s not a wxSmith issue... but just in case it is I'll report it here and do some further investigations...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Jenna

#1
The code created by wxSmith can not work, because wxEventType is internally an int ("typedef int wxEventType;") and newly created events are generated with the increment operator.

So putting multiple events together with "|" can never do what you expect.

The best way would be to use the event_table, otherwise all events have to be connected one by one (if "Connect()" shall be used all events have to be connected as if you chose them manually and connect them all with the same event handler).

byo

Surely a bug - preprocessor expands the macro to or-ed version probably.
The only solution for now I could suggest is not to use the EVT_COMMAND_SCROLL but connect all other events separately to the same function.

Regards
   BYO

MortenMacFly

Quote from: byo on January 07, 2009, 11:51:06 PM
The only solution for now I could suggest is not to use the EVT_COMMAND_SCROLL but connect all other events separately to the same function.
...which is somehow the proposal of Jens... ;-) Thanks guys.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]