[Scilab-users] uicontrol, callbacks, handle not valid anymore

Serge Steer serge.steer at inria.fr
Wed Jul 10 22:25:24 CEST 2013


It is not a Scilab problem.
It is better to preserve the plotfr handle in the user_data gui, so even if plotfr is cleared
it can be retreived.

Moreover I had improved a little your code to makemove more smooth (avoid clf and udpdate the polyline and axes bounds

Serge Steer

----- Mail original -----
> De: "Sandro Hardy" <sandro.hardy at kom.tu-darmstadt.de>
> À: "International users mailing list for Scilab." <users at lists.scilab.org>
> Envoyé: Mercredi 10 Juillet 2013 20:24:19
> Objet: [Scilab-users] uicontrol, callbacks, handle not valid anymore
> 
> Hello everybody,
> 
> I am trying to create a GUI to scroll trough a signal using a slider.
> 
> I always get a "Handle not valid anymore", looking as shown below. Is
> this a bug in Scilab?
> 
> Using the arrows works fine, but dragging the slider with the mouse
> produces the error. Maybe it is a timing/scheduling problem in
> Scilab.
> 
> Please find example code below, if you like to reproduce this.
> 
> I would be happy about any hint.
> Best wishes
> Sandro
> 
> 
> ------------------------------------------
> !--error 999
> set: diese Handhabung ist nicht mehr gültig.
> at line       4 of function generic_i_h called by :
> at line       2 of function %s_i_h called by :
> at line     381 of function plot called by :
> at line       7 of function slider_update called by :
> df0:13fc997f6bd:-2f41");slider_update;if exists(
> while executing a callback
> at line     352 of function plot called by :
> at line       7 of function slider_update called by :
> df0:13fc997f6bd:-2f41");slider_update;if exists(
> while executing a callback
> at line       2 of function %h_e called by :
> at line      33 of function findobj called by :
> at line       2 of function slider_update called by :
> df0:13fc997f6bd:-2f41");slider_update;if exists(
> while executing a callback
> 
> ------------------------------------
> clear
> clearglobal
> 
> maxv=1000;
> x=1:0.1:maxv;
> y=sin(x);
> 
> function slider_update()
>      slider=findobj('Tag', 'plot_slider')
>      start=round(slider.Value*0.9);
>      r=start:start+100;
>      scf(plotfr)
>      clf(plotfr)
>      plot(x(r),y(r));
> endfunction
> 
> // Create a figure
> f = figure("Figure_name", 'Uicontrols Slider',...
>      "Position",[100 100 510 510],...
>      "BackgroundColor",[0.9 0.9 0.9],...
>      "Tag", "uicontrols_demo_figure");
> // Frame containing a slider
> 
> plotfr = figure("Figure_name", 'Uicontrols Plot',...
>      "Position",[100 100 510 510],...
>      "BackgroundColor",[0.9 0.9 0.9],...
>      "Tag", "uicontrols_demo_figure2");
> 
> slider = uicontrol(f, "Position", [20 50 390 15], ...
>      "Style", "slider", ...
>      "Min", 0, ...
>      "Max", 900, ...
>      "Value", 0, ...
>      "SliderStep", [10 100], ...
>      "Tag", "plot_slider", ...
>      "Callback", "slider_update");
> --------------------------------------------------
> --
> Sandro Hardy, M.Sc.
> 
> Multimedia Communications Lab (KOM)
> http://www.kom.tu-darmstadt.de
> Technische Universitaet Darmstadt
> Dept. of Electrical Engineering & Information Technology
> tel: +49 6151 16 75164 fax: +49 6151 16 6152
> E-Mail: Sandro.Hardy at kom.tu-darmstadt.de
> postal address: TU Darmstadt, FB 18, KOM, Rundeturmstr. 10, S320/106
> D-64283 Darmstadt, Germany
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gui.sce
Type: application/octet-stream
Size: 1236 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20130710/5db9cc0f/attachment.obj>


More information about the users mailing list