Re: Win32Lib; Timed events
- Posted by CChris <christian.cuvier at agric?lture.?ouv.fr> May 16, 2008
- 670 views
ZNorQ wrote: > > CChris wrote: > > > > ZNorQ wrote: > > > > > > > > > I have a couple of questions in regards to timed events in Win32Lib; > > > > > > a) Why wont this code example work? (PS! The mbox is just another form of > > > message_box, > > > and it works - this isn't the problem.) > > > > > > procedure evnTIM_Timer (integer hControl, integer hEvent, sequence > > > uParameters) > > > mbox("5 seconds just passed...") > > > end procedure > > > setTimer(fmMAF, 12, 5000) > > > setHandler(12, w32HTimer, routine_id("evnTIM_Timer")) > > > > > > b) Is it possible to create timers that aren't 'linked' to a window? > > > > > > Kenneth/ZNorQ > > > > Of course. Any control will accept a timer AFAIK. > > > > As to why the message box doesn't show up: try replacing it with a > > showMessage() > > statement, and see if you "get the message". I use this for debugging things > > where the inspected window must not lose focus to the debugger, so it > > definitely > > works. > > > > CChris > > It works now, not because I used the showMessage (I did, but that didn't > change > anything), but because I changed from timer ID 12 to 1... So, I guess you > can't > have 12 timers? (I don't have 12 timers, 12 was just a random number I picked > for my routine..) > > Thank for the feedback, though.. :) > > Kenneth/ZNorQ I just ran this:
include win32lib.ew constant w=create(Window,"eee",0,50,50,50,50,0) procedure p(integer id,integer event,sequence s) w32VOID=message_box("5 seconds just passed...","Test passed",MB_OK) end procedure setHandler(w,w32HTimer,routine_id("p")) setTimer(w,12,5000) WinMain(w,Normal)
and it just works. Message boxes pile up 12 a minute, and each one closes on Ok. CChris