Re: Button behaviour (action during the click action) [message #70742] |
Sun, 02 May 2010 09:14 |
natha
Messages: 482 Registered: October 2007
|
Senior Member |
|
|
Thank you Michael,
PUSHBUTTON_EVENTS keyword is perfect for me. I just need to change a
value when the button is pressed and change it again when the button
release.
I will not have problems with the CPU, I mean, the event handler will
be finished and available to receive the release event.
I think it should work !
nata
|
|
|
Re: Button behaviour (action during the click action) [message #70745 is a reply to message #70742] |
Fri, 30 April 2010 19:35  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 4/30/10 8:11 pm, nata wrote:
> Hi guys,
>
> I need a button with the following behaviour: The user will click the
> button and an event has to be created during the click action. When
> the mouse click is released, the event has to finish.
>
> I'm trying to do that with CW_BGROUP and WIDGET_BUTTON but I realize
> that the events are produced when the button release so I can't
> control the event as I want.
>
> Do you know how can I implement this kind of events ? I want to do
> something while the button is pressed. When the click action finishes,
> my action will stop.
>
> Suggestions ?
> Thanks in advance,
I don't think this is not as simple as it might sound. Check the
PUSHBUTTON_EVENTS keyword to WIDGET_BUTTON. This will allow two events
to be generated: one for the press and one for the release.
But if you just start some event handler after the button push, you will
not receive the button release event until the event handler is finished
(which would be bad since the event handler doesn't want to finish until
the release happens). One way around this is to have some timer based
strategy where the event handler sets a timer when the button is
pressed: every time the timer goes off an event handler is called
(checking first to make sure the button has not been released yet), a
little bit of work is done, and then the event handler exits.
Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
|
|
|