appglobalswitch TacAppGlobalSwitch component
Hierarchy Properties Events
Return to Introduction  Previous page  Next page
Overview
The acAppGlobalSwitch component is the small utility which may help you to control some general option (boolean value) and its changes in entire application. When you change the boolean value in one acAppGlobalSwitch, other components connected to it, will reflect change, and trigger OnSwitch event.  
 
For example, your application have a number of ListView's, on various forms. These ListView's have some option ("show hidden items", for example), which should be imediately applied to all other ListView's, on another forms, when option switches.  
 
To implement this, you should drop acAppGlobalSwitch on each form which have ListView's, and connect acAppGlobalSwitch'es each to others (specifying main acAppGlobalSwitch, on the main application form, to GlobalSwitch property). Then, when you will change the value of Value property at run-time, each connected acAppGlobalSwitch'es will also change the Value accordingly, and fire OnSwitch event, so you can process changes (refresh the ListView, in each OnSwitch event handler, for example).  
 
Additionally, the acAppGlobalSwitch have useful feature, RegistrySaver, which helps you to save the Value property to the system registry on application close, and restore this value when application restarts. Note: you don't need to enable the RegistrySaver in every acAppGlobalSwitch, one enabled RegistrySaver in the main acAppGlobalSwitch on the main form is enough. Anyway, all other connected "switches" will reflect changes of Value property.  
 
iiinfo Connected components is the component specified in GlobalSwitch property, plus all components which connected to THIS acAppGlobalSwitch component. In ideal, you should have one main "switch", and some number of secondary "switches" connected to the main "switch".  

See also
acAppGlobalAlert component.