Path: utzoo!attcan!uunet!clyde.concordia.ca!news-server.csri.toronto.edu!mailrus!accuvax.nwu.edu!gumball!engber From: engber@gumball.ils.nwu.edu (Mike Engber) Newsgroups: comp.sys.mac.programmer Subject: PopUp CDEFs Summary: are there any standards? Message-ID: <5355@accuvax.nwu.edu> Date: 19 Mar 90 19:59:11 GMT Sender: news@accuvax.nwu.edu Reply-To: engber@gumball (Mike Engber) Organization: ^ Lines: 44 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