RE: [Win32Lib] button "stobe"?
- Posted by Derek Parnell <Derek.Parnell at SYD.RABOBANK.COM> Jul 10, 2002
- 382 views
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_01C2285F.7971A3D0 charset=iso-8859-1 Yes, I've already made the change to the next release. > -----Original Message----- > From: Dan Moyer [mailto:DANIELMOYER at prodigy.net] > Subject: Re: [Win32Lib] button "stobe"? > > > > Derek, > > Ok, the timer is something I had just tried before I checked > here, & did > discover that it wouldn't run from a button press, & then I > saw some places > in Win32Lib that seemed to exclude onMouse from buttons (anything but > windows?), so I see what you're saying. My only question > is, would the > change you indicated be included in the next version of > Win32Lib, so my code > could work for anyone ? > > Dan > > ----- Original Message ----- > From: "Derek Parnell" <Derek.Parnell at SYD.RABOBANK.COM> > To: "EUforum" <EUforum at topica.com> > Sent: Wednesday, July 10, 2002 2:15 AM > 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 <snip> > > > ================================================================== 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_01C2285F.7971A3D0 Content-Type: application/ms-tnef