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: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? Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: ware@cis.ohio-state.edu
Last Update March 27 2014 @ 02:11 PM
|
Comment about this article, ask questions, or add new information about this topic: