Liberty BASIC Help Online

RESIZEHANDLER
RESIZEHANDLER [branch]
or
RESIZEHANDLER subName
 
Description:
This command sets up an event handler for the instance when the user resizes a window of type "window".  This command is not useful for dialog windows, graphics windows, text windows, or for windows without a sizing frame. The resize event can be handled in a named branch, or in a subroutine. If a sub is used as the event handler, the handle of the window being resized is passed into the sub.
 
  'set up a handler for when the user resizes a window
  print #handle, "resizehandler [branch]"
 
or...
 
  'clear the resizing handler
  print #handle, "resizehandler"
 
 
The [branch] that is activated for the resize event should contain the code to LOCATE the desired controls.  After all controls have been given a LOCATE command, the window must be given a REFRESH command to cause it to be repainted.
 
New dimensions:
After the resizehandler has been activated, the new dimensions of the window workspace are contained in the variables WindowWidth and WindowHeight.  Use these dimensions to calculate the desired size and placement for the controls in the window. See also:   LOCATE , REFRESH Window and Dialog Commands
 
Usage:
See the example program RESIZE.BAS and the demo below:
 
'resizehandler using a sub
    button #main.close, "Close", quit, UL, 10, 10
    open "example" for window as #main
    #main "resizehandler resized"
    #main "trapclose quit"
    wait
 
sub resized handle$
    notice str$(WindowWidth)+","+str$(WindowHeight)
end sub
 
sub quit handle$
    if instr(handle$, ".") then
        handle$ =  left$(handle$, instr(handle$, ".")-1)
    end if
    close #handle$
    end
end sub
 


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