Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mit-eddie!uw-beaver!uw-june!wolf.cs.washington.edu!slh From: slh@wolf.cs.washington.edu (Scott Heyano) Newsgroups: comp.windows.x.motif Subject: Re: trouble with structures and callbacks Message-ID: <13837@june.cs.washington.edu> Date: 23 Nov 90 22:21:23 GMT References: <2450@kiwi.mpr.ca> Sender: news@cs.washington.edu Reply-To: slh@wolf.cs.washington.edu (Scott Heyano) Organization: Computer Science & Engineering, U. of Washington, Seattle Lines: 25 In article <2450@kiwi.mpr.ca> baker@mprgate.mpr.ca (Sue Baker) writes: [stuff] | | XtAddCallback(update, XmNactivateCallback, get_text, text); | |within the "get_text" function, i receive "text" as "textwidget" |and i can access textwidget.widget_array[0] with no trouble, but |i get a segmentation fault when i try to access any other element |of textwidget.widget_array. DAMNIT, you can only pass the POINTER TO THE STRUCTURE, NOT the actual structure. So only the first 32-bits are passed, in this case the first Widget in the array. So what you want is: XtAddCallback(update, XmNactivateCallback, get_text, &text); and: textwidget->widget_array[0] | |so, |1) why can't i access my structure in this manner? |2) how can i make my structure accessible to my callback function? | |thank you in advance for any help in this matter. |sue |baker@mprgate.mpr.ca