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 |
#2
|
|||
|
|||
Createview command
Syntax: createview(str viewpath, str objectfocus, str viewfocus)
..so viewpath could be "MAIN:/project/model/Tools/GUIs/MyGUI". To use the objectfocus or viewfocus attributes of your GUI to reference an object it represents, then the paths as strings should be passed in as the 2nd and 3rd paramters. Jason |
The Following 3 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
qin tian (11-22-2008) |
#3
|
||||
|
||||
Qin,
The easiest and fastest way to learn how to program GUIs is to go and pirate what you want to do from another GUI. The easiest way to do that is to open the GUI you want to pirate from and then right click on it and click on View > Explore Structure. This will open the tree view of the GUI you clicked on. Depending on where you right clicked on the GUI it may not open the tree view up to the base portion of the GUI but you can right click in the tree view and select View > Up to move up until you get to the base if you need to. Yes, this is how we all do it even the developers who made the GUIs. Why? Because nobody makes GUIs enough to remeber exactly how they coded something and because it's easier and faster than actually doing it over from scratch. Good Luck, Brandon
__________________
thats not normal. |
The Following 3 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
qin tian (11-24-2008) |
#4
|
|||
|
|||
By the way, there is command, such as:
mainmenucommand("File|Open...") If I want to execute other menu item, such as "File|Save Model As...", what is the exact parameter. It seems that the parameter is not the same as the menu item. |
#5
|
||||
|
||||
Qin,
Look in the view tree and go to rootmenu/replace and simply look how it is currently done and then copy and adapt it to your own needs. Steven |
The Following User Says Thank You to Steven Hamoen For This Useful Post: | ||
qin tian (11-25-2008) |
#6
|
||||
|
||||
mainmenucommand() calls functions that were on Flexsim1's original menu. The menu has changed significantly since then, and the command hasn't been updated accordingly. Only certain things work for that command, and you can usually only find what those are by looking at what the code behind what various Flexsim buttons and menus are doing. Some of them use it; others do not.
|
The Following 5 Users Say Thank You to Phil BoBo For This Useful Post: | ||
RalfGruber (11-28-2008) |
#7
|
|||
|
|||
Quote:
|
#8
|
||||
|
||||
The solution I normally use is to search through the acitve views and check if the node exists. I compare the names, but because the node name is the name plus a number I just compare the beginning of the name.
Maybe there is a better solution, which I do not know. I use the following code: Code:
//SEARCH THROUGH ALL ACTIVE VIEWS for(int iContentCounter = 1; iContentCounter <= content(node("/active",views())); iContentCounter++ ) { //IF NAME EQUALS SPECIFIC NAME if(comparetext("MyGUI",stringcopy(getname(rank(node("/active",views()),iContentCounter)),1,5) )) { msg("MyGUI","MyGUI already open!"); break; } }
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following 2 Users Say Thank You to Tom David For This Useful Post: | ||
zhang xin (01-02-2010) |
#10
|
||||
|
||||
I woud just name one GUI MyGUI1 and the other MyGUI2 and change the stringcopy to 1,6 and make two if-statements.
Or name the GUI depending on the object like MyGUI_ObjectName. And change the stringcopy and compare the object name with the GUI name cut with stringcopy. This would be a more general solution. I am sure there are situations where some solutions might not working, but normally there is an "easy" solution.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
#11
|
|||
|
|||
Hi,
If you only want to have one instance of a GUI and activate it when you call the GUI for the second time, I am using this code: Code:
//if window is already opened, just activate instead of making another one. setcurrent(checkforexistingview(c)); if(objectexists(current)) { makeactive(current); destroyobject(c); return(0); } Create a node in the GUI called OnPreOpen and add the code first. Lars-Olof |
The Following User Says Thank You to Lars-Olof Leven For This Useful Post: | ||
Tom David (01-03-2010) |
#12
|
||||
|
||||
Lars-Olof,
Thanks for your hint and I checked in my model template the PreOpen node and found that I am using a command to do the job. In other words is there a command to do the job: standardpreopen(obj object) Description: For developer use. Queries if there are any open windows that are the same as the current window being opened. If so, then the current window is closed. Example:standardpreopen(c) So the easiest way is to use standardpreopen(c); in the PreOpen node.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following User Says Thank You to Tom David For This Useful Post: | ||
Lars-Olof Leven (01-04-2010) |
#14
|
|||
|
|||
Hi,
Change the code for your button openGUI 2: Code:
From: createview("MAIN:/project/model/Tools/GUIs/GUI 2"); To: createview("MAIN:/project/model/Tools/GUIs/GUI 2","MAIN:/project/model/Tools/GUIs/GUI 2"); Lars-Olof |
The Following 3 Users Say Thank You to Lars-Olof Leven For This Useful Post: | ||
zhang xin (01-04-2010) |
Thread | Thread Starter | Forum | Replies | Last Post |
error:Unable to open storage set. make sure the file exists. | qin tian | Q&A | 3 | 11-17-2008 01:05 PM |
How to get a full path of the current open Flexsim model file. | Regan Blackett | Tips and Tricks | 7 | 04-17-2008 10:39 AM |