Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!src.honeywell.com!msi.umn.edu!cs.umn.edu!kksys!com50!pai!erc From: erc@pai.UUCP (Eric Johnson) Newsgroups: comp.windows.x.motif Subject: Re: trouble with structures and callbacks Summary: Let's be nice, please Message-ID: <1549@pai.UUCP> Date: 24 Nov 90 18:18:21 GMT References: <2450@kiwi.mpr.ca> <13837@june.cs.washington.edu> Organization: Boulware Technologies, Inc., Burnsville, MN Lines: 63 In article <13837@june.cs.washington.edu>, slh@wolf.cs.washington.edu (Scott Heyano) writes: > In article <2450@kiwi.mpr.ca> baker@mprgate.mpr.ca (Sue Baker) writes: > [stuff] > | > | XtAddCallback(update, XmNactivateCallback, get_text, text); > | I'm sure evryone has suggested trying something like: XtAddCallback(update, XmNactivateCallback, get_text, &text); That is, pass a pointer to text, not text itself. > |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, Hey now, let's be nice, please. Swearing at people for asking questions will only convince people not to ask questions--it won't make them code any better. The vast majority of people programming Motif applications are new at it, so they're bound to make mistakes. When they do, and ask a question about it, let's all try to remember our first experiences with X and Motif. Let's face it, X and Motif are tough to program. There are an awful lot of concepts to master, some documented, some not. And, those things that are documented are not always described in a clear, understandable manner. In addition, we have different versions of both X and Motif that act in slightly different ways, which only compounds an already tough problem. None of us are perfect, and we all ask questions at one time or another. I know *I* have made mistakes, and if I ask a question on the net, I'd rather not be flamed about it. > 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] > | > |thank you in advance for any help in this matter. > |sue > |baker@mprgate.mpr.ca Have fun and dont get too excited about Moitf programming, -Eric -- Eric F. Johnson phone: +1 612 894 0313 BTI: Industrial Boulware Technologies, Inc. fax: +1 612 894 0316 automation systems 415 W. Travelers Trail email: erc@pai.mn.org and services Burnsville, MN 55337 USA