rmitchel@bbn.com (Rob Mitchell) (02/26/91)
Hi, [1] How does the "mini" icon get inserted into the popup menu in the standard file dialog window? You know, the one that looks like folder/files/appls/etc. I'd like to insert an icon in my popup menu. Where do I get the "mini" icon? From some "ICN#" rsrc? Do I append it to menu item just before drawing (kinda like check marks)? [2] I need to create a one-column, many-row list (using List Mgr) but would like to have vertical lines to "act" as column seperators. I know it sounds a little strange, but ... Basically, each row displays a few fields of a data structure and the user can double-click on a row (the whole row needs to highlight) to bring up dialog box to change entry's values. Rob Mitchell Advanced Simulation Division Unix & Macintosh Engineer BBN Systems & Technologies Internet: rmitchel@vax.bbn.com 33 Moulton Street MS: 8/C Primary Dwelling: 617-873-4041 Cambridge, MA 02138 Secondary Dwelling: 617-873-4071 FAX: 617-873-4315 These opinions are mine and mine only. They do not represent BBNs' opinions.
hawley@adobe.COM (Steve Hawley) (02/28/91)
In article <62972@bbn.BBN.COM> rmitchel@bbn.com (Rob Mitchell) writes: | [1] How does the "mini" icon get inserted into the popup menu | in the standard file dialog window? You know, the one | that looks like folder/files/appls/etc. I'd like to | insert an icon in my popup menu. Where do I get the | "mini" icon? From some "ICN#" rsrc? Do I append it to | menu item just before drawing (kinda like check marks)? Can't answer this exactly, but you get the small icon from the SICN resources in the system file (or your own file or wherever). To get them in a pop-up menu is something I've never tried. I image you'd have to write your own MDEF to handle that... | [2] I need to create a one-column, many-row list (using | List Mgr) but would like to have vertical lines to | "act" as column seperators. I know it sounds a little | strange, but ... Basically, each row displays a few | fields of a data structure and the user can double-click | on a row (the whole row needs to highlight) to bring | up dialog box to change entry's values. This isn't too hard. What you have to do is write an LDEF (a list definition function) for use in your application. Inside Macintosh Volume IV is pretty clear about how this is done. I wrote one in a day that interpretted embedded text formatting codes to dynamically change text styles within the text of a cell. You may wish to reconsider popping up a dialog box *every* time a user double clicks on a cell. If the dialog box presents no more information than is present in the list itself, all the time spent waiting for the dialog box to pop up and redraw and for the window to refresh when the dialog goes away will add up. Consider instead adding some Text Edit fields that get filled in when the user double clicks on a cell and will be used to replace the currently selected cell upon pressing a button (or a key equivalent). Another approach would be to pop up the Text Edit fields OVER the each field of the selected Cell itself (disable the list first), then make it go away upon confirm or cancel commands (again via buttons and key equivalents). Steve Hawley hawley@adobe.com -- "Did you know that a cow was *MURDERED* to make that jacket?" "Yes. I didn't think there were any witnesses, so I guess I'll have to kill you too." -Jake Johansen
francis@uchicago.edu (Francis Stracke) (02/28/91)
In article <11707@adobe.UUCP> hawley@adobe.COM (Steve Hawley) writes: In article <62972@bbn.BBN.COM> rmitchel@bbn.com (Rob Mitchell) writes: | [1] How does the "mini" icon get inserted into the popup menu | in the standard file dialog window? You know, the one | that looks like folder/files/appls/etc. I'd like to | insert an icon in my popup menu. Where do I get the | "mini" icon? From some "ICN#" rsrc? Do I append it to | menu item just before drawing (kinda like check marks)? Can't answer this exactly, but you get the small icon from the SICN resources in the system file (or your own file or wherever). To get them in a pop-up menu is something I've never tried. I image you'd have to write your own MDEF to handle that... You can now use the standard MDEF to place a SICN in your menu; don't remember just how you work the resource information, but ResEdit 2.1 will do it for you. I assume it would work on a popup. It's the same MDEF doing the drawing, isn't it? -- /=============================================================================\ | Francis Stracke | My opinions are my own. I don't steal them.| | Department of Mathematics |=============================================| | University of Chicago | Until you stalk and overrun, | | francis@zaphod.uchicago.edu | you can't devour anyone. -- Hobbes | \=============================================================================/
jwinterm@jarthur.Claremont.EDU (Jim Wintermyre) (02/28/91)
In article <FRANCIS.91Feb27230121@daisy.uchicago.edu> francis@uchicago.edu (Francis Stracke) writes: >In article <11707@adobe.UUCP> hawley@adobe.COM (Steve Hawley) writes: > > In article <62972@bbn.BBN.COM> rmitchel@bbn.com (Rob Mitchell) writes: > | [1] How does the "mini" icon get inserted into the popup menu > | in the standard file dialog window? You know, the one > | that looks like folder/files/appls/etc. I'd like to > | insert an icon in my popup menu. Where do I get the > | "mini" icon? From some "ICN#" rsrc? Do I append it to > | menu item just before drawing (kinda like check marks)? > > Can't answer this exactly, but you get the small icon from the SICN > resources in the system file (or your own file or wherever). To get them > in a pop-up menu is something I've never tried. I image you'd have to > write your own MDEF to handle that... > >You can now use the standard MDEF to place a SICN in your menu; don't >remember just how you work the resource information, but ResEdit 2.1 >will do it for you. > >I assume it would work on a popup. It's the same MDEF doing the >drawing, isn't it? Well, as far as I know it is. I replied to the original sender, but I can't remember if I posted it or not. So here goes. Macintosh technical note #253 documents how to include SICNs or reduced size regular ICONs next to menu items, like Multifinder does. This facility came about when Multifinder was being created, so it isn't documented in Inside Mac. The first thing you need to do is place a value of $1D in the cmdChar field of menuItem for a reduced ICON, or a value of $1E for a SICN. You then place the resource ID of the appropriate ICON or SICN, minus 256, in the itemIcon field. Note that this means that the resource ID of your ICON or SICN must be 257 or greater. Also, since the cmdChar field is used up, you can't have keyboard equivalents for these menu items. Oh well. In code: SetItemCmd(theMenu,item,$1D) { reduced icon (reduced ICON) } SetItemIcon(theMenu,item,icon) or SetItemCmd(theMenu,item,$1E) { small icon (SICN) } SetItemIcon(theMenu,item,icon) That's it. It works for a normal menu, so there's no reason why it shouldn't work for a popup. - Jim Wintermyre
rmh@apple.com (Rick Holzgrafe) (03/01/91)
In article <11012@jarthur.Claremont.EDU> jwinterm@jarthur.Claremont.EDU (Jim Wintermyre) writes: > Macintosh technical note #253 documents how to include SICNs or reduced > size regular ICONs next to menu items, like Multifinder does. This > facility came about when Multifinder was being created, so it isn't > documented in Inside Mac. > [...] since the cmdChar field is used up, you can't have > keyboard equivalents for these menu items. Furthermore, it doesn't work on pre-MultiFinder systems - instead you get a mess of ersatz command-chars and icons, I don't remember the precise symptoms but they were UGLY. I wanted to use small icons in my menus when possible, but not freeze out users of older systems. The following code worked for me. Please note that it is *NOT*NOT*NOT* official Apple-approved code, it's just my hack. void CStarterApp::SetUpMenus(void) { extern Boolean gHasWNE; /* Is WaitNextEvent implemented? */ /* * Find out if we can support small icons, * and turn them off if not. */ if (!gHasWNE) { extern void TurnOffSICN (short theMenuCmd); TurnOffSICN (cmdAlignRight); TurnOffSICN (cmdAlignCenter); TurnOffSICN (cmdAlignLeft); /* And so on... */ } } void TurnOffSICN (short theMenuCmd) { MenuHandle mh; short theItem; short theMenuID; Ptr p; short i; gBartender->FindMenuItem (theMenuCmd, &theMenuID, &mh, &theItem); SetItemIcon (mh, theItem, 0); /* * Very bad karma to play with a manager's internal * structures like this: they could change in the * future and leave us stranded. But this code is * called only for pre-multifinder systems, so * we're safe. (I hope!) * * This code turns off the "keyboard equivalent char", * which in this case was really a flag to indicate * the use of small rather than regular icons. */ p = (Ptr)*mh; p += 14; p += (*p + 1); /* Skip the menu info and title */ /* p now points to a menu item */ for (i = 1; i < theItem && *p != 0; i++) { p += (*p + 1); /* Skip the menu item title */ p += 4; /* Skip the other menu item info */ } if (*p != 0) { p += (*p + 1); /* Skip the menu item title */ p++; /* Point to the keyboard equivalent */ *p = 0; /* Erase it! */ } } Hope this helps. ========================================================================== Rick Holzgrafe | {sun,voder,nsc,mtxinu,dual}!apple!rmh Software Engineer | AppleLink HOLZGRAFE1 rmh@apple.com Apple Computer, Inc. | "All opinions expressed are mine, and do 20525 Mariani Ave. MS: 3-PK | not necessarily represent those of my Cupertino, CA 95014 | employer, Apple Computer Inc."
aries@rhi.hi.is (Mimir Reynisson) (03/06/91)
I've two things to add to this discussion as I just recently created a browser similar to SFGetFile. I wanted a pop-up like SFGetFile had but couldn't find out anything from IM about SICNs. After messing about in MacsBug for a short while I found that it uses cmdChar $1A. That way the SICNs are much closer to the left menu border then if I were to use $1E. A small picture to explain what I mean: ------------- -------------- ------------ | O MenuItem1 | | O MenuItem1 | | MenuItem1 | | O MenuItem2 | | O MenuItem2 | | MenuItem2 | | O ...etc... | | O ...etc... | | ...etc... | ------------- -------------- ------------ cmdChar $1A cmdChar $1E Normal menu See what I mean? Anyway, the second point I'd like to make is: if you're are in doubt whether some given system supports SICNs in its menus or not, you could include MDEF0 from a system that does and set its id to something else. And when you finally land right in the middle of such a situation, you simply create your pop-menu with your included MDEF. I think there's a far worse problem with systems that don't support pop-up menus. What can you do then? Draw it yourself I presume. However, I havn't a clue as to what Apple might have to say about that. --MymR Disclaimer: Who me??