[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: GUI radio button issue
From: |
Richardson, Anthony |
Subject: |
RE: GUI radio button issue |
Date: |
Thu, 8 Nov 2018 13:37:32 +0000 |
I am top posting because the last post in this thread (the one containing code)
has no context.
The callback function is called for the deselected button and the newly
selected button (add a line to display Asm in your callback and you will see
that it is displayed twice every time you select a new button). An easy fix is
to change your callback to:
function cbackfcn(src, eventdata, ax1, Asm)
if(get(src,"value") == 1)
imagesc(ax1, Asm);
end
endfunction
This ensures that the image corresponding to the newly selected button is shown.
Tony Richardson
> Sent: Wednesday, November 7, 2018 6:51 PM
> To: address@hidden
> Subject: Re: GUI radio button issue
>
> % Args: fHandle is a figure handle.
> % AsC and AsO are numerical matrices with the same size.
>
> function guitest(fHandle, AsC, AsO)
>
> if (!size_equal(AsC, AsO))
> error("Arguments must have equal sizes"); end
>
> set(fHandle,'Position',[300 100 560 880]);
>
> ax1 = axes;
>
> set(ax1, 'Position', [0.13 0.21 0.775 0.715]);
>
> gp = uibuttongroup(fHandle, 'Position', [0.05 0.02 0.15 0.15]);
>
> b1 = uicontrol(gp, "Style", "Radiobutton", "String", "1", ...
> "Position", [0 67 100 32], ...
> "Value", 1, ...
> "CreateFcn", address@hidden, ax1, AsC}, ...
> "Callback", address@hidden, ax1, AsC});
>
> b2 = uicontrol(gp, "Style", "Radiobutton", "String", "2", ...
> "Position", [0 34 100 32], ...
> "Callback", address@hidden, ax1, AsO});
>
> b3 = uicontrol(gp, "Style", "Radiobutton", "String", "3", ...
> "Position", [0 1 100 32], ...
> "Callback", address@hidden, ax1, AsC-AsO}); endfunction
>
> function cbackfcn(src, eventdata, ax1, Asm)
>
> imagesc(ax1, Asm);
>
> endfunction
>
>
>
>
>
> --
> Sent from: http://octave.1599824.n4.nabble.com/Octave-General-
> f1599825.html
>