[comp.sys.mac.programmer] GetResource in a WDEF - does it work?

cyosta@taux01.UUCP ( Yossie Silverman) (11/01/89)

I am writing a WDEF which needs to do some GetResource calles.  It seems
that these are all returning NIL but not setting ResError to anything
usefull.  I was doing a GetMenu in the WDEF and it wouldn't, so I moved	
it out and did a GetMHandle instead.  This worked fine, but not the MDEF,
it is trying to do a GetResource and failing!  I would rather do the GetMenu
in the WDEF as well!  Is there something about the Window Manager that
I am not taking notice of?  I stopped in the WDEF with TMON and looked at
ResLoad.  It was set to TRUE (normal).  I tried getting TMON to do the
load and it worked.  Even with the resource loaded, GetResource was still
returning NIL!  What am I doing wrong?   Thanks in advance - Yossie
P.s. does someone have a concise list of what and what can't be done in
a WDEF, in a MDEF (how about a CDEF? :-)
-- 
Yossie Silverman                                   What did the Caspian sea?
National Semiconductor Ltd. (Israel)
cyosta%taux01@nsc.nsc.COM         or        RPR1YOS@TECHNION.BITNET
NSA LSD FBI KGB PCP CIA MOSAD NUCLEAR MI5 SPY ASSASSINATE SDI -- OOLCAY ITAY

mnkonar@smallberries.SRC.Honeywell.COM (Murat N. Konar) (11/02/89)

In article <2793@taux01.UUCP> cyosta@taux01.nsc.com ( Yossie Silverman ) writes:
>I am writing a WDEF which needs to do some GetResource calles.  It seems
>that these are all returning NIL but not setting ResError to anything
>usefull.  I was doing a GetMenu in the WDEF and it wouldn't, so I moved	

GetResource will not set ResError if it can't find the resource you want.  It
returns nil.  I beleive this is documented in IM V1.  

Another thing to look out for is that your resource file may not be in the 
resource search path when your WDEF is called (i.e. under Multifinder).  The
solution here is to get handles to all the resources you want to access during
the WDEF's initialization routine and store them for later use.

I would think hard about trying to pop up a menu inside a WDEF (It seems
like this is what you want to do).  I tried this and while it worked, it
was kind of a kludge.  There are probably better ways to do what you want.


____________________________________________________________________
Have a day. :^|
Murat N. Konar        Honeywell Systems & Research Center, Camden, MN
mnkonar@SRC.honeywell.com (internet) {umn-cs,ems,bthpyd}!srcsip!mnkonar(UUCP)