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

조회 수: 2 (최근 30일)
Gireg
Gireg 2011년 3월 25일
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!

답변 (2개)

MarkB
MarkB 2011년 3월 28일
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 2011년 5월 23일
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.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by