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

2 visualizzazioni (ultimi 30 giorni)
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!

Risposte (2)

MarkB
MarkB il 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 il 23 Mag 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.

Categorie

Scopri di più su Programmatic Model Editing in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by