help fast pls / buttondwnfcn
2 ビュー (過去 30 日間)
古いコメントを表示
hey Guys, I have create an text object using uicontrol and set the 'buttondownfcn' to be @Click. Now the problem is: it works only on a right click. If i click with the left mouse button on it, it does nothing.....I dont get why. In Prevouis programs it work perfectly.
ChosenShot = [num2str(InputData.shot),' ','Closest',' ','Amp.'];
Tag = [num2str(InputData.shot),'_ClosestAmp'];
uicontrol('style','text',buttondownfcn',@Click)
Counter = Counter +1;
0 件のコメント
採用された回答
Geoff Hayes
2014 年 9 月 28 日
If the uicontrol's "Enable" property is set to "on", the ButtonDownFcn callback executes when you click the right or left mouse button in a 5-pixel border around the uicontrol or when you click the right mouse button on the control itself.
I verified the above with your example (R2014a). If I left-clicked within the 5-pixel border around the text box, then the callback fired. If I right-clicked within the 5-pixel border around the text box or within the text box, then the callback fired.
The other post also goes on to say that
If the uicontrol's "Enable" property is set to "inactive" or "off", the ButtonDownFcn executes when you click the right or left mouse button in the 5-pixel border or on the control itself.
I took your code, and modified it as follows
h=uicontrol('style','text','buttondownfcn',@Click) ;
set(h,'Enable','off');
Once I ran the above, I could left-click or right-click within the text box (uicontrol) and observe that the callback fired.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!