help fast pls / buttondwnfcn

2 visualizzazioni (ultimi 30 giorni)
Max Müller
Max Müller il 28 Set 2014
Risposto: Geoff Hayes il 28 Set 2014
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;

Risposta accettata

Geoff Hayes
Geoff Hayes il 28 Set 2014
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.

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by