I was searching for something on Apple's developer site when I stumbled upon Window Grouping. I read enough to notice a couple of benefits. If one window in a group is moved or collapsed, the other windows in the group will follow/do the same. Anyway, I've just knocked together this quickie example [using my 'quickie-example-knock-together-utility']. Now... what was that "something" I was looking for on the dev site??? Bernie '---------- /* Window Grouping Demo bw 21/04/05 Notes: -- Watch out for missing underscores on the associate server -- OS X only -- I've probably not defined WindowGroupRef correctly -- This demo allows the user to switch windows from one group to another but that may not be recommended practice */ '~'A ' Runtime : Rntm Appearance.Incl ' CPU : Carbon ' CALL Req'd : Off '~'B #define WindowGroupAttributes as UInt32 #define WindowGroupRef as WindowRef toolbox fn CreateWindowGroup(WindowGroupAttributes inAttributes, WindowGroupRef outGroup) = OSStatus toolbox fn SetWindowGroupOwner(WindowGroupRef inGroup,WindowRef inWindow) = OSStatus toolbox fn SetWindowGroupParent(WindowGroupRef inGroup, WindowGroupRef inNewGroup) = OSStatus toolbox fn GetWindowGroupOfClass(WindowClass windowClass) = WindowGroupRef toolbox fn SetWindowGroup(WindowRef inWindow, WindowGroupRef inNewGroup) = OSStatus toolbox fn ChangeWindowGroupAttributes(WindowGroupRef inGroup, WindowGroupAttributes setTheseAttributes, WindowGroupAttributes clearTheseAttributes) = OSStatus toolbox fn ReleaseWindowGroup(WindowGroupRef inGroup) = OSStatus toolbox fn GetWindowGroup(WindowRef inWindow) = WindowGroupRef toolbox fn IsWindowContainedInGroup(WindowRef inWindow, WindowGroupRef inGroup) = Boolean begin enum _kWindowGroupAttrSelectAsLayer = (1 << 0) _kWindowGroupAttrMoveTogether = (1 << 1) _kWindowGroupAttrLayerTogether = (1 << 2) _kWindowGroupAttrSharedActivation = (1 << 3) _kWindowGroupAttrHideOnCollapse = (1 << 4) end enum begin enum 1 _Window1Wnd _Window2Wnd _Window3Wnd end enum _cSwitchGroupsBtn1 = 1 _cSwitchGroupsBtn2 = 1 _cSwitchGroupsBtn3 = 1 begin globals dim as WindowGroupRef gGroup1Ref, gGroup2Ref end globals local fn BuildWindows dim as ControlFontStyleRec cfs dim as Rect r '~'< SetRect(r, 22, 80, 522, 380) appearance window -_Window1Wnd, "Grouping Demo - Window 1", @r, _kDocumentWindowClass,_kWindowCollapseBoxAttribute def SetWindowBackground(_kThemeActiveDialogBackgroundBrush, _zTrue) SetRect(r, 167, 260, 333, 280) appearance button _cSwitchGroupsBtn1, _activeBtn,,,,"Switch to Group 2", @r, _kControlPushButtonProc appearance window _Window1Wnd '~'< cfs.flags = _kControlUseFontMask_kControlUseJustMask SetRect(r, 462, 208, 647, 294) appearance window -_Window2Wnd, "Window 2", @r, _kFloatingWindowClass def SetWindowBackground(_kThemeActiveDialogBackgroundBrush, _zTrue) SetRect(r, 20, 49, 165, 66) appearance button _cSwitchGroupsBtn2, _activeBtn,,,,"Switch to Group 2", @r, _kControlPushButtonProc cfs.font = _kControlFontSmallSystemFont def SetButtonFontStyle(_cSwitchGroupsBtn2, cfs) appearance window _Window2Wnd '~'< SetRect(r, 21, 428, 721, 492) appearance window -_Window3Wnd, "Window 3", @r, _kDocumentWindowClass, _kWindowCollapseBoxAttribute def SetWindowBackground(_kThemeActiveDialogBackgroundBrush, _zTrue) SetRect(r, 514, 24, 680, 44) appearance button _cSwitchGroupsBtn3, _activeBtn,,,,"Switch to Group 1", @r, _kControlPushButtonProc appearance window _Window3Wnd end fn local fn SwitchGroups(btnNum as long) dim as WindowRef @ wRef dim as long w dim as OSStatus ignore dim as Boolean bool '~'< w = window(_outputWnd) get window w, wRef long if fn IsWindowContainedInGroup(wRef, gGroup1Ref) button btnNum,,"Switch to Group 1" ignore = fn SetWindowGroup(wRef, gGroup2Ref) xelse button btnNum,,"Switch to Group 2" ignore = fn SetWindowGroup(wRef, gGroup1Ref) end if window w end fn local fn Init dim as WindowRef @ wRef dim as OSStatus ignore '~'< fn BuildWindows ignore = fn CreateWindowGroup(_kWindowGroupAttrLayerTogether_kWindowGroupAttrMoveTog ether_kWindowGroupAttrSharedActivation_kWindowGroupAttrHideOnCollapse, @gGroup1Ref) ignore = fn CreateWindowGroup(_kWindowGroupAttrLayerTogether_kWindowGroupAttrMoveTog ether_kWindowGroupAttrSharedActivation_kWindowGroupAttrHideOnCollapse, @gGroup2Ref) get window _Window3Wnd, wRef ignore = fn SetWindowGroup(wRef, gGroup2Ref) get window _Window2Wnd, wRef ignore = fn SetWindowGroup(wRef, gGroup1Ref) get window _Window1Wnd, wRef ignore = fn SetWindowGroup(wRef, gGroup1Ref) end fn local fn DoDialog dim as Rect r dim as long ev, id '~'< ev = dialog(0) id = dialog(ev) select ev case _wndClick : window id case _btnClick : fn SwitchGroups(id) end select end fn fn Init on dialog fn DoDialog do HandleEvents until gFBQuit '----------