RE: [Win32Lib] button "stobe"?
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C227F2.6C1E5010
charset=iso-8859-1
Dan,
this is doable. But you need a minor change to the library first.
In the routine fDoMouse(), find the line ...
doActions = (and_bits(classAttr[window_type[id]], w32Clickable) != 0)
And add after it ...
or (window_family[id] = BUTTON)
Now you can set up a timer and start it running when you got a LEFT_DOWN
event and stop it when the corresponding LEFT_UP event occurs. Then each
'click' of the timer is your "strobe" event.
Something like this...
---------
include win32lib.ew
without warning
constant MainWin = create(Window, "Repeating Button", 0, 0, 0, 200, 140, 0),
SB = create(StatusBar, "", MainWin, 0, 0, 0, 0, 0),
Btn = create(Button, "Push Me", MainWin, 10, 40, 64, 25, 0)
constant Strobe = 1
integer cntr cntr = 0
integer inc
procedure Mouse_Btn(integer self, integer event, sequence parms)
if parms[1] = WM_LBUTTONDOWN then
cntr = 0
setTimer(MainWin, Strobe, 100) -- 10 flashes/sec
setText(SB, "")
elsif parms[1] = WM_LBUTTONUP then
killTimer(MainWin, Strobe)
setText(Btn, "Push Me")
setText(SB, sprintf("The result was %d", cntr))
end if
end procedure
procedure StrobeFlash(integer self, integer event, sequence parms)
-- do whatever you have to --
cntr += 1
setText(Btn, sprintf("%d", cntr))
end procedure
setHandler( MainWin, w32HTimer, routine_id("StrobeFlash"))
setHandler( Btn, w32HMouse, routine_id("Mouse_Btn"))
WinMain(MainWin, 0)
---------
Derek.
> -----Original Message-----
> From: Dan Moyer [mailto:DANIELMOYER at prodigy.net]
> Sent: Wednesday, 10 July 2002 13:38
> To: EUforum
> Subject: [Win32Lib] button "stobe"?
>
>
>
> Is there some way to get a button to "strobe" on being
> clicked? I mean such
> that if a user clicks on a button & holds it down, a
> recurring event can be
> discerned by the program & responded to, like when you click
> on a scroll
> button. I tried onClick & onMouse( for event LEFT_DOWN ), but neither
> worked for me.
>
> Dan Moyer
>
>
>
>
==================================================================
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en
is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht
onterecht ontvangt wordt u verzocht de inhoud niet te gebruiken en
de afzender direct te informeren door het bericht te retourneren.
==================================================================
The information contained in this message may be confidential
and is intended to be exclusively for the addressee. Should you
receive this message unintentionally, please do not use the contents
herein and notify the sender immediately by return e-mail.
==================================================================
------_=_NextPart_000_01C227F2.6C1E5010
Content-Type: application/ms-tnef
|
Not Categorized, Please Help
|
|