RELOAD

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

Causes the list in a listbox or combobox to be refreshed, using the contents of its array. If there are changes in the array, the list will be updated. A RELOAD command must be issued anytime a change is made to the array in order to keep the list up to date.

Syntax

  1. #handle.ext "reload"

Hints

Reloading. When a RELOAD command is issued, the original contents of the list is replaced with the array's current contents. The list is not modified. It is replaced.

Example

'reloading a listbox after deleting an item
nomainwin
a$(1) = "one"
a$(2) = "two"
a$(3) = "three"
a$(4) = "four"

listbox #win.lst, a$(),[doChg],10,10,120,200
statictext #win.st1 "Double click an item to delete it.", 10, 220, 200, 25

    open "Reload Demo" for window as #win
    #win "trapclose [Quit]"
    #win.lst "selectindex 1"

    wait

[Quit] close #win:end

[doChg]
    #win.lst "selection? sel$"
    notice "Deleting ";sel$

    'To delete an item, loop through the array. If an item 
    ' matches '''sel$''', set that array number to an empty string.
    '
    'When reloading the list, any array item with a value of ""
    ' will be skipped.
    '
    for i = 1 to 4
        if a$(i) = sel$ then a$(i)=""
    next i
    #win.lst "reload"
    wait

Useful Procedures

' Place a useful function or sub using this keyword here