PASTE

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

Places any text on the Windows clipboard at the current cursor position in a text window or text-editor.

Syntax

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

Hints

Using !paste. Text copied to the clipboard is available to be used again and again until it is replaced with different content. You can use paste (and copy) to programatically provide a find/replace procedure in your program.

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