home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x.motif
- Path: sparky!uunet!stanford.edu!agate!overload.lbl.gov!prem.lbl.gov!prem
- From: prem@prem.lbl.gov (Shirdi R. Prem)
- Subject: Re: Passing more than one widget to a callback
- Message-ID: <1992Aug19.172832.13679@overload.lbl.gov>
- Keywords: n
- Sender: usenet@overload.lbl.gov
- Nntp-Posting-Host: prem.lbl.gov
- Reply-To: prem@prem.lbl.gov (Shirdi R. Prem)
- Organization: Lawrence Berkeley Laboratory
- References: <19843@leadsv.UUCP> <1992Aug19.161141.24141@sj.nec.com>
- Date: Wed, 19 Aug 1992 17:28:32 GMT
- Lines: 54
-
- In article <1992Aug19.161141.24141@sj.nec.com> achan@idaho.tdd.sj.nec.com (Amy Chan x2941) writes:
- >In article <19843@leadsv.UUCP> mcfar@leadse5.UUCP (Lincoln McFarland) writes:
- >>I was wondering if it is possible to pass more than one widget to a call
- >>back using a user defined data structure like:
- >>
- >>/* structure to pass mulitple widgets to call back */
- >>typedef struct {
- >> Widget flnm; /* filename */
- >> Widget sr; /* sample rate */
- >>} data_bus;
- >>
- >>/* create input selector function */
- >>Widget create_sass_selector( filename_display, sr_display )
- >>Widget filename_display; /* widget to display selected filename */
- >>Widget sr_display; /* widget to display sample rate */
- >>{
- >> extern Widget toplevel; /* defined in ir.h */
- >>
- >> Widget select_dialog;
- >>
- >> data_bus input_display;
- >>
- >> Arg al[10];
- >> int ac;
- >>
- >> input_display.flnm = filename_display;
- >> input_display.sr = sr_display;
- >>
- >> /* create the file selection box dialog widget */
- >> ac = 0;
- >>
- >> select_dialog = XmCreateFileSelectionDialog( toplevel,
- >> "select_input", al, ac);
- >>
- >> XtAddCallback( select_dialog, XmNokCallback, sass_ok_CB, data_bus);
- >> XtAddCallback( select_dialog, XmNcancelCallback, sass_cancel_CB, 0);
- >>
- >> return select_dialog;
- >>
- >>} /* end create_sass_selector() */
- >
- >
- >You have to pass a pointer to your data structure data_bus instead of
- >the structure itself. Try doing:
- >
- >XtAddCallback(select_dialog, XmNokCallback, sass_ok_CB, (XtPointer)&data_bus);
-
- Shouldn't you be passing &input_display instead of &databus ??
- I thought databus was the name you gave to your struct-type, and
- input_display was an instance of that type........... or did I
- miss something here...
-
- Prem!
-
-