From 6846595287070750203
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,800e73b29c3c5cd1,start
X-Google-Attributes: gid109fba,public
X-Google-Thread: 10b6ac,800e73b29c3c5cd1,start
X-Google-Attributes: gid10b6ac,public
X-Google-Thread: f78e5,800e73b29c3c5cd1,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1994-12-08 09:06:06 PST
Newsgroups: comp.windows.x.motif,comp.lang.c++,comp.std.c++
Path: bga.com!news.sprintlink.net!pipex!sunsite.doc.ic.ac.uk!uknet!festival!hwcee!jeff
From: jeff@cee.hw.ac.uk (Jeffrey Morgan)
Subject: accessing private members in motif callback   
Message-ID: <D0HwBH.7Io@cee.hw.ac.uk>
Keywords: c++ private members motif
Sender: news@cee.hw.ac.uk (News Administrator)
Organization: Dept of Computing & Electrical Engineering, Heriot-Watt University, Scotland
Date: Thu, 8 Dec 1994 14:02:04 GMT
Lines: 50
Xref: bga.com comp.windows.x.motif:11742 comp.lang.c++:40149 comp.std.c++:5625


Dear All,

Does anyone know how to use a private member function (C++) as a callback
for a Motif (C) Widget?

I have the class ArticleViewer with a scrolled list widget. At the momment
I have the following :-

    XtAddCallback(
        the_articles_scrolled_list,
        XmNdefaultActionCallback,
        (XtCallbackProc) articles_scrolled_list_callback,
        (XtPointer) this);

with the corresponding function definition :-

    static
    void
    articles_scrolled_list_callback(Widget scrolled_list,
                                    XtPointer client_data,
                                    XmListCallbackStruct *cbs)


The (XtPointer) this in the callback allows me to access the object of which
the scrolled list is part. However, I cannot get access to the private
data/members in that object (if you know how - let me know) so I have to
have access members returning the values of the private data members e.g.

    Article     get_article();

just so I can access the internals of the object in a callback that is
conceptually part of the object.

What I would prefer to do would be to use a private memeber function as the
callback function e.g.

    void
    ArticleViewer::articles_scrolled_list_callback(Widget scrolled_list,
                                                   XtPointer client_data,
                                                   XmListCallbackStruct *cbs)

to give me access to the private members. Any ideas?

Please answer in the group or preferably via email:-

                jeff@cee.hw.ac.uk

Thanks.



