question

Martin K5 avatar image
0 Likes"
Martin K5 asked Martin K5 commented

How to access an object on which I click in GUI?

Hi,


I would like to ask, how can I access an object (flowItem) on which I click in GUI? I know that it can be access through button click with "objectfocus", but is it also possible to get this reference based on OnOpen trigger, or based on static text?


Thank you.

FlexSim 23.2.0
guitriggerreferenceclick
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
2 Likes"
Jason Lightfoot answered Martin K5 commented

The question is when do you want to access the click.

You can place OnClick behaviour on the flowitem:

1711550152845.png

Or if you want to find the highlighted object in the first perspective view:

Object persp=views().find("active>Documents/Perspective/1+/~");
return selectedobject(persp);

Example model: ItemClick.fsm


Or are you looking to implement a sampler (pipette icon)?



1711550152845.png (16.0 KiB)
itemclick.fsm (38.5 KiB)
· 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.

Martin K5 avatar image Martin K5 commented ·
Thank you,


the provided code (located in the OnClick trigger) works perfectly even in combination with GUI.

0 Likes 0 ·