At 11:46 AM +1000 on 4/28/00, Robin wrote: >Can anyone explain this? The following neat code from Brian J. Hughes worked >as is, but didn't when I tried to put in a barber pole into my own app. When >trying to track down why, I found that if I change the example to make FN >doDialog do a WINDOW id upon a _wndActiviate event, as follows: I'm sorry, I should have posted the final code. I went around a few more times with [<SVANVOORST@...> (The originator of the thread)] and finally figured out why there were problems with that code. Originally I couldn't get the toolbox function (Call IdleControls) to work inside the main loop. For a clock control you would want the IdleControls in the main loop. For a barber pole type progress bar you want the IdleControls in whatever loop you need it in. Originally I put the IdleControls in the main loop but it wouldn't work. That's why I put it in the wndRefresh event, so that the control gets 'idles' when the window gets refreshed. Problem: put the window in the background and it doesn't work. Finally, I did figure out the problem. Seems you need to make the window _noAutoClip for IdleControls to work in the main loop I've included the final code below. (If you get rid of the progress bar code it makes a nice little clock.) '---------------------- 'Resources "Beep.rsrc" 'electronic beep-beep INCLUDE "Tlbx Appearance.Incl" Begin GLOBALS DIM clockH& DIM indeProgessH& DIM wndPtr& DIM doOnce END GLOBALS LOCAL DIM clockRect as rect DIM progressRect as Rect LOCAL FN buildWnd DIM OSErr WINDOW #1,"clock control",(0,0)-(200,120),_docNoGrow + _noAutoClip clockRect.top% = 30 clockRect.left% = 50 clockRect.bottom% = 50 clockRect.right% = 150 progressRect.top% = 70 progressRect.left% = 50 progressRect.bottom% = 90 progressRect.right% = 150 wndPtr&=WINDOW(_wndPointer) LONG IF wndPtr& <> 0 clockH& = FN NEWCONTROL(wndPtr&,clockrect,"",¬ _true,3,0,0,241,0) indeProgessH& = FN NEWCONTROL(wndPtr&,¬ progressRect,"",_true,3,0,0,80,0) OSErr = FN SetControlData (indeProgessH&,_kControlIndicatorPart,¬ _kControlProgressBarIndeterminateTag,0,0) END IF END FN LOCAL FN doTimer BEEP 'this works but a sound file END FN 'works and sound better LOCAL FN doSyncClock LONG IF (TIMER MOD 60) = 0 doOnce = 1 'start the 60 second timer ON TIMER (60) FN doTimer 'at the start of the next minute FN doTimer END IF END FN LOCAL FN doDialog DIM evnt% DIM id% evnt% = DIALOG(0) id% = DIALOG(evnt) SELECT evnt% CASE _wndClose END END SELECT END FN FN buildWnd TIMER = 0 ON DIALOG FN doDialog DO HANDLEEVENTS CALL IdleControls(wndPtr&) IF doOnce = 0 THEN FN doSyncClock UNTIL 0 '---------------------------- Brian Hughes