[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

953.0. "Dialog box and focus management" by EVOAI2::DAN_M (Maya DAN) Thu Jun 15 1989 08:56

Could someone help me to answer to my customer, please?

1.Dialog box and focus management
  -------------------------------
We are writing some very simple input/ouput widgets(date widget,
text widget,integer widget ...).
Very simple meaning all we need from an outside view (from an application point
of view) is two methods and one (and only one) callback i.e.

  - a PutText() function to update and initialize a widget.
  - a GetText() function to capture and manage the information at the
    application level.
  - a FieldChangeCallback,triggered when a logical piece of information is
    modified by a user in any way.

The widget container we use is a dialog box widget (in fact an attached popup
dialog box).
It works except for the TAB key.the TAB key is used by a user to give the focus
to the next input/output widget inside the dialog box(as with the decwindows
simple text widget).The problem is i don't know,from a widget programmer point
of view,the internal mechanism used by a dialog box to manage the focus for its
children.
What's the internal algorithm ?
what's the dialog beetwen my input/ouput widget and its parent the dialog box
widget?

thank you very much
    regards
    Maya
    

T.RTitleUserPersonal
Name
DateLines
953.1LEOVAX::TREGGIARIWed Jun 21 1989 13:4535
> What's the dialog between my input/ouput widget and its parent the dialog box
> widget?

The "dialog" is fairly simple.  Your widgets need two things:

1.  A DwtNfocusCallback resource.  The Dialog Box will add a callback
    to this list so that it knows when the widget takes focus.

2.  An accept_focus procedure which does at least this:

static Boolean AcceptFocus(w, time)
Widget w;
Time *time;
{
    DwtAnyCallbackStruct cb;
 
    /*
     *  If the widget is insensitive, do not accept focus
     */
    if (!XtSensitive(w))
	return (FALSE);

    XSetInputFocus(XtDisplay(w), XtWindow(w),
		   RevertToParent, *time);
    cb.reason = DwtCRFocus;
    cb.event = NULL;
    XtCallCallbacks (w, DwtNfocusCallback, (Opaque) &cb);
    return(TRUE);
}

If your widget takes focus on its own for any reason (e.g. button 1 click),
it should call this routine to do it.

Leo