Re: [Win32Lib] button "stobe"?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thanks!  I applied your suggestion, & not only did your demo work neat, but
the code I had previously written trying to make timers do the strobing
actually worked too.

Dan

----- Original Message -----
From: "Derek Parnell" <Derek.Parnell at SYD.RABOBANK.COM>
To: "EUforum" <EUforum at topica.com>
Subject: RE: [Win32Lib] button "stobe"?


>
> 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
> >
> >
> ==================================================================
>
>
> ==================================================================
>
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu