frost@watop.nosc.mil (Richard Frost) (02/15/91)
Hi! I'd appreciate some help or pointers to useful references for the following: After calling SFOpen, I can retreive the chosen file name o.k.--but how can I get the full path name? Some parts of Inside Macintosh read better than others. I had trouble with the discussion of resources. By examining other resources and programs, I have been able to implement menues, but continue to have trouble elsewhere. How can I set the suggested application size? I have defined bitmapped icons for the application (in ICON), but how do I get the system to display/recognize them? - Thanks in advance! -- Richard Frost Naval Ocean Systems Center frost@watop.nosc.mil voice: 619-553-6960
dweisman@umiami.ir.miami.edu (Ordinary Man) (02/15/91)
In article <frost.666550441@watop>, frost@watop.nosc.mil (Richard Frost) writes: > > Hi! I'd appreciate some help or pointers to useful references for the > following: > > I have defined bitmapped icons for the application (in ICON), but how do I > get the system to display/recognize them? > If your wish is to display icons in a window (similar to the old MacPaint icon pallette), it's really a pretty simple process: As you've mentioned, you create the 'ICON' resources with ResEdit and remember (write down) the ID's of them. Then just load it (them), make a rect to put it in a window, and plot it (them). Don't forget to set the port of the window to draw in, though. For Example: var theIcon:Handle; theRect:=Rect; begin ... theIcon:=GetIcon(theID); SetRect(theRect,0,0,32,32); {or anything 32X32 pixels (if you want it} {the same size) } PlotIcon(theRect,theIcon); ... Couldn't be simpler. On the other hand, if you meant that you wanted to design an icon for your application (for the finder), then you should be using 'ICN#' resources. If this is what you asked, then the above will be for the benefit of other programmers, I guess! :-) > - Thanks in advance! > > -- > Richard Frost Naval Ocean Systems Center > frost@watop.nosc.mil voice: 619-553-6960 You're welcome, ==Dan -- /-------------------------------------------------------------------------\ | Dan Weisman - University of Miami - Florida | || || || || | |--------------------------------------------------| || || ||\ /|| | | INTERNET -----> dweisman@umiami.IR.Miami.edu | || || || | || | | BITNET -----> dweisman@umiami | ||||||| || | || | |-------------------------------------------------------------------------| | "The more I get to see, the less I understand..." - Triumph | \_________________________________________________________________________/
dce@smsc.sony.com (David Elliott) (02/20/91)
In article <1991Feb14.165107.7828@umiami.ir.miami.edu>, dweisman@umiami.ir.miami.edu (Ordinary Man) writes: |> As you've mentioned, you create the 'ICON' resources with ResEdit and |> remember (write down) the ID's of them. Then just load it (them), make |> a rect to put it in a window, and plot it (them). Don't forget to set the |> port of the window to draw in, though. Why is it that people tend to use ID numbers instead of using names to identify resources? In working on a TCL application, I noticed that there were no builtin ways to, for example, tell CWindow to use a named resource. Instead, I had to convert the name to the resource ID myself, and hand that to the creation routine. -- ...David Elliott ...dce@smsc.sony.com | ...!{uunet,mips}!sonyusa!dce ...(408)944-4073 ..."His lower lip waved poutily with defiance..."
olson@bootsie.uucp (Eric K. Olson) (02/20/91)
In article <1991Feb19.185229.183@smsc.sony.com> dce@smsc.sony.com (David Elliott) writes: >Why is it that people tend to use ID numbers instead of using names >to identify resources? Resource IDs occupy only two bytes. Meaningful resource names are almost always longer. Resource IDs probably resolve faster, too, since fewer compares are needed. Also, if the names are in English, where do you store them? (not hard-coded into your app, according to the HI Guidelines) [admittedly, these names, which only a nosy user would see, don't have to be localizable, but...]. 4Plus (editor extensions for THINK C) will create a "rsrc.h" file consisting of #defines for each resource that has a non-null name in your projectname.rsrc file. This way, you can use the #define names, but you're really using the resource ID. When you build your application, you can remove the names from the resources in projectname.rsrc (to save space and add security), and your code still runs (and contains no hard-coded resource names). >In working on a TCL application, I noticed that there were no builtin >ways to, for example, tell CWindow to use a named resource. Instead, >I had to convert the name to the resource ID myself, and hand that >to the creation routine. This is probably a good way to go about it. Note that you don't have to actually load the resource to get it's ID: SetResLoad(FALSE); aHandle = GetNamedResource('Blah', "\pHello"); SetResLoad(TRUE); GetResInfo(aHandle, &idPtr, &typePtr, nameString); The ID and Name are in the resource Map in memory. -- Eric K. Olson, Editor, Prepare() NOTE: olson@bootsie.uucp doesn't work Lexington Software Design Internet: olson@endor.harvard.edu 72A Lowell St., Lexington, MA 02173 Uucp: harvard!endor!olson (617) 863-9624 Bitnet: OLSON@HARVARD
mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher) (02/20/91)
In article <1991Feb19.185229.183@smsc.sony.com>, dce@smsc.sony.com (David Elliott) writes: > >In article <1991Feb14.165107.7828@umiami.ir.miami.edu>, dweisman@umiami.ir.miami.edu (Ordinary Man) writes: >|> As you've mentioned, you create the 'ICON' resources with ResEdit and >|> remember (write down) the ID's of them. Then just load it (them), make >|> a rect to put it in a window, and plot it (them). Don't forget to set the >|> port of the window to draw in, though. > >Why is it that people tend to use ID numbers instead of using names >to identify resources? Names are slower to process and not guaranteed to be unique. Numbers work fine for me. Matthias -- Matthias Neeracher mneerach@iiic.ethz.ch "These days, though, you have to be pretty technical before you can even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_