home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / devtools / files / lb202win.exe / LB202W.EXE / RESIZE.BAS < prev    next >
Encoding:
BASIC Source File  |  2000-11-09  |  1.3 KB  |  40 lines

  1.  
  2.     'resize.bas
  3.     'This is an example of a program which resizes several
  4.     'controls in a window depending on how the user changes
  5.     'the size of the window.
  6.  
  7.     nomainwin
  8.     WindowWidth = 550
  9.     WindowHeight = 410
  10.  
  11.     listbox #resizer.lbox1, array$(), [lbox1DClick], 1, 0, 256, 186
  12.     listbox #resizer.lbox2, array$(), [lbox2DClick], 257, 0, 284, 164
  13.     combobox #resizer.cbox3, array$(), [cbox3DoubleClick], 257, 164, 283, 150
  14.     texteditor #resizer.tedit4, 1, 186, 540, 195
  15.     open "Resizing example" for window as #resizer
  16.     print #resizer, "trapclose [quit]"
  17.  
  18. [loop]
  19.     print #resizer, "resizehandler [resized]"
  20.     input r$
  21.     goto [loop]
  22.  
  23. [resized]
  24.     wWid = WindowWidth
  25.     wHig = WindowHeight
  26.     upperVert = int(256/550*wWid) 'upper middle vertical edge
  27.     midHoriz = int(186/410*wHig) 'middle horizontal edge
  28.     urWid = upperVert - wWid
  29.     print #resizer.lbox1, "locate 0 0 "; upperVert; " "; int(186/410*wHig)
  30.     print #resizer.lbox2, "locate "; upperVert; " 0 "; wWid-upperVert; " "; int(186/410*wHig)-23
  31.     print #resizer.cbox3, "locate "; upperVert; " "; midHoriz-23; " "; wWid - upperVert; " "; 100
  32.     print #resizer.tedit4, "!locate 0 "; midHoriz; " "; wWid; " "; wHig-midHoriz;
  33.     print #resizer, "refresh"
  34.    goto [loop]
  35.  
  36. [quit] 'quit the program
  37.  
  38.     close #resizer
  39.     end
  40.