question

Yokota T avatar image
0 Likes"
Yokota T asked Yokota T commented

Viewfocus target of the GUI changes unintentionally

Hello all,

I am trying to create a custom GUI.

I set ">special/guifocusclass" attribute of the object, so that when I double-click on the object, the custom GUI is displayed.

The viewfocus attribute of the GUI is used to reference the object from the GUI.

However, the path registered in the viewfocus attribute of the GUI refers to the rank of the object. 1674113462988.png


Therefore, if the rank changes because ConveyorSystem is inserted at the top, etc., the viewfocus target changes.

What is the best way to avoid this?

FlexSim 22.0.11
custom gui
1674113462988.png (3.3 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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Yokota T commented

Do you expect to actually make changes to the model that cause the rank to change while the GUI is open? In my mind a GUI that is attached to an object is mostly meant to only be open while actively making changes to that object. I would implement a more permanent control panel through the model input widgets in a dashboard.

With that said, I guess you could replace the object path with a static reference to the object in the OnOpen event of the GUI. Though this would of course slightly change how you access the object from the treenode.

1674115050787.png

1674115061311.png


1674115050787.png (3.1 KiB)
1674115061311.png (4.0 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.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·
You should be able to just change the data type to pointer for it to work automatically (should be the default really)
1 Like 1 ·
Yokota T avatar image Yokota T Jason Lightfoot ♦♦ commented ·

@Jason Lightfoot , Oh, thank you for sharing the simplest solution.

0 Likes 0 ·
Yokota T avatar image Yokota T commented ·

@Felix Möhlmann ,

Thank you for your response. It's helpful.

I would implement a more permanent control panel through the model input widgets in a dashboard.

I understand. I will be careful next time.

0 Likes 0 ·