SELECT

From Liberty BASIC Family
Revision as of 03:04, 11 October 2023 by StPendl (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

Selects the Listbox or Combobox list item matching the string parameter and updates the display.
For SELECT as used in SELECT CASE statements, see SELECT..CASE

Syntax

  1. print #handle.ext, "select string"
  2. print #handle.ext, "select "; string$

Hints

Text Selection. Use SELECT when working with the text content of a list item, rather than its index number.

Example

'Using SELECT with a list
nomainwin
a$(1) = "apple"
a$(2) = "orange"
a$(3) = "banana"
a$(4) = "pear"

listbox #win.lst, a$(),doLst, 10, 10, 120, 200

open "Select Demo" for window as #win
#win "trapclose Quit"
' Use SELECT to highlight the default selection
#win.lst "select banana"

wait

sub Quit handle$
    close #handle$
    end
    end sub

sub doLst handle$
    #handle$ "selection? sel$"
    notice "You chose ";sel$
    end sub

Useful Procedures

' Place a useful function or sub using this keyword here