Home Index classes Index static functions Index enumerations Index structure types

{Long_operation}


CLASS {Long_operation} , UNTESTED, DESTRUCTORS, NATIVE:


The form class to show it automatically when a long operation is detected. In the AL-IV, on each loop iteration (in all the FOR statements in the entire code) the global counter is decreased and if it was zeroed, a stub function is called (usually on each 65535th time) to reinitialize that counter and to call the system function which checks if a long operation occur. A long operation is detected in case when your code did not end a method called to handle the last event for a long time period (more then 1 second). It is also possible to provide a progress of long operations in your code which will be displayed on this form. To do so, just use a form method Long_operation, which returns an instance on the {Long_operation} associated with the form (or creates it and rerturns if it was not yet created). And, use its methods like Set_progress, Set_description etc. to specify such information during a long operation. Also, it is possible to call periodically the Indicate method to inform the {Long_operation} form that your code still working and it it is not necessary to detect a long operation (this just resets time point from which the 1 second period is starting).
But the main purpose of the (non-modal) dialog is to allow to user to pause or cancel the operation detected without crashing entire application.
There is a compiler option to disable such checks on each iteration and to show the long operation dialog. It is better in such case to specify a path to a dummy implementation of the {Long_operation} form to minimize dependances. It is also possible to make your own implementation of a long operation detection function for your own purposes.


IMPORT : {AL4_form} .

BASE CLASS {Form} .


STR Sender_alias , INIT



--------------------------------------------------------- 'visual controls'


METHOD Set_description ( STR D|escription_text )


Set a description for a long operation planned to be executed. It is also possible to change the description at any time later.


METHOD Set_stage|_details ( STR D|etails_on_current_stage )


Set a description for a long operation stage of the operation).


METHOD Set_progress|_0_TO_100 ( REAL P|rogress_value )


Set a progress for a long operation (this is optional, if there were no call of thatg method, the progress is just looping).

BOOL Paused|_until_button_pressed_again , READ

TRUE, if the long operation was paused.


BOOL Cancelled|_operation , READ

TRUE, if the operation was cancelled (by the user).



METHOD Indicate|_activity ( BOOL Proc|ess_messages ) , CALLBACK


Use this method to restart counting 1 second before deciding that your code is no more responding. Pass TRUE as the parameter to allow processing other events on the form. This makes your application more resposibility without using threading ({Thread} class).

BOOL Finished|_operation


END