help fast pls / buttondwnfcn
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Max Müller
el 28 de Sept. de 2014
Respondida: Geoff Hayes
el 28 de Sept. de 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;
0 comentarios
Respuesta aceptada
Geoff Hayes
el 28 de Sept. de 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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!