home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / windows / x / motif / 5694 < prev    next >
Encoding:
Text File  |  1992-08-19  |  2.3 KB  |  69 lines

  1. Newsgroups: comp.windows.x.motif
  2. Path: sparky!uunet!stanford.edu!agate!overload.lbl.gov!prem.lbl.gov!prem
  3. From: prem@prem.lbl.gov (Shirdi R. Prem)
  4. Subject: Re: Passing more than one widget to a callback
  5. Message-ID: <1992Aug19.172832.13679@overload.lbl.gov>
  6. Keywords: n
  7. Sender: usenet@overload.lbl.gov
  8. Nntp-Posting-Host: prem.lbl.gov
  9. Reply-To: prem@prem.lbl.gov (Shirdi R. Prem)
  10. Organization: Lawrence Berkeley Laboratory
  11. References: <19843@leadsv.UUCP> <1992Aug19.161141.24141@sj.nec.com>
  12. Date: Wed, 19 Aug 1992 17:28:32 GMT
  13. Lines: 54
  14.  
  15. In article <1992Aug19.161141.24141@sj.nec.com> achan@idaho.tdd.sj.nec.com (Amy Chan  x2941) writes:
  16. >In article <19843@leadsv.UUCP> mcfar@leadse5.UUCP (Lincoln McFarland) writes:
  17. >>I was wondering if it is possible to pass more than one widget to a call
  18. >>back using a user defined data structure like:
  19. >>
  20. >>/* structure to pass mulitple widgets to call back */
  21. >>typedef struct {
  22. >>  Widget flnm;   /* filename */
  23. >>  Widget sr;     /* sample rate */
  24. >>} data_bus;
  25. >>
  26. >>/* create input selector function */
  27. >>Widget create_sass_selector( filename_display, sr_display )
  28. >>Widget filename_display; /* widget to display selected filename */
  29. >>Widget sr_display;       /* widget to display sample rate */
  30. >>{
  31. >>  extern Widget toplevel; /* defined in ir.h */
  32. >>
  33. >>  Widget select_dialog;
  34. >>
  35. >>  data_bus input_display;
  36. >>
  37. >>  Arg al[10];
  38. >>  int ac;
  39. >>
  40. >>  input_display.flnm = filename_display;
  41. >>  input_display.sr   = sr_display;
  42. >>
  43. >>  /* create the file selection box dialog widget */
  44. >>  ac = 0;
  45. >>
  46. >>  select_dialog = XmCreateFileSelectionDialog( toplevel,
  47. >>                                              "select_input", al, ac);
  48. >>
  49. >>  XtAddCallback( select_dialog, XmNokCallback, sass_ok_CB, data_bus);
  50. >>  XtAddCallback( select_dialog, XmNcancelCallback, sass_cancel_CB, 0);
  51. >>
  52. >>  return select_dialog;
  53. >>
  54. >>} /* end create_sass_selector() */
  55. >
  56. >
  57. >You have to pass a pointer to your data structure data_bus instead of
  58. >the structure itself. Try doing:
  59. >
  60. >XtAddCallback(select_dialog, XmNokCallback, sass_ok_CB, (XtPointer)&data_bus);
  61.  
  62.     Shouldn't you be passing &input_display instead of &databus ??
  63.     I thought databus was the name you gave to your struct-type, and
  64.     input_display was an instance of that type........... or did I
  65.     miss something here...
  66.  
  67.     Prem!
  68.  
  69.