Sheet windows: making them resizeable
From REALbasicWiki
This article applies only to Mac
[edit] Making sheet windows resizeable
Currently (RB 2008r2), the Window property Resizeable is ignored — sheet windows are shown at a fixed size and cannot be resized by the user with the mouse.
Until RB fixes this limitation, you can use the following code to make sheet windows resizeable (Code courtesy of Norman Parlardy):
Sub EnsureSheetIsResizable(extends w as Window)
#if TargetMacOS
soft declare function ChangeWindowAttributes lib "Carbon" (window as WindowPtr, setTheseAttributes as Uint32, clearTheseAttributes as Uint32) as Integer
const kWindowResizableAttribute = &h10 // (1L << 4)
const kWindowLiveResizeAttribute = &h10000000 // (1L << 28),
if System.IsFunctionAvailable("ChangeWindowAttributes", "Carbon") then
dim attrs as Uint32
if w.Resizeable then attrs = attrs + kWindowResizableAttribute
if w.LiveResize then attrs = attrs + kWindowLiveResizeAttribute
if attrs <> 0 then
dim result as integer = ChangeWindowAttributes(w, attrs, 0)
end if
end if
#endif
End Sub
Place the code into a module. To use it, call it from within the sheet window's Open handler, e.g. with:
self.EnsureSheetIsResizable
Note: Despite setting the LiveResize attribute, the user will not get a live resizing effect when dragging the resize control at the bottom right corner of the sheet window but only a simple outline rectangle. This appears to be a limitation of RB.
[edit] Yet Another Way
Another way to implement resizeable sheets is described in this article (originally written by Seth Willits) at RBDevZone:
http://www.rbdevzone.com/2008/04/resizable-sheets/
This method does seem to allow live resizing.
