octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60153] uicontrol pushbutton has different beh


From: Rik
Subject: [Octave-bug-tracker] [bug #60153] uicontrol pushbutton has different behavior for 'Value' field from Matlab
Date: Wed, 3 Mar 2021 12:18:26 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36

Follow-up Comment #4, bug #60153 (project octave):

Okay, so this looks less dire than I thought.  The important thing is that
both Octave and Matlab run callbacks on the ButtonRelease event.  The exact
ordering of when object properties are updated, and when graphics callbacks
are executed, seems implementation dependent.

For most of the uicontrols this won't matter.  For example, a slider that you
move to a new position.  The "Value" property is unchanged by a ButtonRelease
event so it doesn't matter when the "Callback" function is exactly executed. 
However, for the various button types it might.

What does Matlab do with this code?


function mycb (h, e)
  get (h, 'value')
end

close all
h = uicontrol ('style', 'checkbox', 'string', 'Box1', 'callback', @mycb); 


Now, click and hold the mousebutton on the checkbox.  When you release the
mouse, is the "Value" field that is printed always the previous value of the
checkbox or the value that the checkbox has just changed to?

For example, if the checkbox is blank and you click on it the Value field
printed will either be '0' (last value) or '1' (the checked state that it is
changing to).

For Octave, the answer is definite.  Octave updates values, and then runs
callbacks, so the answer printed will be '1'.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60153>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]