ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
check state of radiobuttons from start-button
Hi everybody,
I'm building a GUI for model control with three radiobuttons to select the run-mode. Now i want to write an if-statement in the onpress code of the start button where it is checked if one of the radiobuttons is selected. Is there a way to get the check-state of the radiobuttons in that if statement? I tried with getchecked() but either this doesn't work or I just couldn't find out the right syntax. Thanks a lot for help! |
#2
|
|||
|
|||
Hello Eike,
I have used a similar feature and I will try to explain what I have done. I created a numeric label "RunMode" on a control object that was part of my model. This label can have the value 1, 2 or 3 depending on what radio button was selected. On each radio button i used the hotlinkx attribute. In the hotlinkx attribute i added code such as: int MyValue = 1; // for the first radiobutton if( eventdata == 0 ) // this is when the gui opens { if( getalbelnum( ControlObject, "RunMode" ) == MyValue )} else // this is when the apply or ok button is pressed { setlabelnum( ControlObject, "RunMode", MyValue );} Furthermore I added an OnPress attribute to each radio button with the code: applylinks( c ), this will cause the 'else' part to be executed from the hotlinkx code. Hope this helps you solve your problem. Esther |
The Following User Says Thank You to Esther Bennett For This Useful Post: | ||
Eike Schulz (06-23-2011) |
Thread | Thread Starter | Forum | Replies | Last Post |
Command to check the status of an object's port | KelvinHo | Q&A | 3 | 01-14-2010 12:57 AM |
Check GUI edit boxes for 100% | Michael Pohl | Q&A | 1 | 04-28-2009 09:36 AM |
Command overview does not start because XML does not start | Tom David | Q&A | 0 | 09-17-2008 12:11 AM |
Make sure you stop model with the stop button before collecting state based statistics | Paul Dowling | Tips and Tricks | 2 | 06-10-2008 08:10 AM |
Check out our cool downloads! | Cliff King | Marketing and Sales Information | 0 | 04-02-2008 10:07 AM |