as below shown ,in below picture I can create a method control. when I select the object the method will be executed, now I want to know if this can realize . how can a method control will be executed from the object was selected to unselected in 2D and in 3D model . how can realize ? thank you very much !
Well, you can observe the "select" - attribute.
The observer method will be triggered , when you select or deselect the object.
I guess, a way of selecting an object and triggering a method,
when you move the mouse away from the selected object isn't implemented.
What workaround probably could work, is wrapping the object in an 2. object (e.g. line, with tooltip method)
to observe moving away from 1. object. through the call of 2. tooltip method s. pic below.
In any case I'm curious about what this kind of functionality is meant for.
Trying to upload an v13 *.spp as attachment failed with following message
The contents of the attachment doesn't match its file type.
I guess this is the "deselect counterpart" to the 3D selection topic you posted a couple of days ago.
The question I had when I read that topic back then is the same as now: What do you want to do when an object is selected/deselected and could this also (or better) be done based on something other than the selection? (what that might be, depends on what you want to accomplish)
The feature once was added to Plant Simulation before there were interactive controls like checkboxes or buttons that could react to a click by running a method. Reacting on selecting something more or less emulated reacting on clicks.
I see where you are getting at.
This roughly corresponds to the behavior of a docked properties window in a couple of applications. So the properties window there changes its content depending on what is selected (e.g. if you modify an element in an MS Office product like PowerPoint).
What it immensely different here, and I would seriously think about that, is that, contrary to such a docked UI element which more or less stays in the focus background politely, a dialog will grab your input focus every time. So every time the dialog opens, it will take over the task of reacting to keyboard input. That might render annoying after a short time.
What I imagine as a workaround is writing an Observer method for the SimTime attribute of an EventController.
To have that work, you would need the simulation running, or alternatively, have a dummy simulation running while your actual simulation is not. But it could work.
In that Observer method, you then can write a code that periodically checks whether the SimTime has progress by a certain amount, say, 1 second or so, and if so, search for selected objects in the frame you want to examine or the one object whose selection you are interested in.
Honestly, personally, I probably would not do that at all. The standard workflow to open information about an object in a dialog is to write an open control (which will then react on double-clicking, e.g.). The dialog will remain open but the user can close it again whenever he wants.