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 04-11-2011
Chris Moon's Avatar
Chris Moon Chris Moon is offline
Flexsim User
 
Join Date: Feb 2011
Location: Atlanta
Posts: 14
Downloads: 18
Uploads: 0
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 112
Chris Moon is on a distinguished road
Question GUI Combo Box Update

Hello.
I have a question about how to update a combo box on the GUI.

For example, in my model, I have two options (A and B) for the combo box that update a global variable that effects the processes of the model. By default it shows A because A is the first choice. If I choose B, the code associated with B automatically executes the way I want it to. I run the model and it works fine.

If I close the GUI, and reopen it, the combo box shows A, but the actual variable is still set to B. This said, if I run the model, it looks like it is running A but is actually running B.

How can I make the combo box update its view to the currently defined variable whenever you reopen it?

Also, is it possible to make an 'apply' button so the variables only update whenever I press apply?
Likewise, is it possible to make a 'reset' button that resets the variables (and their displays in the combo boxes) to predefined default values?

Thank you.
  #2  
Old 04-12-2011
Chris Moon's Avatar
Chris Moon Chris Moon is offline
Flexsim User
 
Join Date: Feb 2011
Location: Atlanta
Posts: 14
Downloads: 18
Uploads: 0
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 112
Chris Moon is on a distinguished road
Default

For example, in the attached image when "5" is selected for "Number of Registers Open" my model automatically shows 5 registers. If I close the Model Control GUI and open it up again, the combobox shows the default "1" for the "Number of Registers Open," but my model still shows 5 registers. Is there any way to insert a command anywhere so that when the Model Control GUI is opened again, the combobox shows the number of register in the model?
Attached Thumbnails
Click image for larger version
Name:	gui.jpg
Views:	133
Size:	11.7 KB
ID:	1346   Click image for larger version
Name:	guiTree.jpg
Views:	173
Size:	24.7 KB
ID:	1347  
  #3  
Old 04-12-2011
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default

One way:

1. Add an OnOpen attribute to your main GUI object.
2. Write code to determine which listed item the combobox should be pointing to in terms of its rank. For example if your combobox normally sets the value of a global variable, then OnOpen read the current value and determine which item rank in the combobox this value corresponds to. In your case you are lucky that the item value and the item rank are the same.
3. Obtain a reference to the combobox location in the GUI structure
4. Set itemcurrent attribute of the combobox
5. Call comborefresh on the combobox.

In the screenshot below I show 3 different combobox locations, but I skipped step 2 and simply set all itemcurrent to the 3rd item in the list which is "c" in this case.

ex.
treenode combo = node("/combobox1",c);
set(itemcurrent(combo),3);
comborefresh(combo);

In the attached model the GUI is linked to the Model Control button.
Attached Thumbnails
Click image for larger version
Name:	comborefresh in OnOpen.jpg
Views:	171
Size:	19.9 KB
ID:	1349  
Attached Files
File Type: zip comborefresh in OnOpen of GUI.zip (10.6 KB, 140 views)

Last edited by Kris Geisberger; 04-12-2011 at 11:40 PM. Reason: attached model
The Following User Says Thank You to Kris Geisberger For This Useful Post:
Chris Moon (04-13-2011)
  #4  
Old 04-14-2011
Chris Moon's Avatar
Chris Moon Chris Moon is offline
Flexsim User
 
Join Date: Feb 2011
Location: Atlanta
Posts: 14
Downloads: 18
Uploads: 0
Thanks: 8
Thanked 0 Times in 0 Posts
Rep Power: 112
Chris Moon is on a distinguished road
Default

Dear Kris Geisberger,
I indeed appreciate your help.
You solved all the problems I had.
Thank you again.


Thread Thread Starter Forum Replies Last Post
update flexsim 5.10,can not save model LINWEIXU Q&A 5 01-31-2011 07:11 AM
Update of global variables BenjaminBuecklein Q&A 4 11-18-2008 03:43 AM
Update Flexsim.com Lolke Koopmans Marketing and Sales Information 12 10-17-2008 02:09 PM
can I use an edit box entry to update multiple labels? KelvinHo Q&A 10 03-28-2008 07:17 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.