Next | Prev | Up | Top | Contents | Index

Core Methods

The Core class defines the set of methods common to all derived classes, shown below for widget w:

w realizeWidget


Create windows for the widget and its children. Usually this is used only on the main widget, as in the ". realizeWidget" call.

w destroyWidget


Destroy the widget w, its subwidgets, and all associated Tcl commands. Calling ". destroyWidget" gracefully exits the Modif main loop, whereas calling "exit 0" unceremoniously halts the Tcl interpreter.

w mapWidget

Map the given widget onto screen, to make it visible. This is done when the widget is managed (see below).

w unmapWidget


Unmap the widget from its parent's screen, making it invisible, but leave it in geometry management.

w manageChild


Bring a widget (back) under geometry management and make it appear (again). This is equivalent to the managed parameter at creation time. Some widgets should not be managed at creation time, for instance when the parent needs special settings to handle the widget properly, or for menus and dialogs that need to be displayed only temporarily.

w unmanageChild


Unmap the widget from its parent's screen, making it invisible, and also remove it from geometry management.

w setSensitive Boolean


An insensitive widget does not respond to user input. When a widget is disabled with "w setSensitive false" it is usually drawn dimmed (using a gray pattern). The main use for this is disabling buttons or menu items that are not allowed in the current state of the application.

w getValues resource variable ...


This is a dual command: given a paired list of Tm resource names and Tcl variable names, it sets the Tcl variable to the current value of the corresponding Tm resource. Motif reverse conversions are used for this, but Tm does not provide all of them. This means you should be able to set up all resource types, but you might not be able to retrieve them all.

proc flash {widget {fg black} bg red}} {

$widget getValues

-background old_bg -foreground old_fg

$widget setValues \

-background $bg -foreground $fg

wait 0.1

$widget setValues \

-background $old_bg -foreground $old_fg

}

w setValues rsrc value ...


This command changes resource values for an already existing widget. The required parameters are a paired list of resource names and string values. The following changes the text colors of the .frm.text widget:

.frm.text setValues \

-background lightGray \

-foreground #111

Each widget class defines which resources may be set, the resource types, and their accepted values.

w resources

Returns a list of all active resources for the given widget. This returns a quadruple of the following form:

name Class type value

w anyCallback tclProc


If the widget method name contains the substring Callback, then Tm asks Motif to register the command list given in the argument. When the specified event occurs, it is interpreted (in the global context).

w parent

This method retrieves the parent widget name. If a regular widget .a.b.c has been created, then "set x [.a.b.c parent]" assigns the string ".a.b" to variable x. The exact result is not always obvious, because some widgets (such as dialogs) have hidden parents.

w processTraversal direction


Change the widget that receives keyboard input focus; direction may be any of the following:

current

home

up

down

left

right

next

next_tab_group

previous_tab_group

w dragStart resource value ...


See section "Drag and Drop" for details about this method.

w dropSiteRegister resource value ...


See section "Drag and Drop" for details about this method and the one above.

w getGC resource value ...


This method retrieves the Xlib graphical context of a widget. There must be at least one resource defined. The allowed resources are -background and -foreground. See section "xmDrawingArea and xmDrawnButton" for information about user-defined graphics in Tm widgets.

w callActionProc


Call an action procedure. Usually used to test moat, or your own code.

Core Widget Resources

Table 4-9 shows values for the core resources common to all widgets. A Core widget is an empty rectangle, with an optional border.

Core Resources
Core Resource NameDefault ValueType or Legal Values
-acceleratorsnoneString
-backgrounddynamic Color
-backgroundPixmapnonePixmap
-borderColordynamicColor
-borderWidth1Integer
-heightdynamicInteger
-mappedWhenManagedTrueBoolean
-sensitiveTrueBoolean
-translationsnoneString
-widthdynamicInteger
-x 0Integer
-y 0Integer

For information about usage of these resouces, see the Core(3X) reference page.


Next | Prev | Up | Top | Contents | Index