Changing colour with the use of a Toolbox Colour menu
You can download the application from here.
This is an amendment of the previous ‘Drawing’ application
- Insert an ‘Initial’ event handler
The Initial event handler is called only once - before Wimp polling starts. E.g.
sets the initial value of the variable Colour.
- Amend the Drawing event-handler code
The following amendment
draws a filled circle using the desktop colour specified by the value of the variable Colour.
LOCAL radius : radius=400
CIRCLE FILL xo%,yo%,radius
- Add a Colour menu template to the resource file
- Attach the Colour menu to the window
- Add a Colour menu event-handler and amend the code to
CASE event OF
When a Colour menu selection is made the ColourMenu_GetColour method is used to retrieve the selection. The window is then redrawn by forcing a redraw (which causes the DealWith_WindowRedraw handler to be called).
N.B. The window is the ‘parent’ of the attached colour menu.