Why does graphics/content freeze even if I slightly move the mouse while clicking inside the trough of "uicontrol" with "slider" style in MATLAB R2022b?

4 visualizzazioni (ultimi 30 giorni)

I have a graphical element (content) that updates as I move the slider ("uicontrol" with "slider" style).Clicking on the left/right button of the slider works as intended - the slides moves and the graphics change as intended with the slider movement.However, if I click inside the slider trough, even the slightest mouse movement can cause the graphics to freeze, but the slider still moves to its intended position 
How can I make the slider resistant to mouse movements so that the graphics (content) changes as expected while I click inside the slider trough to move the slider?

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 13 Mar 2025
This is an expected behavior with "slider" style "uicontrol".
If the mouse is clicked inside the trough of the slider, slight mouse movements can cause the content (graphics in this case) to freeze, while the slider still continues to move to its intended position. 
To resolve this issue, remove callbacks from the "uicontrol" component. Instead, add a listener with the 'ContinuousValueChange' event:
>> addlistener(<"uicontrol" with "slider" style component>, 'ContinuousValueChange',@<callback function>)
This change also adds the ability to scroll by grabbing & moving the slider to update contents (graphics) dynamically.

Più risposte (0)

Categorie

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

Prodotti


Release

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by