File: addmenu.man

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (111 lines) | stat: -rw-r--r-- 2,922 bytes parent folder | download
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.TH addmenu 3 "December 1995" "Scilab Group" "Scilab Function"
.so ../sci.an
.SH NAME
addmenu - interactive button or menu definition
.SH CALLING SEQUENCE
.nf
addmenu(button [,submenus] [,action]) 
addmenu(gwin,button [,submenus] [,action]) 
.fi
.SH PARAMETERS
.TP 10
button
: a character string. The button name. On Windows operating
systems (not X_window), an & can be placed before the character
in the name to be used for keyboard shortcut; this character
will be underlined on the GUI. 
.TP
submenus
: a vector of character string. The sub_menus items names
.TP
action
: a list with 2 elements action=list(flag,proc_name)
.RS
.TP 10
flag
: an integer (default value is 0)
.RS
.TP 15
flag==0
: the action is defined by a scilab instruction
.TP
flag==1
: the action is defined by a C or Fortran procedure
.RE
.TP
proc_name
: a character string which gives the name of scilab variable
containing the instruction or the name of procedure to call.
.RE
.TP
gwin
: integer. The number of graphic window where the button is required
to be installed
.SH DESCRIPTION
The function allows the user to add new buttons or menus in the main
window or graphics windows command panels.

If \fVaction\fR is not given the action associated with a button must
be defined by a scilab instruction given by the character string
variable which name is  
.TP 20
button
for a main window command
.TP
button_gwin
for a graphic window command
.LP
If \fVproc_name\fR designes a C or Fortran procedure, this procedure
may be interfaced in Fortran subroutine default/fbutn.f or dynamically
linked with scilab using the \fVlink function\fR. the calling sequence
is in C: \fV(char* name, int* win,int *entry)\fR

.LP
Actions associated with the kth sub_menu must be defined by  scilab
instructions stored in the kth element of the character string
variable which name is  
.TP 20
button
for a main window command
.TP
button_gwin
for a graphic window command
.SH EXAMPLE
.nf
addmenu('foo')
foo='disp(''hello'')'

addmenu('Hello',['Franck';'Peter'])
Hello=['disp(''hello Franck'')';'disp(''hello Peter'')']

addmenu(0,'Hello',['Franck';'Peter'])
Hello_0=['disp(''hello Franck'')';'disp(''hello Peter'')']

addmenu('Bye',list(0,'French_Bye'))
French_Bye='disp(''Au revoir'')'

//C defined Callback
// creating Callback code
code=[
 '#include ""'+SCI+'/routines/machine.h""'
 'void C2F(foo)(name,win,entry)'
 '     char *name;'
 '     int * win,*entry;'
 '{'
 '  if (*win==-1) '
 '    sciprint(""menu %s(%i) in Scilab window selected\\r\\n"",name,*entry+1);'
 '  else'
 '    sciprint(""menu %s(%i) in window %i selected\\r\\n"",name,*entry+1,*win);'
 '}']
//creating foo.c file
mputl(code,TMPDIR+'/foo.c');
//reating Makefile
ilib_gen_Make('foo','foo','',TMPDIR+'/Makefile',%f)
// Compiling and linking
link(ilib_compile('foo',TMPDIR+'/Makefile'),'foo')
//add menu
addmenu('foo',['a','b','c'],list(1,'foo'))

.fi
.SH SEE ALSO
setmenu, unsetmenu, delmenu