[Scilab-users] Long delay before callback

Stéphane Mottelet stephane.mottelet at utc.fr
Tue Sep 20 14:06:19 CEST 2022


Depending on what you want to do, some have to be interruptible, and 
some have to prioritary. For example in the following example, where you 
can start/stop incrementing a slider,  the "start" callback must be 
interruptible but the "stop" callback must be prioritary :

function stop() set("button","userdata",%t) endfunction function start() 
try but = get("button") but.string="stop" but.callback="stop()" 
but.callback_type=10; but.userdata = %f; sl = get("slider"); for 
t=tuser(tuser>=sl.value) if but.userdata break; end sl.value = t; 
title(msprintf("t=%g",t)) end but.callback_type=0; 
but.callback="start()" but.string="start" catch end endfunction 
tuser=0:0.001:1; sl=uicontrol("style","slider",... "tag","slider",... 
"units","normalized",... "position",[0.1 0 0.9 0.05],... "background",[1 
1 1],... "min",t(1),"max",t($),"sliderstep",(t(2)-t(1))*[1 1]); 
but=uicontrol("style","pushbutton",... "units","normalized",... 
"position",[0 0 0.1 0.05],... "string","start",... "tag","button",... 
"string","start",... "callback","start()")

Le 20/09/2022 à 13:41, Stefan Du Rietz a écrit :
> Hi, thanks.
> Yes, but it doesn't seem to make much difference. And I don't exactly 
> understand the different options.
>
> Stefan
>
>
> On 2022-09-20 12:03, Stéphane Mottelet wrote:
>> Hi,
>>
>> Did you try to play wth callback_type (interruptible or not) ?
>>
>> Le 20/09/2022 à 10:48, Stefan Du Rietz a écrit :
>>> Hello Stéphane,
>>>
>>> a minimal example works OK all the time ...
>>>
>>> So, there must be something in my rather complex GUI environment, 
>>> with many private functions, that does not. But since I get no 
>>> warning or error messages, I don't know how to proceed.
>>>
>>> Can the delays be due to timeouts?
>>>
>>> Regards
>>> Stefan
>>>
>>>
>>> On 2022-09-19 08:45, Stéphane Mottelet wrote:
>>>> Hello Stefan,
>>>>
>>>> Can you  give a minimal and reproductible example ?
>>>>
>>>> S.
>>>>
>>>> Le 18/09/2022 à 12:18, Stefan Du Rietz a écrit :
>>>>> Hello,
>>>>> I have a problem with GUI: when I choose a menu or press a button, 
>>>>> sometimes it takes half a minute before the callback starts. 
>>>>> Scilab is then using 100% of CPU, according to Bash top. I suppose 
>>>>> it has something to do with Java? What can I do?
>>>>>
>>>>> --> ver
>>>>>  ans  =
>>>>>   "Scilab Version: "                    "6.1.1.1626343451"
>>>>>   "Operating System: "                  "Linux 5.4.0-125-generic"
>>>>>   "Java version: "                      "1.8.0_292"
>>>>>   "Java runtime information: "          "OpenJDK Runtime 
>>>>> Environment (build 1.8.0_292-b10)"
>>>>>   "Java Virtual Machine information: "  "OpenJDK 64-Bit Server VM 
>>>>> (build 25.292-b10, mixed mode)"
>>>>>   "Vendor specification: "              "Oracle Corporation"
>>>>>
>>>>> Regards
>>>>> Stefan
>>>>> _______________________________________________
>>>>> users mailing list - users at lists.scilab.org
>>>>> Click here to unsubscribe: 
>>>>> <mailto:users-unsubscribe at lists.scilab.org>
>>>>> http://lists.scilab.org/mailman/listinfo/users
>>>>
>>> _______________________________________________
>>> users mailing list - users at lists.scilab.org
>>> Click here to unsubscribe: <mailto:users-unsubscribe at lists.scilab.org>
>>> http://lists.scilab.org/mailman/listinfo/users
>>
> _______________________________________________
> users mailing list - users at lists.scilab.org
> Click here to unsubscribe: <mailto:users-unsubscribe at lists.scilab.org>
> http://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/20220920/9fc78dd4/attachment.htm>


More information about the users mailing list