corry@eniac.seas.upenn.edu (Chris Corry) (02/28/91)
* PLEASE, PLEASE HELP * I've got a problem that I cannot think of an acceptable solution to. Let me preface this by saying that I DO NOT WANT TO SUBCLASS THE ATHENA TEXT WIDGET (unless I absolutely have to, of course). That said, here we go. I'm writing a hypertext application with links embedded in the text of a normal Xaw text widget. The link is delimited by special characters (EX: "some text << link >> and so on"). I need a way to capture the backspace key (easy enough, write an action and place it in the translation table), check to see if the character about to be erased is a link (easy enough using the programmatic interface supplied with the text widget), and if it IS, jump to one of my functions without propogating the event to "delete-previous-char" (which is really function DeleteBackwardChar). However, if the character about to be erased IS NOT part of the link I want to let it go through. What I've Tried: I didn't think it would work but I wrote an action (MyDeleteChar) and replaced the "delete-previous-char" action with it. Then I tried to directly call DeleteBackwardChar (found in the private widget code) from my action if needed. As you might expect my link ended like this: >%make -fhypermake >cc -c utils.c -o utils.o >cc -c filemenu.c -o filemenu.o >cc -c optmenu.c -o optmenu.o >cc -c fntmenu.c -o fntmenu.o >cc -c athmenu.c -o athmenu.o >cc -c buttons.c -o buttons.o >cc -c doc.c -o doc.o >cc -c lists.c -o lists.o >cc -c engine.c -o engine.o >cc -c smanage.c -o smanage.o >cc -c hypertex.c -o hypertex.o >cc utils.o filemenu.o optmenu.o fntmenu.o athmenu.o buttons.o doc.o lists.o en >gine.o smanage.o hypertex.o -o hypertex libfwf.a libDir.a -lXaw -lXmu -lXt -lX >11 >ld: Undefined symbol > _DeleteOrKill >make: *** [hypertex] Error 2 >% The only other thing I can think of is subclassing the widget and rewriting DeleteBackwardChar but, although I've become fairly proficient at X, I've never written a widget and I can't really afford the time right now. PLEASE REPLY BY POSTING OR MAIL -- ANY HELP WILL BE GREATLY APPRECIATED!!! ======= Thanks ---------------------------+-------------------------------------------------- Chris Corry | //====// //=== //|| // //|| // Home University of Pennsylvania | //====// //=== // || // // || // on the corry@eniac.seas.upenn.edu | // //=== // ||// // ||// Range ---------------------------+--------------------------------------------------
david@jpl-devvax.JPL.NASA.GOV (David E. Smyth) (03/01/91)
corry@eniac.seas.upenn.edu (Chris Corry) writes: > I didn't think it would work but I wrote an action (MyDeleteChar) and >replaced the "delete-previous-char" action with it. Then I tried to directly >call DeleteBackwardChar (found in the private widget code) from my action if >needed. As you might expect my link ended like this: > >>%make -fhypermake >>ld: Undefined symbol >> _DeleteOrKill See page 367 (section 7.12 - Calling Action Procedures Directly) of the new Asente and Swick "X Window System Toolkit" or page 138 (section 10.9 - Invoking Actions Directly) of the "X Toolkit Intrinsics - C Language Interface X11R4 version." void XtCallActionProc(widget,action,event,params,num_params) Widget widget; String action; XEvent* event; String* params; Cardinal num_params; Asente&Swick write: XtCallActionProc searches for the action name for the widget ... If the search finds no action with the specified name, XtCallActionProc generates a warning and returns. ... Otherwise XtCallActionProc calls the action procedure, passing the specified event, parameters, and parameter counts. ------------------------------------------------------------------------- David Smyth david@jpl-devvax.jpl.nasa.gov Senior Software Engineer, seismo!cit-vax!jpl-devvax!david X and Object Guru. (818)393-0983 Jet Propulsion Lab, M/S 230-103, 4800 Oak Grove Drive, Pasadena, CA 91109 ------------------------------------------------------------------------- One of these days I'm gonna learn: Everytime I throw money at a problem to make it disappear, the only thing that disappears is my money... -------------------------------------------------------------------------
jsparkes@bwdls49.bnr.ca (Jeff Sparkes) (03/01/91)
In <11620@jpl-devvax.JPL.NASA.GOV> david@jpl-devvax.JPL.NASA.GOV (David E. Smyth) writes: >corry@eniac.seas.upenn.edu (Chris Corry) writes: >> I didn't think it would work but I wrote an action (MyDeleteChar) and >>replaced the "delete-previous-char" action with it. Then I tried to directly >>call DeleteBackwardChar (found in the private widget code) from my action if >>needed. As you might expect my link ended like this: >> >>>%make -fhypermake >>>ld: Undefined symbol >>> _DeleteOrKill >See page 367 (section 7.12 - Calling Action Procedures Directly) of the >new Asente and Swick "X Window System Toolkit" or page 138 (section >10.9 - Invoking Actions Directly) of the "X Toolkit Intrinsics - C >Language Interface X11R4 version." >void XtCallActionProc(widget,action,event,params,num_params) > Widget widget; > String action; > XEvent* event; > String* params; > Cardinal num_params; >Asente&Swick write: > XtCallActionProc searches for the action name for the widget ... If the > search finds no action with the specified name, XtCallActionProc > generates a warning and returns. ... Otherwise XtCallActionProc calls > the action procedure, passing the specified event, parameters, and > parameter counts. The big problem with this is that you must parse the action parameters yourself. In x3270, I allow you to bind actions to a command button, but end up parsing it myself. I'd like to be able to call whichever routines parse actions/translation tables, but haven't found how to do it. -- Jeff Sparkes jsparkes@bnr.ca Bell-Northern Research, Ottawa (613)765-2503 Never trust a psychic who hasn't won the lottery. Twice.
corry@eniac.seas.upenn.edu (Chris Corry) (03/01/91)
Just wanted to post a quick note of thanks for those individuals who promptly answered my question on calling actions from actions (ANSWER: XtCallActionProc). David Smyth and Barry Jaspan both had answers for me within hours. Thanks a lot! ---------------------------+-------------------------------------------------- Chris Corry | //====// //=== //|| // //|| // Home University of Pennsylvania | //====// //=== // || // // || // on the corry@eniac.seas.upenn.edu | // //=== // ||// // ||// Range ---------------------------+--------------------------------------------------
asente@adobe.com (Paul Asente) (03/01/91)
In article <38437@netnews.upenn.edu> corry@eniac.seas.upenn.edu (Chris Corry) writes: > I didn't think it would work but I wrote an action (MyDeleteChar) and >replaced the "delete-previous-char" action with it. Then I tried to directly >call DeleteBackwardChar (found in the private widget code) from my action if >needed. You're 90% there. Rather than directly calling DeleteBackwardChar, you should use XtCallActionProc and pass it the string name of the action you want to invoke. Action procedures are usually declared static in the widget implementation file. -paul asente asente@adobe.com ...decwrl!adobe!asente