A SERVICE OF

logo

DesktopX 2.4 Developer’s Guide
_____________________________________________________________________________
_____________________________________________________________________________
Page 38
in fact it is more similar to the Internet Explorer Online/Offline status, that’s independent from
the actual network connection status.
A tentative protocol works like this:
- Have a global script variable, e.g. IsConnected.
- When IsConnected is changed to TRUE, the object can update and retrieve info from the
Internet. It can also start a timer to periodically do that.
- When IsConnected is changed to FALSE, the object won’t try to retrieve info from the
internet. Any timer that does that is “killed”.
- IsConnected can be first set on OnScriptEnter by checking for the actual connection
status by calling System.InternetConnected and setting IsConnected accordingly.
- When IsConnected is FALSE, the objects GUI should represent this status. I.e. you can
use a text object that shows a red “Offline” text. From here on, only the user can
manually retry to set IsConnected to TRUE (i.e. by clicking another DX object). Here is
another System.InternetConnected check and IsConnected is set accordingly.
- The user can manually set the Offline status as well. I.e. one could just not want an object
to keep updating from the Internet.
4.11 Never use the Sleep method in scripts
Though there is support for a simple Sleep method, it is highly suggested that you avoid it,
because it could cause the input to hang.
In most cases a timer can do the job. Though a bit more work and a slightly more complex script
is required to do this, it is the way to go if you want to build great objects.
If you are using ActiveX controls, be sure you use the clean ActiveX events to be notified, and
not brutal Sleeps. For example, in a Web Browser control use the Sub
Control_DocumentComplete and Sub Control_NavigateError events to act according to
navigation success.
4.12 Only package useful objects
When exporting objects or theme, be sure you first check Object Navigator the list of objects to
be exported. It is possible that you export unused, invisible objects that remain from old work,
thus wasting memory and disk space. A careful look at Object Navigator to double-check that all
objects are used, that children have proper settings (“Child” = yes), etc. is surely worth the extra
effort. Also ensure that all scripts which should be enabled are enabled.