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
|
|||
|
|||
GUI - radiobutton
Hello,
-i'm trying to use radiobuttons on a gui, i'm using onPress attibute to change a variable and it works, but visually the radiobuttons don't save the state when closing/open the window. How does this works?.. regards, Pablo Concha E. |
#2
|
|||
|
|||
Hello Pablo,
i dont know it exactly, but i found a Thread with nearby the same theme.. (checkbox instead of radiobutton). maybe it helps you a little bit.. http://www.flexsim.com/community/for...read.php?t=312 Tobias |
The Following User Says Thank You to tobias.biemueller For This Useful Post: | ||
Pablo Concha (03-25-2008) |
#3
|
|||
|
|||
Thanks Tobias, i read that post before, tried an example and didn't work... i think i did something wrong, becouse now i tried it again and it did work .
thanks, Pablo Concha E. |
#4
|
||||
|
||||
Pablo,
From my experience you will need to manually check/select the radio button that you want selected when the GUI opens, this applys to check boxes as well. To do this use the OnOpen node in the main GUI node. The Object Properties GUI uses the following code to set whether or not a check box is checked: setchecked(node("/Show Name",settingspanel), not(switch_hidelabel( focus))); The Separator Tab in the Separator's Parameters GUI uses the following code to set the appropriate radio button as selected (Unpack is selected by default): if(not(getnodenum(node("@>objectfocus+>variables/unpack",c)))) setchecked(node("../Split",c), 1); As a general rule of thumb "if its been done before then steal it." To steal part of a GUI right click on the GUI you wish to pirate from and select view -> Explore structure. This will open up a tree view of the GUI and you can copy the code and nodes you will need from there. Good Luck, Brandon Flexsim GUI Pirate / Consultant
__________________
thats not normal. |
The Following 3 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
Sebastian Schreiber (07-05-2011) |
#5
|
|||
|
|||
Thanks for your Tip Brandon,
but how do i correctly reference a radiobutton? I have three radio-buttons that control a global variable. Your on open check works fine and the specific case is executed corresponding to the global variable but the corresponding button is not checked. I tried to reference it via node ranks like this: setchecked(node("../2/2/1",c), 1); but obiously this does not work. Can you tell me a better (i.e. a working one ) way to reference? Thanks a lot Eike Schulz |
#6
|
|||
|
|||
Found the solution on my own via "pathtonode()" after some brain crunching. Got confused before because the path differs depending on if you are editing the GUI or using it .
--> When editing it the path is "Main:1/..." --> When using it it obiously starts with "View: ..." Now it works fine so thanks again for the idea Brandon! |
#7
|
|||
|
|||
What you'll find is that it's 'c' that changes (sometimes it's the node itself, but it can also be the viewcontrol or the object that contains it)- and that depends how the node is called (it's specified by executefsnode)
If you're not sure for a given node, you can print out the path for c, or to reference the root of the active GUI you can always use node("@",c) and avoid the need to find the full path. Last edited by Jason Lightfoot; 07-04-2011 at 10:18 AM. |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Eike Schulz (07-07-2011) |