×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to enable / disable toggle box in dialog

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.

RE: How to enable / disable toggle box in dialog

Off the top of my head it's going to be something like:

CODE -->

toggle1.setEnable(!toggle0.value()); 

Graham Inchley, Systems Developer.
NX6, NX8.5(testing)
www.sandvik.com

RE: How to enable / disable toggle box in dialog

(OP)
grinch33, thank you for your reply.

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

Oops, I didn't take note of the NX version you are using, sorry. The suggested code would work at NX8.5.
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(); 
As you can see at NX7.5 and earlier you have to ask for a PropertyList object from the UIBlock and get/set the properties by name from there.
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

(OP)
Very thank you sir!

I solved with your advice.

Thanks again.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources