[Fwd: Spinner Events in wxGTK]

Sorry all, the example I posted yesterday was incorrect. The example I have now attached is the actual test case. I've included a binding to EVT_SPINCTRL - which does work, but the bindings to EVT_SPIN_UP and EVT_SPIN_DOWN do not. To see run the enclosed app, no events are fired when you press the spinner buttons (although the value changes). If you comment out lines 27 and 28 and uncomment line 29 then it works.

My problem is that PythonCard binds to EVT_SPIN_UP and EVT_SPIN_DOWN, which works fine on MSW. I'd like, if possible, to keep this because changing the default event in PythonCard to EVT_SPINCTRL loses a little bit of control for the programmer.

Regards,
Andy

wxSpin.py (1.14 KB)

wxSpin.py (1.08 KB)

Spinner Events in wxGTK (2.64 KB)

···

--
--------------------------------------------------------------------------------
From the desk of Andrew J Todd esq - http://www.halfcooked.com/

Andy Todd wrote:

Sorry all, the example I posted yesterday was incorrect. The example I
have now attached is the actual test case. I've included a binding to
EVT_SPINCTRL - which does work, but the bindings to EVT_SPIN_UP and
EVT_SPIN_DOWN do not. To see run the enclosed app, no events are fired
when you press the spinner buttons (although the value changes). If you
comment out lines 27 and 28 and uncomment line 29 then it works.

The behaviour fits the docs:

"""
EVT_SPINCTRL(id, func)

Generated whenever the numeric value of the spinctrl is updated. You
may also use the wxSpinButton event macros, however the corresponding
events will not be generated under all platforms

"""

Clearly that's the the case here.

My problem is that PythonCard binds to EVT_SPIN_UP and EVT_SPIN_DOWN,
which works fine on MSW.

But not on all platforms...

I'd like, if possible, to keep this because
changing the default event in PythonCard to EVT_SPINCTRL loses a little
bit of control for the programmer.

Well, that's why it is a good idea to:
a) read the docs
b) test on multiple platforms.

I've found that while wxPython lets you write code that works on all
platfroms, not all code works on all platforms, so you need to test. I
often find that I have something working on GTK, then on Windows it
doesn't, but if I do everything the way the docs recommend, I can find a
version of the code that works everywhere.

I imagine there is a reason that wxSpinCtrl doesn't generate all the
events, so you're probalby stuck with making PythonCard work in the
recommended fashion.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Andy Todd wrote:

My problem is that PythonCard binds to EVT_SPIN_UP and EVT_SPIN_DOWN, which works fine on MSW.

Only because of a platform specific implementaion detail, a.k.a "by accident". :wink: wxSpinCtrl is only guarenteed to produce EVT_SPINCTRL as stated in the docs. PythonCard is wrong to use those events with a wxSpinCtrl.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

From: Robin Dunn [mailto:robin@alldunn.com]

Andy Todd wrote:
>
> My problem is that PythonCard binds to EVT_SPIN_UP and EVT_SPIN_DOWN,
> which works fine on MSW.

Only because of a platform specific implementaion detail, a.k.a "by
accident". :wink: wxSpinCtrl is only guarenteed to produce EVT_SPINCTRL as
stated in the docs. PythonCard is wrong to use those events with a
wxSpinCtrl.

Unless, it is also platform-specific, I'll probably just continue to support
EVT_TEXT since that way you see update events regardless of whether the user
used the arrow buttons or changed the text by typing. The EVT_SPIN_UP and
EVT_SPIN_DOWN were only added when one user was trying to create a spinner
that handled non-integer values. That opened up its own can of worms and
basically needs its own custom control AFAIK, so I will remove the
EVT_SPIN_UP and EVT_SPIN_DOWN bindings since they don't serve much purpose
and are platform-specific.

ka

Kevin Altis wrote:

From: Robin Dunn [mailto:robin@alldunn.com]

Andy Todd wrote:

My problem is that PythonCard binds to EVT_SPIN_UP and EVT_SPIN_DOWN,
which works fine on MSW.

Only because of a platform specific implementaion detail, a.k.a "by
accident". :wink: wxSpinCtrl is only guarenteed to produce EVT_SPINCTRL as
stated in the docs. PythonCard is wrong to use those events with a
wxSpinCtrl.

Unless, it is also platform-specific, I'll probably just continue to support
EVT_TEXT

Yep, that looks like it should be passed up on the other platforms too.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!