# Reset()
| Valid For | #HMI |
|---|---|
| Applies To | HMI430 |
This instruction resets the screen, erasing all buttons and images and then draws either a background image or solid background colour.
Function Prototype
# Reset(
i:"ImageFilename",
b:BackgroundColour
)
| Parameter | Option | Description |
|---|---|---|
| i | optional | The filename of a background image. |
| b | optional | The background colour. Defaults to black. |
Description
Resets SimpleHMI in preparation for drawing a new screen. It does these things:
- Frees all buttons.
- Frees all images.
- Sets the font back to sysdefault.
- Moves the cursor to (0,0).
- Sets the foreground colour to white
- Sets the background colour to transparent.
- Clears the screen.
- Draws either the background image or colour.
Popup
Reset allows you to display a popup. The trick is to create an image smaller than the screen that represents the popup background. Then specify this image and a slightly transparent colour. Reset will draw the translucent colour over the existing screen and display the popup background on top.
#HMI Reset( i:"popup.png", b:'80000000 )
#HMI SetBounds( x:100px, y:50px, w:280px, h:170px )
#HMI Print( "An error has occurred" )
#HMI SetBounds()
This will darken the existing screen and draw the popup image on top. The message will be displayed in the popup.
Examples
#HMI Reset()
This will clear everything from the screen and shows a black background.
#HMI Reset( i:"Woodgrain.png" )
This will clear everything from the screen and draw the “Woodgrain.png” image as the background.