[Scilab-users] Callback poorly reactive

Alexis Cros Alexis.Cros at promes.cnrs.fr
Fri Oct 13 17:45:19 CEST 2017


Ok I join a simplified example on which we can witness my problem.

It runs on Scilab 6.0.0.

Nice week end

Alexis


Le 13/10/2017 à 15:02, Alexis Cros a écrit :
> Good day,
>
> I made a  relatively complex HMI with Scilab which uses pushbuttons 
> with callbacks from uicontrol 'library'. Particularly, one pushbutton 
> is used to make visible or invisible a configuration window, which 
> also contains sliders with callbacks. The button to make visible or 
> invisible the windows is very poorly reactive (approx 30 quick click 
> to work), except if I don't change any slider parameter in the 
> configuration window.
>
> I have tested callback types 10 and 12 and the result is the same.
>
> Do someone has ideas to improve reactivity of pushbutton please?
>
> Have a good day
>
> Alexis
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 
Alexis Cros
PROMES - CNRS - UPR 8521
http://promes.cnrs.fr
+33 (0) 4 68 30 77 43

-------------- next part --------------
    
GUI_TEXT_SIZE = 0.025
   // Colors for GUI
WHITE = [1,1,1]
BLACK = [0,0,0]
RED = [1,0,0]
SKY_RED = [1, 0.5, 0.5]
GREEN = [0,1,0]
SKY_GREEN = [0.5,1,0.5]
BLUE = [0,0,1]
SKY_BLUE = [0.5,0.5,1]
YELLOW = [1,1,0]
SKY_YELLOW = [1,1,0.5]
CYAN = [0,1,1]
SKY_CYAN = [0.5,1,1]
MAGENTA = [1,0,1]
SKY_MAGENTA = [1,0.5,1]
GREY = [0.7,0.7,0.7]
GUI_COLOR = [ 0 0 0 ] 
    
gui_polarplot = figure(  'Position', [0 0 1500 800],..
                        'BackgroundColor', WHITE,..
                        'Figure_name', 'SR-5000N E|L Band Directional Visualization')
toolbar(gui_polarplot, "off");

plot2d()

quit_pb = uicontrol(  'Parent', gui_polarplot,..
                        'Style', 'pushbutton',..
                        'Units', 'normalized',..
                        'Position', [0.92,0.01,0.06,0.03],..
                        'String', 'Exit',..
                        'BackgroundColor', GREY,..
                        'FontUnits', 'normalized',..
                        'FontSize', GUI_TEXT_SIZE/1.5,..
                        'Max', 1,..
                        'Min', 0,..
                        'Callback_Type', 10,..
                        'Callback','quit()')       
    
a = gca()

//a.isoview = 'on'

next_pb = uicontrol(  'Parent', gui_polarplot,..
                        'Style', 'pushbutton',..
                        'Units', 'normalized',..
                        'Position', [0.84,0.01,0.06,0.03],..
                        'String', 'OK',..
                        'BackgroundColor', SKY_GREEN,..
                        'FontUnits', 'normalized',..
                        'FontSize', GUI_TEXT_SIZE/1.5,..
                        'Max', 1,..
                        'Min', 0,..
                        'Callback_Type', 10,..
                        'Callback','block_3 = 1')
                        
   disp_edit_b_d_pb = uicontrol(  'Parent', gui_polarplot,..
                        'Style', 'pushbutton',..
                        'Units', 'normalized',..
                        'Position', [0.76,0.01,0.06,0.03],..
                        'String', 'Edit',..
                        'BackgroundColor', YELLOW,..
                        'FontUnits', 'normalized',..
                        'FontSize', GUI_TEXT_SIZE/1.5,..
                        'Max', 1,..
                        'Min', 0,..
                        'Callback_Type', 10,..
                        'Callback','gui_edit_b_d.Visible = ''on''')
                        
                                                 
gui_edit_b_d = figure(  'Position', [0 0 400 400],..                                                  // Position x, y and size x, y
        ..//'BackgroundColor', (E_L_COLOR+SKY_GREEN)./1.5,..
        'BackgroundColor', WHITE,..
        'Figure_name', 'Band directional display parameters',..
        'Visible', 'off')                
        
                                


edit_bd_title_text = uicontrol(  'Parent', gui_edit_b_d,..
                    'Style', 'text',..
                    'Units', 'normalized',..
                    'Position', [0.28,0.9,0.5,0.1],..
                    'ForegroundColor', [0.3,0.5,1],..
                    'String', '~ Visualization parameters ~',..
                    'BackgroundColor', WHITE,..
                    'FontUnits', 'normalized',..
                    'FontSize', GUI_TEXT_SIZE*3)           // Should delete 'Computed_data' directory
 
// AXES        
// AXES TICK SIZES 
tick_size_slider = uicontrol(  'Parent', gui_edit_b_d,..
                        'Style', 'slider',..
                        'Units', 'normalized',..
                        'SliderStep', [0.1 1],..
                        'Position', [0.4,0.75,0.5,0.1],..
                        'BackgroundColor', WHITE,..
                        'FontUnits', 'normalized',..
                        'FontSize', GUI_TEXT_SIZE/1.5,..
                        'Max', 9,..
                        'Min', 1,..
                        'Value', a.thickness,..
                        'Callback_Type', 12,..
                        'Callback', 'a.thickness = tick_size_slider.Value')
                            
                            

                        
 edit_ok_pb = uicontrol(  'Parent', gui_edit_b_d,..
                        'Style', 'pushbutton',..
                        'Units', 'normalized',..
                        'Position', [0.8,0.05,0.1,0.05],..
                        'String', 'OK',..
                        'BackgroundColor', SKY_GREEN,..
                        'FontUnits', 'normalized',..
                        'FontSize', GUI_TEXT_SIZE*1.5,..
                        'Max', 1,..
                        'Min', 0,..
                        'Callback_Type', 10,..
                        'Callback','gui_edit_b_d.visible = ''off''')
                        // 

block_3 = 0

while (block_3 ~= 1)            // Wainting for user clicks on 'OK' to go on execution
    // Nothing
   
end

scf()
polarplot()


More information about the users mailing list