Get the Simulink block's handle of the block under the mouse

1 Ansicht (letzte 30 Tage)
Gireg
Gireg am 25 Mär. 2011
Hi,
Does anyone know if it's possible to get the block's handle of the current block under the mouse (even if I don't select it by click)? I would like to create a drag'n drop interface with Simulink, so I need to know which Simulink block is under the mouse when user release the mouse. It seems "gcs" is not able to do it -> It need to click the block.
Thank you!

Antworten (2)

MarkB
MarkB am 28 Mär. 2011
I don't believe that there is any way to detect a block that you are hovering over but haven't clicked. It is possible to detect the currently clicked block using "gcb". You can also find the currently selected block by executing "find_system( 'Type', 'Block', 'Selected', 'on' );", but this will return all selected blocks (parent systems of the currently selected block count as "selected" as well in this case).

Fangjun Jiang
Fangjun Jiang am 23 Mai 2011
gcbh() is the command to get the block handle if the block is selected. You might want to refer to this post where I explained that it should be possible if certain API of Simulink is open to the user. But so far, no Mathworkers has answered my question.

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by