ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 06-20-2011
Eike Schulz Eike Schulz is offline
Flexsim User
 
Join Date: May 2011
Posts: 6
Downloads: 3
Uploads: 0
Thanks: 11
Thanked 1 Time in 1 Post
Rep Power: 0
Eike Schulz is on a distinguished road
Default 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  
Old 06-21-2011
Esther Bennett Esther Bennett is offline
Flexsim User
 
Join Date: Mar 2008
Posts: 115
Downloads: 27
Uploads: 0
Thanks: 103
Thanked 116 Times in 50 Posts
Rep Power: 271
Esther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to all
Default

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 )
{
setchecked( c, 1 );
}
}
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


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.