[scilab-Users] Graphic interfaces

Jean-Louis Auge Jean-Louis.Auge at grenoble.cnrs.fr
Wed Jan 5 09:06:40 CET 2011


Ok, it is working!
I used the tag property.
I discovered that SCILAB (findobj function) looks for in the code 
everywhere and that whatever the location of the tag (function in a 
function).
The notion of the local or global variable do not exist for the research 
of the tag with the findobject function.

Thank you for your help.

Best regards.

JL


Vincent COUVERT a écrit :
> Hi Jean-Louis,
>
> Your callback functions must not take input arguments because when 
> they are called, "B_style" and "A_style" are undefined.
>
> The good way to manage your test case is to identify your buttons 
> using a tag (see the tag property), then using findobj to get them in 
> your callback functions and finally setting the string value.
>
> // Creation
> A_style.tag = "A_style"
>
> // Callback function
> A_style = findobj("Tag", "A_style");
> A_style.string = "B";
>
> Regards,
> Vincent
>
>
>
> Le 28/12/10 17:09, Jean-Louis Auge a écrit :
>> Dear users,
>>
>> I attempted to do a little program to change the label of a 
>> pushbutton but the result is was inconclusive.
>>
>> Here the programm:
>>
>> //Initialisation stage
>> clear all;
>> clc;
>> for i=0:100, close(i), end;
>>
>>
>> //to change the label of the button A
>> function [A_style]=changeA(B_style,A_style)
>>  A_style.String="B"
>>  disp("go through changeA")
>> endfunction;
>>
>> //to change the label of the button B
>> function [B_style]=changeB(A_style)
>>  B_style.String="A"
>>  disp("go through changeB")
>> endfunction;
>>
>>
>> h=scf();
>> h.position=[0 0 1000 800];
>> A_style=uicontrol(h,"style", "pushbutton");
>> A_style.Units="normalized";
>> A_style.Position = [0 0.95 0.2 0.05];
>> A_style.BackgroundColor="1|0|1";
>> A_style.Fontsize=20;
>> A_style.String = "A";
>> A_style.Callback="changeB";
>>
>> B_style=uicontrol(h,"style", "pushbutton");
>> B_style.Units="normalized";
>> B_style.Position = [0 0 0.2 0.05];
>> B_style.BackgroundColor="1|0|1";
>> B_style.Fontsize=20;
>> B_style.String = "B";
>> B_style.Callback="changeA";
>>
>>
>> I wanted change the label of  the pressbutton A pushing the button B 
>> and vice versa.
>> The result is inconclusive.
>>
>> Does somebody meet this case in this development.
>>
>> Moreover, do you know websites where graphic interfaces 
>> documentations are given? I did not find many comments about the 
>> subject.
>> Is Scilab often use to develop interface graphics?
>>
>> Best regards,
>>
>> JL.




More information about the users mailing list