bugGNU Octave - Bugs: bug #55230, "uibuttongroup" doesn't...

 
 

bug #55230: "uibuttongroup" doesn't act on setting properties

Submitted by:  Markus Mützel <mmuetzel>
Submitted on:  Sat 15 Dec 2018 11:42:08 AM UTC
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  In Progress Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Thu 21 Nov 2019 05:59:39 PM UTC, comment #8: 

@Markus: I made some small edits and checked in the code here: https://hg.savannah.gnu.org/hgweb/octave/rev/5b9067c17e4b.

The biggest was commenting out the BIST test cases until we have a way for the tests to 1) take less time and 2) not fail under heavy load.

Rik <rik5>
Project Administrator
Sun 17 Nov 2019 01:14:13 PM UTC, comment #7: 

Sorry for taking so long. I forgot about this bug.
The attached patch is rebased to the current tip.
I had to increase the pause in the tests to 0.5 seconds. But it still sometimes fails under heavy load.

(file #47879)

Markus Mützel <mmuetzel>
Project Member
Tue 12 Mar 2019 06:32:03 PM UTC, comment #6: 

@Markus: I went to review your patch but it no longer applies cleanly to the dev branch.  Could you refresh?  Sorry I waited so longe.

Rik <rik5>
Project Administrator
Sat 29 Dec 2018 07:19:30 PM UTC, comment #5: 

The attached changeset adds the "listeners" that update the respective properties.

For some reason, I had to add a "pause (0.1)" each time after changing a property in the BISTs or the tests would fail.

(file #45771)

Markus Mützel <mmuetzel>
Project Member
Mon 17 Dec 2018 04:41:03 PM UTC, comment #4: 

For the first set of tests, it may be that uibuttongroup needs a "listener" on its own "children" property.  In Octave,

octave:1> hf = figure ('visible', 'off');
octave:2> bg = uibuttongroup (hf);
octave:3> get (bg, 'selectedobject')
ans = [](0x0)
octave:4> b1 = uicontrol (bg, 'style', 'radiobutton');
octave:5> get (bg, 'selectedobject')
ans = [](0x0)

If I try the same code in Matlab then as soon as the uibuttongroup has a single child it becomes the 'selectedobject'.

That would explain the first two false results.

Rik <rik5>
Project Administrator
Mon 17 Dec 2018 08:28:12 AM UTC, comment #3: 

In Matlab, I see all true for both code blocks.
I will try whether moving the buttons changes anything for Octave.

Markus Mützel <mmuetzel>
Project Member
Sun 16 Dec 2018 02:35:10 AM UTC, comment #2: 

Take a look at libgui/graphics/ButtonGroup.cc.

There is a function there  

ButtonGroup::update (int pId)

which handles what updates are processed by the ButtonGroup object.

There is a case for SELECTEDOBJECT so some of this code should work.

Also, I think you want to position the radio buttons so they aren't on top of each other.  It may be that having two buttons exactly on top of each other is confusing Octave.

Rik <rik5>
Project Administrator
Sat 15 Dec 2018 12:11:32 PM UTC, comment #1: 

The attached patch essentially adds the following as tests for uibuttongroup (here in a Matlab compatible form):

hf = figure ('visible', 'off');
bg = uibuttongroup (hf);
b1 = uicontrol (bg, 'style', 'radiobutton');
b2 = uicontrol (bg, 'style', 'radiobutton');
pause (0.1);
isequal (get (bg, 'selectedobject'), b1)
isequal (get (b1, 'value'), 1)
isequal (get (b2, 'value'), 0)
% select radiobutton 2
set (bg, 'selectedobject', b2);
pause (0.1);
isequal (get (b1, 'value'), 0)
isequal (get (b2, 'value'), 1)
% set radiobutton 1
set (b1, 'value', 1);
isequal (get (bg, 'selectedobject'), b1)
pause (0.1);
isequal (get (b1, 'value'), 1)
isequal (get (b2, 'value'), 0)
% unset all radiobuttons
set (bg, 'selectedobject', []);
pause (0.1);
isequal (get (b1, 'value'), 0)
isequal (get (b2, 'value'), 0)
close (hf);

hf = figure ('visible', 'off');
bg = uibuttongroup (hf);
b1 = uicontrol (bg, 'style', 'togglebutton');
b2 = uicontrol (bg, 'style', 'togglebutton');
pause (0.1);
isequal (get (bg, 'selectedobject'), b1)
isequal (get (b1, 'value'), 1)
isequal (get (b2, 'value'), 0)
% select togglebutton 2
set (bg, 'selectedobject', b2);
pause (0.1);
isequal (get (b1, 'value'), 0)
isequal (get (b2, 'value'), 1)
% set togglebutton 1
set (b1, 'value', 1);
isequal (get (bg, 'selectedobject'), b1)
pause (0.1);
isequal (get (b1, 'value'), 1)
isequal (get (b2, 'value'), 0)
% unset all togglebuttons
set (bg, 'selectedobject', []);
pause (0.1);
isequal (get (b1, 'value'), 0)
isequal (get (b2, 'value'), 0)
close (hf);

I haven't tried it with Matlab yet. But I would expect all isequals to return true.

(file #45672)

Markus Mützel <mmuetzel>
Project Member
Sat 15 Dec 2018 11:42:08 AM UTC, original submission:  

While it looks like a uibuttongroup works correctly when interacting with its radiobutton or togglebutton children with the mouse, it doesn't seem react on setting the respective properties.

I'll upload a changeset which adds some failing tests as soon as  have a bug number.

Markus Mützel <mmuetzel>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #47879:  bug55230_uibuttongroup_update_v2.patch added by mmuetzel (9KiB - application/octet-stream)
file #45771:  bug55230_uibuttongroup_update.patch added by mmuetzel (8KiB - application/octet-stream)
file #45672:  bug55230_uibuttongroup_BIST.patch added by mmuetzel (4KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-11-21 rik5 StatusPatch Submitted => In Progress
    2019-11-17 mmuetzel Attached File- => Added bug55230_uibuttongroup_update_v2.patch, #47879
    2018-12-29 mmuetzel Attached File- => Added bug55230_uibuttongroup_update.patch, #45771
        StatusConfirmed => Patch Submitted
    2018-12-17 rik5 StatusNone => Confirmed
    2018-12-15 mmuetzel Attached File- => Added bug55230_uibuttongroup_BIST.patch, #45672

    Back to the top


    Powered by Savane 3.9