Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

wxSmith: Slider event not fired

(1/1)

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:

--- 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);
--- End code ---
unfortunately the method is never called. If I add the "same" manually into the event table like:

--- Code: ---BEGIN_EVENT_TABLE(TimeDlg,wxDialog)
  EVT_COMMAND_SCROLL(ID_SLD_MINUTES, TimeDlg::OnMinutesChanged)
END_EVENT_TABLE()

--- End code ---
...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...

Jenna:
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.

--- End quote ---
...which is somehow the proposal of Jens... ;-) Thanks guys.

Navigation

[0] Message Index

Go to full version