Ok, I think I got it. In my example gcbo() is a handle of checkbox which is in a frame which is in another frame, so I should recall different level in a function cbfun().

Thanks a lot for your help.

Iza





W dniu 19.04.2018 14:35, Stéphane Mottelet napisał(a):
Hello Iza,

If your uicontrol and your Axes are children of the same Figure, you
can recover the Axes relatively, like in this small example:

function cbfun()
    h=gcbo();
    ax=h.parent.children(2);
    ax.children(1).visible=h.value;
endfunction

scf(0)
clf
uicontrol("style","checkbox","backgroundcolor",..
[1 1 1],"value",1,"callback","cbfun");
t=linspace(0,2*%pi,100);
plot(t,sin(t))
plot(t,cos(t))

scf(1)
clf
uicontrol("style","checkbox","backgroundcolor",..
[1 1 1],"value",1,"callback","cbfun");
t=linspace(0,2*%pi,100);
plot(t,sin(t))
plot(t,cos(t))
 S.

Le 19/04/2018 à 13:28, Izabela Wójcik-Grząba a écrit :

Hello,

In my programme in Scilab I create a figure with one plot and a
checkbox which turns on/off the visibility of some parts of the
plot. The callback function of checkbox works fine when there is
only one figure, but when there are, for example, two figures the
callback works on the current figure not the one I want to change
(because I use gca). Here is the part with definition of the
checkbox and callback function:

box_num_w=uicontrol(przel,"style","checkbox","backgroundcolor",..
[1 1 1],"value",1,"string","Numery
węzłów","callback","niewidoczne_num_w");

function niewidoczne_num_w()
a=gca;
if get(gcbo,"value")==0 then
value=get(gcbo,"value")
a.children(7).visible="off";
else
a.children(7).visible="on";
end
endfunction

I was trying to change the definition of a by using gcbo but none of
my versions works.
I would appreciate any help.

Kind regards,
Iza
_______________________________________________
users mailing list
users@lists.scilab.org

https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to