home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / windows / x / motif / 5835 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  1.7 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!ucbvax!oceanroutes.ns.ca!deveau
  2. From: deveau@oceanroutes.ns.ca ("Terry J. Deveau")
  3. Newsgroups: comp.windows.x.motif
  4. Subject: Re: can't create another form
  5. Message-ID: <9208261840.AA24778@BU.EDU>
  6. Date: 26 Aug 92 18:40:04 GMT
  7. References: <moharil.714837752@judy.cs.iastate.edu>
  8. Sender: daemon@ucbvax.BERKELEY.EDU
  9. Distribution: inet
  10. Organization: Oceanroutes Canada Inc.
  11. Lines: 38
  12.  
  13. > I have created one form widget to hold some push button widgets and
  14. > label widgets. In the callback functions of the pushbuttons, I want to
  15. > create another form so that it can hold some other widgets. But creating
  16. > another form lands me in problems:
  17. > I cant attach my widgets to this new form. Also attaching one widget to
  18. > another gives me segmentation fault.
  19. > Why can't I create another form and use it the same way as the first 
  20. > form. I am sure that the problem can be solved using other kind of
  21. > container widgets but why not form?
  22. Don't create the new form in the callback, just manage it there; also
  23. your new form must be a child of an XmDialogShell, this is automatic
  24. if you use XmCreateFormDialog.
  25.  
  26. Do the following during initialization:
  27.  
  28. 1) XtAddCallback (pushbutton, XmNactivateCallback, yourCallback, NULL)
  29.  
  30. 2) newform = XmCreateFormDialog (pushbutton, ...)
  31.  
  32. 3) other = XmCreateOtherWidget (newform, ...) /* replace this call
  33.              with whatever your "other widget" is */
  34.  
  35. 4) XtManageChild(other)
  36.  
  37. 5) repeat 3 and 4 as many times as necessary.
  38.  
  39. In "yourCallback" include:
  40.  
  41. 5) XtManageChild(newform)
  42.  
  43. You can probably figure out the rest.  OSF/Motif Programmer's Guide
  44. will help.
  45.  
  46. Your segmentation fault is likely an error in pointer usage (C not Motif).
  47.  
  48. ... Terry
  49.