Using the Thread UI_Disable Property

Description

UI_Disable is a property of all threads. When set to .T., much UI-related functionality within Alpha Anywhere is disabled. This is useful in a background thread, for example to prevent a print progress dialog from being displayed.

Disabling UI for the Current Thread 

dim thread_pointer as P
  
thread_pointer = thread.current() 
 thread_pointer.ui_disable = .t.

Disabling UI for Another Thread 

dim thread_pointer as P
  
thread_pointer = thread.get("some_other_thread") 
 thread_pointer.ui_disable = .t.

Disabling a Newly Created Thread 

dim thread_pointer as P
  
thread_pointer = thread.create("my_background_thread",<<%code% 
 'some Xbasic code you'd like to run in a background thread 
 %code%) 
 thread_pointer.ui_disable = .t.

As shown above, you can disable the UI for any thread which you can get a pointer. However, keep in mind that if you are creating a new thread, it is better to disable the UI at the beginning of the that new thread instead of at the beginning of the script which creates that thread. Because threads run asynchrounously, it is entirely possible in example above that the thread try to run something that displays a UI before the main script disables the UI. So while example 3 above is perfectly valid from a syntax standpoint, the recommended technique would be:

dim thread_pointer as P
  
thread_pointer = thread.create("my_background_thread",<<%code% 
 thread_pointer = thread.current() 
 thread_pointer.ui_disable = .t. 
 'some Xbasic code you'd like to run in a background thread 
 %code%)

See Also