AUTORESIZE

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

Graphics Method

Description

Automatically resizes a graphicbox control so the edge margins are maintained if a user resizes its containing window.

Syntax

  1. #handle.ext "autoresize"

Hints

Using autoresize. If you use the autoresize command, you must also flush any graphics that you place on the graphicbox. Any graphic elements not flushed will be lost if the window is resized, or minimized and restored.

Example

nomainwin
WindowWidth=500
WindowHeight=400

graphicbox #1.gb 10, 10, 400, 300

    open "Autoresize Demo" for window as #1
    #1 "trapclose [quit]"
    'make the graphicbox able to be resized with the window
    #1.gb "autoresize"

wait

[quit]
    close #1
    end

Useful Procedures

' Place a useful function using this keyword here

Text Editor Method

Description

Enables the texteditor to resize along with the containing window, maintaining edge margins.

Syntax

  1. #handle.ext "!autoresize"

Hints

Sizing. If your window does not have a sizing frame (e.g. window_nf), you will not need to provide a way to resize the texteditor. But, if the window can be resized, it just makes sense to resize the texteditor when a user does change the window's size. That's the purpose of !autoresize, which works for texteditors only.
Caution. In JustBASIC, there is no native way to reposition controls if a user resizes a window. Be aware that a texteditor control that can be autoresized may end up covering other controls if its window is resized.

Example

nomainwin

WindowWidth=300
WindowHeight=400

statictext #h.st1 "Enter text data", 10, 15, 200, 20
texteditor #h.text 10, 35, 260, 150

    open "" for window as #h
    #h "trapclose [quit]"
    #h.text "!autoresize"

    wait

[quit]
    close #h
    end

Useful Procedures

' Place a useful function using this keyword here