- 1060
- 0
- 约8.88千字
- 约 7页
- 2017-02-28 发布于湖北
- 举报
C#(UG)
NXOPEN
Create and display a dialog
Private dialog As nxopen.uistyler.Dialog
dialog = UI.GetUI().Styler.CreateStylerDialog(Sample.dlg)
显示对话框
dialog.Show()
Alternatively, the UI Styler uses the following instead of the show function you open the dialog from the menu:
或者,UI/Styler用以下代码实现从菜单打开的对话框的显示功能。
Dim isTopDialog As Boolean
isTopDialog = false
dialog.RegisterWithUIMenu(isTopDialog)
How styler items are declared:
Private changeDialog As NXOpen.UIStyler.DialogItem
Private changeStr0 As NXOpen.UIStyler.StringItem
Private changeReal6 As NXOpen.UIStyler.RealItem
How styler items are initialized: (初始化)
changeDialog = theDialog.GetStylerItem(UF_STYLER_DIALOG_INDEX,
NXOpen.UIStyler.Dialog.ItemType.DialogItem)
changeStr0=theDialog.GetStylerItem(STR_0,NXOpen.UIStyler.Dialog.ItemType.StringItem)
changeReal6=theDialog.GetStylerItem(REAL_6,NXOpen.UIStyler.Dialog.ItemType.RealItem)
Register dialog box item callback functions
In order to register these callbacks, NX provides an API “Add##Handler”, where ## is replaced with “Activate”, “Construct”, “Apply” as shown in following examples. For more information on callbacks of all the dialog items, see the callback section in Dialog Item Reference.
When you exit a Styler dialog box normally, the destructor callback is executed at last. Selecting Cancel or OK will invoke Cancel or OK callback first, followed by the destructor callback.
Event Handler representation(事件处理程序代表)
In case of .NET (VB/C#) APIs, registration is done through Delegates, and represented as:
namespace NXOpen.UIStyler
{
public class StringItem: UIStyler.StylerItem
{
public delegate int Activate(UIStyler.StylerEvent eventObject);
public unsafe void
AddActivateEvent(UIStyler.PushButton.Activate activateevent)();
}
}
In your C# application, the registration will look like this:
changeDialog.AddConstructHandler(AddressOf constructor_cb, False)
changeDialog.AddOkayHandler(AddressOf ok_cb, False)
changeDialog.AddApplyHandler(AddressOf apply
原创力文档

文档评论(0)