question

Marcos Tpa avatar image
3 Likes"
Marcos Tpa asked Marcos Tpa edited

How to link a combobox with an editbox ? (GUI)

Hi,

I'm building a GUI for this project and I'm trying to use a combobox that has items that represents the rows of a global table and a editbox that I want to show the quantity of the item based on the global table and according to the choice the user made, so that the user can change the value in the GUI and consequently in the global table. I don't want to enumarete all the options so it doesn't consumes a lot of space in my GUI's layout, that's why I'm using a combobox. Here some pictures of the actual situation:

1650387999258.png1650388029895.png

For example:

1. if the client chooses the operator type 1 then the editbox should show 1 because it is the quantity that is in the global table and if the user changes the value with the spinner, lets say to 3, so in the global table the value on the column quantity should also change to 3 for the operator type 1.

2. if the client chooses the operator type 11 then the editbox should show 2 because it is the quantity that is in the global table and if the user changes the value with the spinner, lets say to 1, so in the global table the value on the column quantity should also change to 1 for the operator type 11.

So what I was trying to do was create a coldlink or coldlinkname with a variable named "row" that gets de itemcurrent of the combobox, as it returns an integer and it can represent the number of the line, and put this variable into the path because the number of the line changes when the user changes the item in the combobox. However this didn't work, and I don't know how to solve this problem. Can someone help me, please?

test GUI.fsm

FlexSim 22.0.1
gui
1650387999258.png (7.4 KiB)
1650388029895.png (11.6 KiB)
test-gui.fsm (26.5 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Jason Lightfoot avatar image
3 Likes"
Jason Lightfoot answered Jason Lightfoot commented

Here's an example using the apply button and a coldlinkx for the path to the table cell node containing the value. You need the path to be relative to the active GUI instance, not the GUI template you define in tools. Then the addition of an OnSelect node on the combobox refreshes the view of the edit box, causing any change in itemcurrent to be reflected in the edit box value displayed.

test-gui_jl.fsm


test-gui-jl.fsm (26.4 KiB)
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Marcos Tpa avatar image Marcos Tpa commented ·
Is there a way to make the spinner work with the edit box, so the user can change the quatity value using it? I tried here but it seems to not work anymore, I don't know why.
1 Like 1 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Marcos Tpa commented ·

Sorry for the delay. Here's a version with the spinner.

test-gui_jl2.fsm


1 Like 1 ·
test-gui-jl2.fsm (29.2 KiB)
Marcos Tpa avatar image Marcos Tpa commented ·
Thank you very much! It helped me a lot!
0 Likes 0 ·