REDRAW

From Liberty BASIC Family
Jump to navigation Jump to search
Supported in Just BASIC Supported in Liberty BASIC Not supported in Liberty BASIC 5 Not supported in Run BASIC

Description

In a graphics window or graphic-box, REDRAW refreshes the screen, causing flushed drawing segments to be redrawn.
Caution - Any drawn items that have not been flushed will not be redrawn and will be lost.
Some additional commands used with the display of graphics:
segment
delsegment
cls
discard
flush

Syntax

This command is NOT case sensitive.
Redrawing all undeleted segments:
  1. #handle "redraw" - a graphics window
  2. #handle.ext "redraw" - a graphicbox
Redrawing a segment by its named ID number:
  1. #handle "redraw "; segIDNum
  2. #handle.ext "redraw "; segIDNum
Redrawing a segment by name:
  1. #handle "redraw segmentName"
  2. #handle.ext "redraw segmentName"

Hints

Retrieving idNum. See segment for how to retrieve segment id numbers.
Segment name. See flush for how to save and name the current segment.
Display order. Redrawing all undeleted segments will place the segments in the original order in which they were drawn. (This is called the Z order). Redrawing a named segment will place that segment to the front of the screen.

Example

An example of the command in a graphics window.

nomainwin

    WindowWidth=400
    WindowHeight=300

    open "Redraw Demo" for graphics_nsb_nf as #g
    #g "trapclose [quit]"

    'put the pen down and place it
    #g "down; place 200 130"
    'draw a green circle
    #g "color green; backcolor green; circlefilled 50"
    'save work so far
    #g "flush circle"
    'change color and draw a box
    #g "color red; size 2; place 140 70"
    #g "box 260 190"
    'save the box
    #g "flush box"

    'draw an ellipse but don't flush the current segment
    #g "home; color blue; backcolor blue; ellipsefilled 50 25"

    confirm "Do you want to remove the circle?"; yn$
    if yn$="yes" then #g "delsegment circle"

    'issue a redraw to update the display
    #g "redraw"
    'notice that the ellipse was not redrawn because
    ' that segment was not flushed

    'make graphics stick
    #g "flush"

    wait

[quit]
    close #g
    end

Useful Procedures

' Place a useful function or sub using this keyword here