Article View: comp.sys.mac.oop.macapp3
Article #218MenuWidth Bug?
From: Victor Consulting, Ken Victor,PA...
Date: Tue, 05 Jan 1993 02:09
Date: Tue, 05 Jan 1993 02:09
43 lines
2665 bytes
2665 bytes
does anyuone know if there is a bug in the toolbox CalcMenuSize when dealing with styled hierarchical menus? my situation is as follows: i have several hierarchical menus declared (with no items) as CMNU resources in my .r file. the menuId of these menus is greater than mLastMenu. the main menus for these hierarchical menus are also delcared as CMNU resources in my .r file, with menuIDs less than mLastMenu. all resource IDs are equal to menuIDs. the main menus are listed in the kMBarDisplayed resource and the hieracrhical menus are listed in the kMBarHierarchical resource. dynamically i create additional items for my hierarchical menus, including other hierarchical menus (being sure to only use a menuID < 235 and one that isn't already in use). in my dosetupmenus, i enable my items as appropriate, and enable the declared hierarchical menu as well. everything was working fine, and just the way i expected it to until i decided i wanted some of the added items to be bold or outlined. i changed my dosetupmenus to issue either a SetItemStyle or (MacApp's) SetStyle, depending on whether the menuid was greater or less than or equal to mLastMenu. i even tried calling CalcMenuSize or NeedCalcMenuSize. my hierarchical menus are being drawn too narrow for the styled items, and thus the styled items have the infamous 3 dots on the end. its as if CalcMenuSize is calculating a width while ignoring the item's style. i tried patching the menuwidth in the menuinfo record after my call to CalcMenuSize (in dosetupmenus) to no avail. i've traced this as far as inside toolbox MenuSelect. MenuSelect seems to set the menuwidth to -1 the first time it needs the hierarchical menu, and then it calls CalcMenuSize before displaying the hierarchical menu. if i set an atrap at CalcMenuSize after entering MenuSelect, and then patch menuwidth AFTER CalcMenuSize does its thing, my menus display with the width i've patched in... HELP??? :-( Ken Victor (415) 964-9870 p.s. i'm running sys 7.1, macapp 3.0.1. i think i saw something similar in a previous macapp 2.01 app i developed running on sys 7.0 and 7.01 with and without tuner, but i didn't follow that one as much as this one.
Technical Details
Message-ID:
<726200013.3667500@AppleLink.Apple.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!olivea!apple!applelink.apple.comShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!olivea!apple!applelink.apple.com From: KVICTOR@AppleLink.Apple.COM (Victor Consulting, Ken Victor,PAS) Newsgroups: comp.sys.mac.oop.macapp3 Subject: MenuWidth Bug? Message-ID: <726200013.3667500@AppleLink.Apple.COM> Date: 5 Jan 93 02:09:00 GMT Sender: daemon@Apple.COM Organization: AppleLink Gateway Lines: 43