1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2004 - Jaime Urzua
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
function editvar(%_name)
// Simple Variable Editor
// This file is part of sciGUI toolbox
// rev. 0.2 2004/06/24
//
// This program is free software; you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation; either version 2 of the License, or
//(at your option) any later version.
sciGUI_init()
if (type(%_name)~=10) then error(44), end
if execstr("%_var="+%_name,'errcatch')~=0 then error(44), end
%_type=typeof(%_var)
if and(type(%_var)~=[1 4 8 10 16])&%_type~="xlssheet" then error(44), end
namesheet='';
[%_ni,%_nj]=size(%_var);
if (%_type=="xlssheet") then
namesheet=%_var.name;
%_var=string(%_var);
else
%_var=string(%_var);
end
TCL_EvalStr("set EdVarLoc [sciGUIEditVar -1]");
%_winId=TCL_GetVar("EdVarLoc");
TCL_SetVar("sciGUITable(win,"+%_winId+",data,name)",%_name);
TCL_SetVar("sciGUITable(win,"+%_winId+",data,type)",%_type);
TCL_SetVar("sciGUITable(win,"+%_winId+",data,ni)",string(%_ni));
TCL_SetVar("sciGUITable(win,"+%_winId+",data,nj)",string(%_nj));
if %_type=="xlssheet" then
TCL_SetVar("sciGUITable(win,"+%_winId+",data,sheetname)",namesheet);
clear namesheet;
end
editvar_set_values( %_var, %_winId ) ;
TCL_EvalStr("sciGUIEditVarDrawGrid "+%_winId);
endfunction
|