home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / windows / x / intrinsi / 725 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  2.0 KB

  1. Xref: sparky comp.windows.x.intrinsics:725 comp.windows.x.motif:8396
  2. Newsgroups: comp.windows.x.intrinsics,comp.windows.x.motif
  3. Path: sparky!uunet!mcsun!sunic!sics.se!eua.ericsson.se!erix.ericsson.se!per
  4. From: per@erix.ericsson.se (Per Hedeland)
  5. Subject: Re: Attach data to widget *other* than via XmNuserData?
  6. Message-ID: <1993Jan7.143323.7523@eua.ericsson.se>
  7. Sender: news@eua.ericsson.se
  8. Nntp-Posting-Host: aalborg.eua.ericsson.se
  9. Nntp-Posting-User: per
  10. Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
  11. References:  <BUZZ.93Jan6164723@lion.bear.com>
  12. Date: Thu, 7 Jan 1993 14:33:23 GMT
  13. Lines: 38
  14.  
  15. In article <BUZZ.93Jan6164723@lion.bear.com>, buzz@bear.com (Buzz Moschetti) writes:
  16. |> Arbitrary data of size <= sizeof(XtPointer) can by attached to a widget
  17. |> through the XmNuserData resource.  Fine.
  18. |> 
  19. |> Is there any other facility to attached data to a widget?  For example,
  20. |> in XView, there is the XV_KEY_DATA resource as well as PANEL_CLIENT_DATA.
  21. |> PANEL_CLIENT_DATA works just like XmNuserData:
  22. |> 
  23. |>     My_Data thing;
  24. |>     xv_set(xview_obj, PANEL_CLIENT_DATA, &thing, NULL);
  25. |> 
  26. |> but XV_KEY_DATA permits you attach an unlimited (sort of) number of
  27. |> datums, each addressed through a keyval:
  28. |> 
  29. |>     xv_set(xview_obj, XV_KEY_DATA, keyval, &thing, NULL);
  30. |> 
  31. |> keyval is of type unsigned long and can be hardcoded or generated 
  32. |> at runtime through xv_unique_key():
  33. |> 
  34. |>     keyval = xv_unique_key();
  35. |> 
  36. |>     xv_set(xview_obj, XV_KEY_DATA, keyval, &thing, NULL);
  37. |>     thing *p = (thing *) xv_get(xview_obj, XV_KEY_DATA, keyval);
  38. |> 
  39. |> Any clues?
  40.  
  41. You might want to look into the Context Manager (Xlib functions
  42. XSaveContext(), XFindContext(), XDeleteContext(), XUniqueContext()),
  43. which provides functionality that appears to be very similar to the
  44. above. The Xlib manual claims you need an X resource ID, but e.g. a
  45. Widget ID apparently works too, provided you stick with one or the
  46. other.
  47.  
  48. --Per Hedeland
  49. per@erix.ericsson.se  or
  50. per%erix.ericsson.se@sunic.sunet.se  or
  51. ...uunet!erix.ericsson.se!per
  52.  
  53.