Re: application timeout
Hi Dave,
Yes it does, but A5 crashes are another thing. Once the stack is toasted, anything can happen.
Hi Dave,
Originally posted by davidv43
View Post
Alpha Software Mobile Development Tools: Alpha Anywhere | Alpha TransForm |
'Date Created: 05-Feb-2010 07:52:18 PM 'Last Updated: 05-Feb-2010 07:52:18 PM 'Created By : Ira J. Perlow 'Updated By : Ira J. Perlow FUNCTION XdialogTimerTest AS C (Close_Dialog as C,Close_Time=(NOW()+20) as T) 'DESCRIPTION: Runs XDialog Code with Timer events for testing '========================================================================= ' Created by Computer Systems Design & Associates ' Copyright 2010 Computer Systems Design & Associates, All Rights Reserved ' http://www.csda1.com ' You may use this code at your own risk in whole or as a part for personal ' use only ' ' No other use is granted without written permission from the author ' including any commerical code library or instructional guide '========================================================================= ' Run the next two lines (without the single quote comment character ' in the Interactive editor or any other code ' XdialogTimerTest("TestModal",NOW()+20) ' This next line can't be run until "TestModal_2" Xdialog closes ' ui_dlg_box("TestModal","This is a sample modal Xdialog box;<ok>") ' 20 seconds after starting XdialogTimerTest() above, ' the "TestModal" Xdialog will close if it exists '========================================================================= ' Function Input Parameters ' Close_Dialog - Name of Xdialog box, modal or modeless, to Close ' Close_Time - Time to wait until to execute code ' defaults to current time + 5 seconds ' Function Output - null string '========================================================================= ' Set return value to null XdialogTimerTest="" dim Close_Dialog as C dim Close_Time as T 'close_dialog="TestModal" 'close_time=NOW()+5 dim close_time_TestModal_2 as T close_time_TestModal_2=NOW()+10 dim dlgtit as c dlgtit="XDialog Timer Test" dim dlgbdy as C dlgbdy=<<%dlg% {position=remember=sticky} {size=remember=sticky} {startup=init} {can_exit=close} {timer=timerevent} {interval=1} Current Time:[timevalue] <*15Test Code!TestButton>; {stretch=height,width} [%m%.43,5display]; %dlg% dim dlgevt as c dlgevt=<<%code% ' Get upper trimmed event name for tests dim buttxtu as c buttxtu=UPPER(alltrim(a_dlg_button)) ' clear event variable a_dlg_button="" if (buttxtu=="CANCEL").or.(buttxtu=="CLOSE") ' If closed with the "Red" X in upper right corner ' or if Cancel button is pressed (if we have one) ' then close this XDialog ' The exist test below, while not really needed here, ' is generally a good safety net. IF ui_modeless_dlg_exist(dlgtit) ui_modeless_dlg_close(dlgtit) END IF else if (buttxtu=="TIMEREVENT") ' Set the new time value to display so we ' can see ticking seconds of the timer event timevalue=time() ' Display time value on status bar as well statusbar.set_text(timevalue) ' Display some text so we can see something ' Get list of open MDI type A5 windows display=a5_list_open_windows() ' After 10 seconds we will close the "TestModal_2" ' modal Xdialog box we opened after we started ' this Modeless One IF now()>close_time_TestModal_2 IF ui_modeless_dlg_exist("TestModal_2") ui_modeless_dlg_close("TestModal_2") END IF END IF ' We'll wait for close_time until we do something IF now()>close_time ' time has passed, now we'll do what we want to do ' You can put any code you want here, and Alpha will ' execute it if this event is occuring (which is ' indicated by the changing time value on the display) ' See if Xdialog (modal or modeless name) we specified ' on the function's parameters exists ' and close if it does IF ui_modeless_dlg_exist(close_dialog) ui_modeless_dlg_close(close_dialog) END IF END IF else if (buttxtu=="INIT") ' Initialize a time value to display so we ' can see ticking seconds of the timer event dim timevalue as c timevalue=time() ' Display some text so we can see something dim display as c display=a5_list_open_windows() else if (buttxtu=="TESTBUTTON") ' place testcode button here in case you want to test something ' If you run code that is modal here then event processing for this XDialog ' is held up until the modal window we created here is closed ui_dlg_box("TestModal_1",<<%text% This is a modal Xdialog box; Opened within the event handler; of the modeless Xdialog Timer Test box; which creates a "child" Xdialog box; ;;; Making it modal is not something; one should normally do in an ; event handler; ;;; Notice the timer has stopped; while this is open which indicates; the event handling for this XDialog; has paused; ;;; However other XDialog boxes with; timer events going can still run code; that will close either any XDialog; ;;; What happens if you close the "parent"; Xdialog prior to the "child" depends; on options of the child's Xdialog body; when it was started; ;;; You also can't click on the; Xdialog Timer Test box; until this one is closed; <ok> %text%) END IF end %code% dim tmp as c tmp="" ' Start Xdialog modeless box tmp=ui_modeless_dlg_box(dlgtit,dlgbdy,dlgevt) ui_dlg_box("TestModal_2",<<%text% This is a modal Xdialog box; Opened in the current session; of the modeless XDialog Timer Test box; after it was opened.; ;;; Notice the timer is still going; but you can't click on the; Xdialog Timer Test box; until you close this; Or wait 10 seconds for the timer; event to close this; <ok> %text%) END FUNCTION
Comment