SELECTION

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

Returns the highlighted text from a list item in a Listbox or Combobox. The selection is placed into the variable selected$.

Syntax

  1. print #handle, "selection? selected$"

Hints

No selection. If no text or list item is selected, the variable value will be an empty string (e.g. "").

Example

' An example using SELECTION? with a listbox.
nomainwin
a$(1) = "one"
a$(2) = "two"
a$(3) = "three"
a$(4) = "four"

listbox #win.listbo, a$(),doListbo,10,10,120,200

    open "Selection? Demo" for window as #win
    #win "trapclose Quit"
    #win.listbo "selectindex 1"

    wait

sub Quit handle$
    close #handle$
    end
    end sub

sub doListbo handle$
    'Get the text value from selection and place it in sel$ variable.
    #handle$ "selection? sel$"
    notice "You chose ";sel$
    end sub

Useful Procedures

' Place a useful function or sub using this keyword here