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 & linked variables
Hy,
I would ask for a few support if posible. The attached model has nothing else than a GUI + one Global Variable. I am trying to develop a GUI with a tree structure (tab controls inside tab controls and variables as leafs - not sure if correcly applying the tab controls). The GUI variables must be linked to the object variables or GlobalVariables. The first problem is comming from the fact that I can not put an "edit variable" inside of the tab control other size than the size of the tab (or it might be another rule for the tab to host text mostly?). I have finaly tried and succeded to put the edit areas inside a groupbox. I am not sure if this is correct or if this is the meaning. The solution with the groupbox works partialy since I was not able to update the GlobalVariable. I have also tried to compare with MAIN:/project/model/Tools/settings/fullhistory from the DEMO GUI (this button is quit similar inside of a groupbox, etc) but I was not able to find that path in my tree. I have tried with different levels of tab controls and Aplly buttons but only one of the variables updates the Global Variable (all can extract it in a correct manner). I am sure that I am not applying the correct objects or the proper order, or that something is missing. Highly appreciate if someone could provide some advice on this matter. The explanations that I have provided might not be enough clear so there is no need to answer to that. If more easy just post a sample with the desired structure "2 - 3 levels of tab controls inside tab controls and "edit variables" on diferent levels, connected to a GlobalVariable with posibility to update de Global Variable from any of the described GUI variables". Thank you very much for your support. Iulian |
#3
|
||||
|
||||
Iulian,
Unfortunately, the "live" value of a global variable is not stored in the tree. The value that you see in the tree is only the "reset" value for that global variable. It will only be applied to the "live" value after a compile and when you apply the Global Variables gui (specifically when refreshglobalvariables() is called). You could use refreshglobalvariables() to apply it when the user hits the Apply button, but my suggestion is to use the coldlinkx attribute to apply it directly using script. Remove the hotlink attribute from the edit, and add a coldlinkx attribute. Then give it the following code: Code:
if(eventdata)// the value needs to be applied { variable1 = stringtonum(getviewtext(c)); } else // the value needs to be retrieved { setviewtext(c, numtostring(variable1, 0, 3)); } Good Luck |
The Following 2 Users Say Thank You to Anthony Johnson For This Useful Post: | ||
mbaccalaro (03-20-2014) |