UF_UI_run_dialog
Defined in: uf_ui_xt.h
int UF_UI_run_dialog(Widget dialog_widget )
overview 概述
Handles managing and unmanaging of the dialog. The sequence of events is:
Manage the main widget of the dialog (dialog_widget).
Enter the Ungraphics event loop and stay there until UF_UI_exit_dialog is called from a dialog callback function.
When the event loop is exited, the main widget of the dialog is unmanaged.
Return to the caller.
When creating a dialog, you must use the visuals from NX. To do this
you must use UF_UI_ask_default_parent_info, to get the information. After the dialog has been defined (i.e., all widgets created as necessary), the main widget is passed to UF_UI_run_dialog. This function manages the main widget and enters the NX event loop allowing the dialog to "run" (i.e., react to keyboard input and mouse gestures, execute callbacks, etc.). UF_UI_run_dialog does not return to the user until UF_UI_exit_dialog has been called. When the UF_UI_run_dialog call has been made, some of the NX application becomes inhibited. This includes the non-global functions in the main menubar and various DA1s. Even though access to parts of NX is inhibited, NX does not consider itself in a "lock" state. This only occurs with the call to UF_UI_lock_ug_access. Unlike launching a custom dialog with XtManageChild, with UF_UI_run_dialog you do not need to call UF_UI_lock_ug_access when calling a Presentation API. However, if you do not call UF_UI_lock_ug_access then you are not allowed to call UF_UI_cancel_uf_dialog. When the dialog handling part of the Open API program (i.e., the dialog's callback functions) determines that it is time to terminate the dialog (for example, after you press OK or Cancel on the dialog), UF_UI_exit_dialog should be called. This function should only be called from a callback function associated with a dialog initiated by a call to UF_UI_run_dialog. Always make sure to check the status of UF_UI_run_dialog. This will return an error messages if something goes wrong. You can use the Open API UF_UI_get_fail_message to determine the exact problem UF_UI_run_dialog and UF_UI_exit_dialog experienced. A user of a custom dialog launched via UF_UI_run_dialog may not launch another Open application that uses the lock & unlock mechanism or is launched via UF_UI_run_dialog. This example will launch a custom dialog with two push buttons. Prior to launching the custom dialog with UF_UI_run_dialog a call to UF_UI_lock_ug_access is made. This implies the necessary handshaking has been done for the entire session, and therefore is not needed around each and every Open dialog or UIStyler dialog call. Both buttons within the custom dialog always remain active so calls to UF_UI_cancel_uf_dialog have been made to ensure the correct handling of the dialog when the user select another button in the custom dialog while the Open dialog is up. Also, a call to UF_UI_cancel_uf_dialog has been made from within the cancel button navigation callback. Since, this custom dialog is always locked there is no need to check the lock status prior to calling this function. Because no Open API should be called immediately following UF_UI_cancel_uf_dialog, a call to XtAppAddTimeOut is made, which has a callback making the necessary call to UF_UI_exit_dialog. Once the UF_UI_run_dialog has terminated then the unlocking of the custom dialog is done and the call to UF_terminate is made.
处理对话框的管理和取消管理。事件的顺序是: 管理对话框的主窗口小部件(Dialogue _ widget)。进入 Ungraph 事件循环并停留在该循环中,直到从对话框回调函数调用 UF _ UI _ exit _ Dialogue 为止。当事件循环退出时,对话框的主窗口小部件是非托管的。回到呼叫者身边。创建对话框时,必须使用来自 NX 的视觉效果。要做到这一点,您必须使用 UF _ UI _ ask _ default _ father _ info 来获取信息。定义完对话框(即,根据需要创建所有窗口小部件)后,主窗口小部件被传递到 UF _ UI _ run _ Dialogue。这个函数管理主窗口小部件,并进入 NX 事件循环,允许对话框“运行”(例如,对键盘输入和鼠标手势做出反应,执行回调等)。在调用 UF _ UI _ exit _ Dialogue 之前,UF _ UI _ run _ Dialogue 不会返回给用户。当发出 UF _ UI _ run _ 对话框调用时,一些 NX 应用程序会受到抑制。这包括主菜单栏和各种 DA1中的非全局函数。即使对 NX 的某些部分的访问被禁止,NX 也不认为自己处于“锁”状态。这只有在调用 UF _ UI _ lock _ ug _ access 时才会发生。与使用 XtManageChild 启动自定义对话框不同,使用 UF _ UI _ run _ Dialogue 在调用 PresentationAPI 时不需要调用 UF _ UI _ lock _ ug _ access。但是,如果不调用 UF _ UI _ lock _ ug _ access,则不允许调用 UF _ UI _ Cancel _ UF _ Dialogue。当 Open API 程序的对话框处理部分(例如,对话框的回调函数)确定是时候终止对话框(例如,在对话框上按 OK 或者 Cancel 之后)时,应该调用 UF _ UI _ exit _ Dialogue。这个函数只能从一个回调函数中调用,该回调函数与一个对话框相关联,该对话框是由对 UF _ UI _ run _ Dialogue 的调用启动的。始终确保检查 UF _ UI _ run _ Dialogue 的状态。如果出现错误,这将返回错误消息。您可以使用 Open API UF _ UI _ get _ fall _ message 来确定 UF _ UI _ run _ Dialogue 和 UF _ UI _ exit _ Dialogue 遇到的确切问题。通过 UF _ UI _ run _ Dialogue 启动的自定义对话框的用户可能不会启动另一个使用锁定和解锁机制的 Open 应用程序,或者通过 UF _ UI _ run _ Dialogue 启动。此示例将启动一个带有两个按钮的自定义对话框。在使用 UF _ UI _ run _ Dialogue 启动自定义对话框之前,调用 UF _ UI _ lock _ ug _ access。这意味着在整个会话中已经进行了必要的握手,因此不需要在每个 Open 对话框或 UIStyler 对话框调用周围进行握手。自定义对话框中的两个按钮始终保持活动状态,因此调用 UF _ UI _ Cancel _ UF _ Dialogue 可以确保在打开对话框时用户在自定义对话框中选择另一个按钮时对对话框的正确处理。此外,在取消按钮导航回调中调用了 UF _ UI _ Cancel _ UF _ Dialogue。因为这个自定义对话框总是锁定的,所以在调用这个函数之前不需要检查锁定状态。因为在 UF _ UI _ Cancel _ UF _ Dialogue 之后不应立即调用 Open API,所以会调用 XtAppAddTimeOut,该调用具有一个回调,对 UF _ UI _ exit _ Dialogue 进行必要的调用。一旦 UF _ UI _ run _ 对话框终止,那么自定义对话框的解锁就完成了,并且对 UF _ finally 的调用也完成了。
UFUN例子
获取源码例子请搜索 里海NX二次开发3000例专栏
parameters 参数
| Widget | dialog_widget | Input | Main Widget of the Motif dialog. 主题对话框的主要小部件。 |