Is there anything like a wxPushButton?

Carsten A. Arnholm arnholm at offline.no
Thu Nov 22 23:44:22 PST 2007


Personaje wrote:
> Carsten A. Arnholm wrote:
>> Carsten A. Arnholm wrote:
>>> Hi,
>>>
>>> I am using WX 2.8.6 on WinXP and Kubuntu
>>>
>>> My application controls a motor over a serial port. I want to
>>> implement a feature using a "pushbutton", i.e. as long as the button
>>> is being pushed, the motor runs. When the button is released the
>>> motor stops. I also want the button to take a different colour when
>>> it is pressed. Finally, it should be possible for the user to press
>>> the button, and it should also be possible for the program to set the
>>> button in a pressed state, with the same effect.
>>> How can I do this with wxWidgets? Is there something like a
>>> wxPushButton to do it? Or maybe it can be done with the standard
>>> wxButton somehow?
>>> Any tips appreciated.
>>
>> Hi again,
>>
>> Just to clarify: I am only looking for tips how to handle the 
>> pushbutton GUI, I have the serial port etc. sorted out.
>>
> Use wxToggleButton 
> http://www.wxwidgets.org/manuals/stable/wx_wxtogglebutton.html#wxtogglebutton 

Hi,

Thanks for the input, but that does not seem to match my need. The 
wxToggleButton stays pressed when clicked by the user (according to 
doc), but I need a button that reflects exactly the physical mouse 
button. The state should be pressed as long as the user presses the 
button, and the state should be released and some kind of release event 
generated when mouse button is released. Essentially this is like a 
simple "spring loaded button".

It is entirely possible that I don't see the possibilities of 
wxToggleButton clearly, but as I understand it now it does not do what I 
want. Please correct me if I am wrong.

Regards
Carsten Arnholm






More information about the wx-users mailing list