Iyonix Select Acorn RISCOS 4 Home About Toolbox Examples Downloads
AppBasic

Toolbar


General
Make new
Programs
Compress
Coding
Handlers
errors/png

How to write programs

Applications are event-driven. I.e. they respond to desktop events such as selecting a menu-entry, clicking an action button, etc. When a desktop event occurs an AppBasic application calls one (or more) standard procedures known as the event handlers. Programming consists of amending the definitions of these procedures. For example, an iconbar event would call the procedure:
DEF PROCDealWith_Iconbar(event,object,component)
CASE event OF
 WHEN Iconbar_Clicked
     CASE component OF
       WHEN 0 : REM Select
       WHEN 1 : REM Adjust
     ENDCASE
 WHEN Iconbar_SelectAboutToBeShown
 WHEN Iconbar_AdjustAboutToBeShown
ENDCASE
ENDPROC

To display the message “Hello world” when the iconbar icon is selected, you could amend the above procedure to

DEF PROCDealWith_Iconbar(event,object,component)
CASE event OF
 WHEN Iconbar_Clicked : PROCUtils_Alert(“Hello world”)
ENDCASE
ENDPROC