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

2 vues (au cours des 30 derniers jours)
Gireg
Gireg le 25 Mar 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!

Réponses (2)

MarkB
MarkB le 28 Mar 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 le 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.

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by