engber@gumball.ils.nwu.edu (Mike Engber) (03/20/90)
Is there any official way to implement PopUp menu's a controls? Alternatively, is anyone particulary proud of the way they`ve done it and/or willing to share some source or ideas? I looked at the DTS example of a PopUp user item and it seems to me a control would be a lot cleaner. I also looked at Plamondon`s article in MacTutor (Sept '88) and wasn't so happy with his implementation (no clean way to line up a group of PopUp menus as shown in IM V p. 25) Anyway, unless someone sends me source, I'm going to take a hack at my own version and I'm soliciting suggestions on my ideas. 1) After creating the control, the CDEF user would store a handle the the menu (to be popped) in the contrlRfCon. 2) contrlValue will contain the currently selected item. 3) the menu title will be used as the PopUp menu`s title And now the hard part... 4) how to display it. Obviously you want it all to fit in contrlRect, but the you want the title right justified against a left justified Pop-up box. Since everything must fit in contrlRect, you have to divide it up between the title and the Pop-up box. The approach Plamondon took was to give the title as much as it needed and the rest to the pop-up box. However, as he points out, this method doesn`t let you line up several pop-up menus (as shown on IM V p. 25 ) The only idea I`ve come up with is to split the contrlRect in half; right justify the title in the left half and left justify the pop-up box in the right half. This means you`ll need excessively large contrlRects when there is a big difference in the width of the title and the largest menu item, but I think it should be reasonable in most cases. If you have any ideas/suggestion pleas let me know. I don't want to re-invent the wheel if I don't have to. Unless I`m overlooking something implementing this shouldn't be hard and I plan to share my source. Please respond via email if possible. -ME
kazim@Apple.COM (Alex Kazim) (03/20/90)
In article <5355@accuvax.nwu.edu> engber@gumball (Mike Engber) writes: >Is there any official way to implement PopUp menu's a controls? >Alternatively, is anyone particulary proud of the way they`ve done it >and/or willing to share some source or ideas? > This is already done as part of the CommToolbox, and is described in that manual. I think the actual ID is CDEF 63. One of the other things it does is allow popups to be drawn using the window font/size like CDEF 0 does. ===================================================================== Alex Kazim, Apple Computer Just the facts, ma'am =====================================================================
mithomas@bsu-cs.bsu.edu (Michael Thomas Niehaus) (03/20/90)
If I remember correctly, there is a PopupMenu CDEF that is part of the Communications Toolbox, which is available from APDA. This will also be included in System 7.0 -Michael -- Michael Niehaus UUCP: <backbones>!{iuvax,pur-ee}!bsu-cs!mithomas Apple Student Rep ARPA: mithomas@bsu-cs.bsu.edu Ball State University AppleLink: ST0374 (from UUCP: st0374@applelink.apple.com)
6600pete@ucsbuxa.ucsb.edu (GurgleKat [Pete Gontier]) (03/21/90)
From article <39650@apple.Apple.COM>, by kazim@Apple.COM (Alex Kazim): > In article <5355@accuvax.nwu.edu> engber@gumball (Mike Engber) writes: >>Is there any official way to implement PopUp menu's a controls? >>Alternatively, is anyone particulary proud of the way they`ve done it >>and/or willing to share some source or ideas? > This is already done as part of the CommToolbox, and is described in that > manual. I think the actual ID is CDEF 63. One of the other things it does > is allow popups to be drawn using the window font/size like CDEF 0 does. Here's a question for licensing: what's the status on redistribution of that CDEF? I understand the Comm Toolbox as a whole can't be sent out with prodcut willy-nilly, and I don't think anyone will want to bother until System 7. In the meantime, is there a a legal way to redistribute the "official" CDEF with a third-party product? -- Pete Gontier, Kiwi Software; Kiwi's opinions not presented here Editor, Macker, the Online Mac Programming Journal InterNet 6600pete@ucsbuxa.ucsb.edu; BitNet 6600pete@ucsbuxa; AppleLink D0862