Liberty BASIC Help Online

Resize.bas
 
    'resize.bas
    'This is an example of a program which resizes several
    'controls in a window depending on how the user changes
    'the size of the window.
 
    nomainwin
    WindowWidth = 550
    WindowHeight = 410
 
    listbox #resizer.lbox1, array$(), [lbox1DClick], 1, 0, 256, 186
    listbox #resizer.lbox2, array$(), [lbox2DClick], 257, 0, 284, 164
    combobox #resizer.cbox3, array$(), [cbox3DoubleClick], 257, 164, 283, 150
    texteditor #resizer.tedit4, 1, 186, 540, 195
    open "Resizing example" for window as #resizer
    print #resizer, "trapclose [quit]"
 
[loop]
    print #resizer, "resizehandler [resized]"
    input r$
    goto [loop]
 
[resized]
    'new sizes for width and height are now contained
    'in the variables WindowWidth and WindowHeight
    wWid = WindowWidth
    wHig = WindowHeight
    upperVert = int(256/550*wWid) 'upper middle vertical edge
    midHoriz = int(186/410*wHig) 'middle horizontal edge
    urWid = upperVert - wWid
    print #resizer.lbox1, "locate 0 0 "; upperVert; " "; int(186/410*wHig)
    print #resizer.lbox2, "locate "; upperVert; " 0 "; wWid-upperVert; " "; int(186/410*wHig)-23
    print #resizer.cbox3, "locate "; upperVert; " "; midHoriz-23; " "; wWid - upperVert; " "; 100
    print #resizer.tedit4, "!locate 0 "; midHoriz; " "; wWid; " "; wHig-midHoriz;
    print #resizer, "refresh"
   goto [loop]
 
[quit] 'quit the program
 
    close #resizer
    end


Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/