Xref: utzoo alt.toolkits.xview:230 comp.windows.open-look:1826 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!trantor.harris-atd.com!pluto!chuck From: chuck@pluto.Harris-ATD.com (Chuck Musciano) Newsgroups: alt.toolkits.xview,comp.windows.open-look Subject: Re: problem attaching XV_KEY_DATA to panel Message-ID: <6632@trantor.harris-atd.com> Date: 29 Jun 91 12:00:48 GMT References: <1991Jun27.221718.18172@leland.Stanford.EDU> Sender: news@trantor.harris-atd.com Reply-To: chuck@trantor.harris-atd.com Distribution: world Organization: Advanced Technology Dept, Harris Corp, Melbourne, FL Lines: 40 In article <1991Jun27.221718.18172@leland.Stanford.EDU>, erose@hydro.Stanford.EDU (Eric Rose) writes: > I seem to have found a problem storing a pointer with a Panel using > XV_KEY_DATA. The manual does not explicitly state that this is possible > for all xview objects, but then again is does not give any reason why > this is not possible. > > I am running xview 2.0 (I think) under openwin 2.0 on a Sparc 2, SunOS 4.1.1 > > The code prints the string correctly while in main, but in the button callback > prints garbage for the string. > > panel = (Panel)xv_create(frame, PANEL, > XV_KEY_DATA, 1, string, > NULL); It is not a good idea to use arbitrary key values with XV_KEY_DATA. I think the toolkit uses a few keys for its own use, and you may be hitting those keys. A better way to do this: Attr_attribute THE_STRING; THE_STRING = xv_unique_key(); panel = (Panel)xv_create(frame, PANEL, XV_KEY_DATA, THE_STRING, string, NULL); and then later printf("The string is %s\n", xv_get(panel, XV_KEY_DATA, THE_STRING)); -- Chuck Musciano ARPA : chuck@trantor.harris-atd.com Harris Corporation Usenet: ...!uunet!x102a!trantor!chuck PO Box 37, MS 3A/1912 AT&T : (407) 727-6131 Melbourne, FL 32902 FAX : (407) 729-3363 A good newspaper is never good enough, but a lousy newspaper is a joy forever. -- Garrison Keillor