Can somebody tell or show me how to get this thingie below to work as
to live resizing...with control relocation? The basic window making
function is below, I stripped it all to the minimums.
I need to be able to live grow the window (user pulling grow box) and
move the cancel and print buttons (and a couple others not seen) to
the margins while they do, while maintaining the same aspect ratio as
the initial build proportions, as well as making sure it cannot go
below the minimum size, same as built. I'd need at the same time, to
update a display rect (not shown, in the middle), which I copy a
preview to...live, so would need an entry and exit point.
Example below...Any help appreciated. I've always hacked into Fn
FBWindowGrow in the runtime for stuff like this, but can only get one
aspect ratio to stay constant...which is fine for a palette, but not
for a print preview...
I know you can lock things when using a NIB, and they'll auto
relocate at least in IB, and Cocoa, but not sure how in FB.
_preWndGrow is only a one time notice apparently...does not
repeat...I need a new _whileWndGrowing dialog event. ;)
Robert Bob
// Beware bad invisible character errors when copying from email...rc
#define ControlSize as UInt16
//Windows
begin enum 1
_TilePrintWnd
end enum
//_TilePrintWnd Controls
begin enum 1
_tilePrintBtn
_tileCancelBtn
end enum
//Menus
_mFile = 1
_mEdit = 2
begin enum 1
_iNew
_iOpen
_
_iClose
_iSave
_iSaveAs
_iQuit
end enum
local fn BuildTilePrintWnd
'~'1
dim as Str255 s
dim as ControlFontStyleRec cfs, tfs
dim as Rect r
dim as WindowAttributes wa
dim as ControlSize @size
dim as short @setVal
dim as Boolean @bool
cfs.flags = _kControlUseFontMask _kControlUseJustMask
wa = _kWindowResizableAttribute_kWindowLiveResizeAttribute
//SetRect( r, 0, 0, 440, 580 )// Optional FB auto-centre
SetRect( r, 77, 47, 517, 627 )
appearance window -_TilePrintWnd, "Tile Printing", @r,
_kMovableModalWindowClass, wa
def SetWindowBackground( _kThemeActiveDialogBackgroundBrush, _zTrue )
SetRect( r, 286, 540, 416, 560 )
appearance button _tilePrintBtn, _activeBtn,,,, "Print", @r,
_kControlPushButtonProc
bool = _zTrue
def SetButtonData( _tilePrintBtn, _kControlEntireControl,
_kControlPushButtonDefaultTag, sizeof( Boolean ), bool )
SetRect( r, 286, 508, 416, 528 )
appearance button _tileCancelBtn, _activeBtn,,,, "Cancel", @r,
_kControlPushButtonProc
appearance window _TilePrintWnd
end fn
/*
Interface code generated with TWM: <http://homepage.ntlworld.com/
bernie.w/twm.htm>
*/
'~DoDialog
local fn DoDialog
'~'1
dim as Rect r
dim as long ev, id
ev = dialog( 0 )
id = dialog( ev )
select ev
case _wndClick : window id
case _wndClose
case _wndRefresh
case _wndResized
case _wndActivate
case _wndZoomIn
case _wndZoomOut
case _btnClick
select window( _outputWnd )
case _TilePrintWnd
select id
case _tilePrintBtn
case _tileCancelBtn
end select
end select
case _efClick
case _efReturn
case _efTab
case _efShiftTab
case _efClear
case _efLeftArrow
case _efRightArrow
case _efUpArrow
case _efDownArrow
case _efSelected// user click or tab key has changed focus
case _pfClick// picture field click
case _evKey
case _cntxtMenuClick
case _userDialog
case _cursEvent
case _cursOverBtn
case _cursOverEF
case _cursOverPF
case _cursOverNothing
case _mfEvent
select id
case _mfResume
case _mfSuspend
case _mfClipboard
case _mfMouse
end select
case _preview
select id
case _preMenuClick
case _wndMoved
case _wndDocWillMove
case _preWndGrow
case _preWndZoomIn
case _preWndZoomOut
case _efchanged
case _preefclick// don't think this works with appearance ??
end select
end select
end fn
'~DoMenu
local fn DoMenu
'~'1
dim as long menuID, itemID
dim as OSStatus ignore
menuID = menu( _menuID )
itemID = menu( _itemID )
select menuID
case _appleMenu
case _mFile
select itemID
case _iNew
case _iOpen
case _iClose
case _iSave
case _iSaveAs
case _iQuit
end select
case _mEdit
select itemID
end select
end select
menu
end fn
'~Main
fn BuildTilePrintWnd
on dialog fn DoDialog
on menu fn DoMenu
do
HandleEvents
until gFBQuit