Newsgroups: comp.windows.interviews
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!snorkelwacker.mit.edu!stanford.edu!newcastle.ac.uk!J.K.Wight
From: J.K.Wight@newcastle.ac.uk (Jim Wight)
Subject: Re: Interactor: :GetAttribute() and .Xdefaults
Message-ID: <AA25967.9106111657.rigg@uk.ac.newcastle>
Sender: news@shelby.stanford.edu (USENET News System)
Reply-To: J.K.Wight@newcastle.ac.uk
Organization: Internet-USENET Gateway at Stanford University
Date: Tue, 11 Jun 1991 16:57:23 GMT
Lines: 43

jeff@meaddata.com (Jeff French) writes
> Hi folks.  I am using IV2.6 and have what I hope is an easy question
> about specifying resources in .Xdefaults and accessing them by
> GetAttribute().

  [code deleted]

> What I can't figure out is how to specify 'helpFile' in my .Xdefaults.
> The only thing that has worked so far is:
>
> *helpFile:	file1.hlp

The manual page for Interactor states that unless GetAttribute is
called from Reconfig the context is only the top-level class and
instance. Thus

	prog -xrm "resource.helpFile:file1.hlp"
and
        prog -xrm "prog.helpFile:file1.hlp"

both work. It also explains why only *helpFile:file1.hlp of your
examples worked.

If you redefine Reconfig for your base class and call GetAttribute
from within that routine then you will be able to specify helpFile
differently for different classes.

I rewrote your "base" class thus

   class base : public Message {
     public:
       base(char *m) : Message(m)  {SetClassName("base");}
       void Reconfig()             {Message::Reconfig();
                                    printf("%s\n", GetAttribute("helpFile"));}
   };

and the correct value was printed out from this command

    prog -xrm "*derived.helpFile:file1.hlp"

The resources for other derived classes would be specified similarly. 

Jim
