7.1.1 MrmHierarchy object methods

The mrm_hierarchy_object has the following methods:

FetchWidget( index, parent_widget)
Returns widget. This function corresponds with MrmFetchWidget.

This Python function fetches the UIL-object named index and its children from the mrm_hierarchy object and creates these widgets in a widget-tree under parent_widget. FetchWidget returns the UIL-object named index wrapped as a Python widget object. Widgets that are children of index are created but are not wrapped as Python widget objects. None of the widgets created are managed.

The following Python code snippet shows the use of the FetchWidget method and also shows how to obtain a child widget of index as a Python widget object by using the widget NameToWidget method.

    top_level = Xt.Initialize()
    mrm_hier = Mrm.OpenHierarchy("panel_cp.uid")
    main_w = mrm_hier.FetchWidget("main", top_level)
    child_w = main_w.NameToWidget("child-widget-name")

"child-widget-name" is the partially qualified name of the desired widget child of main_w; see XtNameToWidget() for details. Usually the simple widget name can be prefixed with an asterisk to fetch the appropriate widget even if it is not the immediate child of the main widget.

PyRegister( function_object, argument_type[, function_name])
Returns None. This function corresponds more-or-less with MrmRegisterNamesInHierarchy.

This Python function registers the Python function function_object with Mrm so that the Python function function_object can be declared as a callback function in UIL. argument_type is a string that declares the type of the client argument to function_object. The only types currently supported are "integer", "string", and "widget".

function_object must be declared in Python with three arguments, which correspond to the standard callback widget, clientdata and calldata arguments. argument_type causes the clientdata argument passed to function_object to be wrapped as a Python integer, string or widget object.

By default, PyRegister registers the name of the Python function with Mrm as the UIL-declarable callback function. An optional third string argument to PyRegister can be used to explicitly specify the UIL-declarable callback name registered with Mrm.

Currently, the internal implementation of PyRegister is ugly and only supports registering 250 routines.