[Scilab-users] uicontrol, callbacks, handle not valid anymore [SOLVED]
Antoine Monmayrant
antoine.monmayrant at laas.fr
Thu Jul 11 14:37:49 CEST 2013
On 11/07/2013 14:08, Sandro Hardy wrote:
> Dear Serge,
>
> thank you very much for your suggestion and the improvement of the
> code. It works fine now.
>
> I just figured out that Scilab crashes, even with your code, if "Min",
> 0, and I move the mouse to the left very fast (something I do not
> understand, because it is not always the case and only if I move the
> mouse really fast) but I can avoid this just keeping it at 1.
I just played a bit with your code and also experienced a crash
(segfault or recurrence problem).
This definitely is a bug: sure there is something wrong in your code
(trying to access y(start) with start=0), but this should just result in
an error message, and not crash scilab.
You should probably fill a bug report with your code as a test case.
Cheers,
Antoine
>
> So thanks again
> Sandro
>
> Am 10.07.2013 22:25, schrieb Serge Steer:
>> 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
>>>
>>>
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
More information about the users
mailing list