SELECTALL: Difference between revisions

From Liberty BASIC Family
Jump to navigation Jump to search
m (Text replacement - "Building Blocks Categories" to "Building Blocks")
 
m (1 revision imported)
 

Latest revision as of 03:04, 11 October 2023

Supported in Just BASIC Supported in Liberty BASIC Not supported in Liberty BASIC 5 Not supported in Run BASIC

Description

Selects everything in a text window or text-editor (highlights it).

Syntax

  1. #handle "!selectall"
  2. #handle.ext "!selectall"

Hints

Using !selectall. To quickly remove the contents from the text window, issue this command and then immediately print a #handle.ext ""; to the window.

Example

nomainwin

WindowWidth=300
WindowHeight=300

statictext #h.st1 "Enter contact data", 10, 15, 200, 20
texteditor #h.text 10, 35, 260, 150
button #h.btn "Close", [mainExit], UL, 10, 200

    open "" for window as #h
    #h "trapclose [quit]"
    '
    'print some sample text to the texteditor window
    '
    #h.text "This is the original contents of the data file. ";chr$(13);_
            "Close window without changing text.";chr$(13);_
            "Then change text and close window to see ";chr$(13);_
            "the difference."
    wait

[mainExit]
    'check if text has changed...
    #h.text, "!modified? modify$"

    If modify$ = "true" then
        #h.text "!selectall"        'select text
        #h.text "!copy"             'copy it to clipboard

        '
        'open a window to paste text into
        '
        open "Copy window" for text as #c
        #c "!trapclose [quitC]"
        #c "!paste"
      else
        goto [quit]                 'if modify$ = "false", end program...
    End if

    wait

[quitC]
    close #c                        'close the paste window
    wait

[quit]                              'close main window
    close #h
    end

Useful Procedures

' Place a useful function or sub using this keyword here