Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.windows.x.intrinsics Frequently Asked Questions (FAQ)
Section - 48.+How are created, managed, mapped, realized, etc. related?

( Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Airports ]


Top Document: comp.windows.x.intrinsics Frequently Asked Questions (FAQ)
Previous Document: 47.+How to get rid of that annoying flicker during updates?
Next Document: 49.+How to use the String definition from a C++ library?
See reader questions & answers on this topic! - Help others by sharing your knowledge
----------------------------------------------------------------------

(From pkimball@netcom.com (Paul Kimball) 11/1/93)

When a widget is first created, memory is allocated to
hold its instance data structure.

After creation, a widget has four attributes
that determine whether it is visible and/or
sensitive to user input.  Any of these can be TRUE or FALSE:

	Realized	If TRUE, widget has gotten a window
			from the server. It will display its
			graphics in this window.
	Managed		If TRUE, parent of the widget agrees to
			make room for the child via geometry
			management.  Note that the parent widget
			always gets the final say on how big the
			child appears.
	Mapped		If TRUE, server tries to display (map) the
			widget's window.
	Sensitive	If TRUE, widget is sensitive to user input.
			That is, the toolkit bothers to process its
			input events.

Practically. what this means is as follows:
	1. If a widget is unrealized, nothing else matters.  It has no
		window, and you'll never see it.
	2. If a widget is unmanaged, it may have a window, but you
		still won't get to see it because its parent
		probably won't give it any display room.
	3. If a widget is unmapped, it may have a window and the
		parent may give it room, but you still can't
		use it since the server is not bothering to
		display the window.
	4. If a widget is insensitive, you may be able to see it
		but you can't interact with it.

A widget is most useful when it is Realized, Managed, Mapped
and Sensitive.

A widget is created, by default, in the Unmanaged, Unrealized,
Unmapped, Sensitive state.

When you manage a widget, it becomes mapped, by default.  If the
parent is realized, it also becomes realized.
So by default, once you manage a widget, it is usually Managed,
Realized, Mapped and Sensitive: 
	1. It has a window.
	2. The server is trying to display that window.
	3. The parent widget has sized the window to some visible
		size.
	4. The widget is sensitive to user input.
So now you can see the widget and interact with it.

Why would you want to be able to manipulate these attributes 
independently?  Several cases:

	1. You want a widget to be displayed, but not to
		accept user input.  Use XtSetSensitive() to 
		set it insensitive.
	2. You want to remove a control from a dialog box without
		causing the dialog box to resize itself, or
		rearrange other controls.  Use 
		XtSetMappedWhenManaged() to disable the default
		behavior (mapped if managed) and then call
		XtUnmapWidget() to unmap the child.
	3. You are connected to a really awful server that has
		run out of resources, and you need to give
		back some memory.  Call XtUnrealizeWidget() to
		deallocate the window ID and other resources.


User Contributions:

Comment about this article, ask questions, or add new information about this topic: