question

Enrique Elizaga avatar image
0 Likes"
Enrique Elizaga asked Enrique Elizaga commented

How to update the chekbox initial value (in a GUI)

Hi all, I am using a control GUI. A checkbox value stores the value in a table. Peachy so far. The problem rises when I open the control, it does not reflect the current cell value. Im using a Gui because it allows the user to interact with tabs.

1654195170795.png

FlexSim 22.1.2
guicheckbox
1654195170795.png (215.2 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.

Jordan Johnson avatar image Jordan Johnson ♦♦ commented ·
How are you linking the global table value to the checkbox? A coldlink? A coldlinkx? Consider posting the original model, or a small example model with the same issue.
0 Likes 0 ·
Enrique Elizaga avatar image Enrique Elizaga Jordan Johnson ♦♦ commented ·

Oh sorry my bad. Here the sample model downsized.fsm .

0 Likes 0 ·
Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Enrique Elizaga, was Jordan Johnson's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Enrique Elizaga commented

Here is an updated version of the model:

sample-model-downsized_1.fsm

I added a coldlink to both checkboxes. You can read more about coldlinks here:
https://docs.flexsim.com/en/22.1/Reference/DeveloperAdvancedUser/GUIs/GUIViewAttributes/GUIViewAttributes.html#coldlink

Coldlinks allow the view to be refreshed (the value from the node is applied to the view) and applied (the value in the view is applied to the node). If you add a coldlink, most views know how to refresh and apply the value automatically.

The only exception is that your view doesn't have an OK or Apply button. So I added code to the OnPress of the checkbox to apply the link. Now, when you open the view, the boxes will be checked or unchecked, depending on what is in the table. When you check or uncheck the box, the table value will change to reflect what is in the box. Note that to see the change, you need to click on the table to get it to repaint.


· 1
5 |100000

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

Enrique Elizaga avatar image Enrique Elizaga commented ·
Thank you this solved the problem.
0 Likes 0 ·