How to enable / disable toggle box in dialog
How to enable / disable toggle box in dialog
(OP)
I'm using nx7.5, C#(.NET Framework 3.5)
I made 2 toggle boxes with by below code.
toggle0 = (NXOpen.BlockStyler.UIBlock)theDialog.TopBlock.FindBlock("toggle0");
toggle1 = (NXOpen.BlockStyler.UIBlock)theDialog.TopBlock.FindBlock("toggle0");
I want... if toggle0 is checked, then toggle1 is disabled.
Please let me know what code should be inserted.
Below is update callback in my code.
public int update_cb(NXOpen.BlockStyler.UIBlock block)
{
try
{
if (block == toggle0)
{
[Disable toggle1 code here]
}
if (block == toggle1)
{
}
}
catch (Exception ex)
{
//---- Enter your exception handling code here -----
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
}
return 0;
}
Thanks in advance for your help.
I made 2 toggle boxes with by below code.
toggle0 = (NXOpen.BlockStyler.UIBlock)theDialog.TopBlock.FindBlock("toggle0");
toggle1 = (NXOpen.BlockStyler.UIBlock)theDialog.TopBlock.FindBlock("toggle0");
I want... if toggle0 is checked, then toggle1 is disabled.
Please let me know what code should be inserted.
Below is update callback in my code.
public int update_cb(NXOpen.BlockStyler.UIBlock block)
{
try
{
if (block == toggle0)
{
[Disable toggle1 code here]
}
if (block == toggle1)
{
}
}
catch (Exception ex)
{
//---- Enter your exception handling code here -----
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
}
return 0;
}
Thanks in advance for your help.





RE: How to enable / disable toggle box in dialog
CODE -->
Graham Inchley, Systems Developer.
NX6, NX8.5(testing)
www.sandvik.com
RE: How to enable / disable toggle box in dialog
Unfortunately, setEnable method is not containe in NXOpen.BlockStyler.UIBlock.
I wonder what method can I use?
please help me more.
RE: How to enable / disable toggle box in dialog
For NX7.5 you need to do something more like this:
CODE -->
// Get the value of toggle0 (whether it is checked or not) PropertyList pl0 = toggle0.getProperties(); boolean val = pl0.getLogical("Value"); pl0.dispose(); // Set the enabled state of toggle1 depending on toggle0's checked value PropertyList pl1 = toggle1.getProperties(); pl1.setLogical("Enable",!val); pl1.dispose();At NX8 (or 8.5 I can't recall) the way you access properties on blocks changed. Since then there are separate classes for each block type and these classes have specific methods to access the properties. This is much more robust and concise.
Graham Inchley, Systems Developer.
NX6, NX8.5(testing)
www.sandvik.com
RE: How to enable / disable toggle box in dialog
I solved with your advice.
Thanks again.