[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

3206.0. "Simple Text and Activate reason" by TLSE01::SCHLUMBERGER (Marc SCHLUMBERGER, WS-VMS-Ultrix Conslt) Tue Aug 14 1990 09:14

    Could someone explain me the exact meaning of the ACTIVATE reason
    on a simple text widget.
    
    I am trying to use the MB2 on a simple text to popup a dialog box.
    I read the decbuger and new examples of IFT 5.4 but I still don't
    understand the use of the activate reason. It seems I never call
    the c procedure on the activate reason .
    
    Any comments question or remarks are welcome !
    
    Marc 
T.RTitleUserPersonal
Name
DateLines
3206.1popup menu?LOWELL::KLEINTue Aug 14 1990 13:5737
My understanding is that the activate callback in the SText widget is a stub.
It is not used in the code but is available for user-defined translations,
so that an SText widget that has its translations augmented has a convenient
hook for generating a callback without the user having to write a new action
routine.  You do not want to get involved in this, I would say.  There are
easier ways to do what you want.

Normally, MB2 activates a popup menu, not a popup dialog box.  I'll assume
you meant "menu".  If you really meant dialog box, you can still use the same
general approach.

First, use XtAddEventHandler to trap MB2 on the SText widget.  Make these
calls once, after realizing the main window that contains the sText widget.
Because of a toolkit restriction, the popup menu cannot be fetched until
its parent has been realized:

    DwtFetchWidget (drmHierarchy, "myPopupMenu", sTextW, &popupMenuW, &class);

    XtAddEventHandler (sTextW, ButtonPressMask, 0, ButtonPressHandler,
        popupMenuW);

and then write a ButtonPressHandler like this, to activate the menu:

    static void ButtonPressHandler(w, popupMenuW, eventP)
	Widget w, popupMenuW;
	XButtonEvent *eventP;
    {
	if (eventP->button != Button2) return;	/* wrong button */
    
	DwtMenuPosition (popupMenuW, eventP);	/* position the menu */
    
	XtManageChild (popupMenuW);		/* pop it up */
    }

...

-steve-
3206.2ThanksTLSE01::SCHLUMBERGERMarc SCHLUMBERGER, WS-VMS-Ultrix ConsltThu Aug 16 1990 05:384
    Thanks Steve. It works pretty fine. I forgot the XtAddEventHandler
    routine. You can imagine why I add problems ....
    
    Marc