Hi,
I would like to ask if it is possible to disable button in GUI by code? I would like to have one button disabled by default and then activate it based on some action?
Thank you a lot,
Martin
You should use:
treenode button= ........ //your button path windowgray(windowfromnode(button),0); // use 0 or 1 - reflecting the graystate.
This way the button is inactive and visibly disabled . This way it's clear to users that they should not try pressing the button and will not be left wondering if it worked or why it did not.
You could alternatively hide/show the button completely with:
windowshow(windowfromnode(button),0); // 0 or 1 to reflect the hidden state
but that could leave a user puzzled as to why they don't find a button they were sure they'd seen on that gui.
I would add a node to the buttons attribute tree and use its value as a condition in the OnPress code. Other parts of the GUI/model can then change the node's value and thus activate the buttons functionality.
18 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved