Xref: utzoo alt.toolkits.xview:227 comp.windows.open-look:1807 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!uunet!stanford.edu!leland.Stanford.EDU!news From: erose@hydro.Stanford.EDU (Eric Rose) Newsgroups: alt.toolkits.xview,comp.windows.open-look Subject: problem attaching XV_KEY_DATA to panel Message-ID: <1991Jun27.221718.18172@leland.Stanford.EDU> Date: 27 Jun 91 22:17:18 GMT Sender: news@leland.Stanford.EDU (Mr News) Organization: Stanford University, California, USA Lines: 55 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. ------------------------------------------------------------------------------- #include #include #include #include Frame frame; Panel panel; char *string = "Hello World"; void button_cb(); main(argc,argv) int argc; char *argv[]; { xv_init(XV_INIT_ARGC_PTR_ARGV,&argc,argv,NULL); frame = (Frame)xv_create(NULL, FRAME, FRAME_LABEL, "Test", XV_WIDTH, 200, XV_HEIGHT, 100, NULL); printf("The string is: \"%s\"\n",string); panel = (Panel)xv_create(frame, PANEL, XV_KEY_DATA, 1, string, NULL); printf("The string still is: \"%s\"\n",string); xv_create(panel, PANEL_BUTTON, PANEL_LABEL_STRING, "Verify & Quit", PANEL_NOTIFY_PROC, button_cb, NULL); xv_main_loop(frame); exit(0); } void button_cb(item,event) Panel_item item; Event *event; { printf("The string now is \"%s\"\n",(char*)xv_get(panel,XV_KEY_DATA,1)); xv_destroy_safe(frame); } -------------------------------------------------------------------------------