Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ initialize_(3) — OSF1 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XtCreateWidget(1)

XtGetSubvalues(1)

Core(3)

get_values_hook(4)

set_values_hook(4)

initialize(4)

 

Name

initialize_hook — Core method for initializing subpart data. 

Synopsis

typedef void (∗XtArgsProc)(Widget, ArgList, Cardinal ∗);

    Widget w;
    ArgList args;
    Cardinal ∗num_args;

Arguments

wSpecifies the widget whose subpart data is to be retrieved. 

argsSpecifies the argument list that was passed to XtCreateWidget. 

num_argsSpecifies the number of arguments in the argument list. 

Description

The initialize_hook method allows a widget instance to initialize subpart data using information from the specified argument list.  For example, the R3 Text widget had subparts that were not widgets, yet these subparts had resources that could be specified by means of the resource file or an argument list.  (The R4 Text widget uses objects to achieve the same modularity.) 

If initialize_hook is not NULL, then it is called immediately after the corresponding initialize method or in its place if the initialize method is NULL. 

The hook methods are called with different arguments than their nonhook counterparts.  They are passed a single copy of the widget instance structure (the new copy already modified in the nonhook methods), and the argument list passed to the Xt routine that triggered the method.  The initialize_hook method uses the contents of the argument list to validate resource settings for subparts and set nonresource subpart data. 

As of Release 4, the initialize_hook and set_values_hook methods are still called for backwards compatibility but are obsolete because the same information (the argument lists) has been added as arguments to the initialize and set_values methods.  (However, the get_values_hook method is still necessary.) 

Examples

The following is the initialize_hook method of the Athena AsciiText widget class.  This particular method creates the source and sink objects, which are replaceable parts of the Text widget. 

static void
CreateSourceSink(widget, args, num_args)
Widget widget;
ArgList args;
Cardinal ∗num_args;
{
  AsciiWidget w = (AsciiWidget) widget;
  int i;
  int tabs[TAB_COUNT], tab;
   w->text.source = XtCreateWidget( "textSource", asciiSrcObjectClass,
                   widget, args, ∗num_args );
  w->text.sink = XtCreateWidget( "textSink", asciiSinkObjectClass,
                 widget, args, ∗num_args );
   if (w->core.height == DEFAULT_TEXT_HEIGHT)
    w->core.height = VMargins(w) + XawTextSinkMaxHeight(w->text.sink, 1);
   for (i=0, tab=0 ; i < TAB_COUNT ; i++)
    tabs[i] = (tab += 8);
   XawTextSinkSetTabs(w->text.sink, TAB_COUNT, tabs);
   XawTextDisableRedisplay(widget);
  XawTextEnableRedisplay(widget);
}

See Also

XtCreateWidget(1), XtGetSubvalues(1),
Core(3),
get_values_hook(4), set_values_hook(4), initialize(4). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026