[Scilab-users] Callback in checkbox for multiple figures
Stéphane Mottelet
stephane.mottelet at utc.fr
Thu Apr 19 14:35:12 CEST 2018
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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180419/0496ac3a/attachment.htm>
More information about the users
mailing list