










|
Clock
 A simple desktop clock displaying the current time by responding to “Null” events
You can download the application from here.
- Create a new window application
- Do NOT set the ‘Auto-show’ and ‘Auto-create’ flags
- Edit the template
- Resize the window
- Add a ‘Display’ gadget
- Remove some of the window ‘furniture’
At this stage the window should look like the image above
- Insert the null event handler
DEF PROCDealWith_NullEvent
PROCDisplayField_SetValue(window,0,FNCurrentTime)
PROCUtils_IncrementPollIdleTime(100):REM Return in 1 second
ENDPROC
|
- When this procedure is called the current time is placed in the display-field gadget. (The function CurrentTime returns the current time as a string; see the finished application for details)
- The procedure Utils_IncrementPollIdleTime
specifies a time - in centiseconds - before which the null event-handler is not to be called again
- Insert the Initial event-handler
DEF PROCDealWith_InitialEvent
PROCCreateAndShowWindow
PROCUtils_PollIdleOn
ENDPROC
DEF PROCCreateAndShowWindow
window=FNToolbox_CreateObject("Window")
PROCToolbox_ShowObject(window,3)
ENDPROC
|
- The procedure CreateAndShowWindow creates and shows the window on the desktop, storing its object id in the variable window
- The utility Utils_PollIdleOn switches polling to “Poll idle” form. (Effectively the application can "sleep", not being woken up until a specified time has passed or until it has some action to perform).
|