Debian Codegraph @

doc-en/source/src/api/Interface/cpopup.rst

raw
1 cpopup : creates a popup menu offering a limited set of choices
2 ===============================================================
3
4 Initline
5 ---------
6
7 .. code::
8
9 cpopup(name='popup', label='Chooser', value=['1', '2', '3', '4'],
10 init='1', rate='k', col='red', help='')
11
12 Description
13 ------------
14
15 A popup menu offers a limited set choices that are available to modify
16 the state of the current module.
17
18 If `rate` argument is set to 'i', two built-in reserved variables are
19 created at initialization time. The variables' names are constructed
20 like this :
21
22
23 .. code::
24
25 self.widget_name + '_index' for the selected position in the popup.
26 self.widget_name + '_value' for the selected string in the popup.
27
28 If `name` is set to 'foo', the variables names will be:
29
30
31 .. code::
32
33 self.foo_index (this variable is an integer)
34 self.foo_value (this variable is a string)
35
36 If `rate` argument is set to 'k', a module method using two arguments
37 must be defined with the name `name`. If `name` is set to 'foo', the
38 function should be defined like this :
39
40
41 .. code::
42
43 def foo(self, index, value):
44 index -> int
45 value -> str
46
47 Parameters
48 -----------
49
50 **name**: str
51 Name of the widget.
52 Used to defined the function or the reserved variables.
53 **label**: str
54 Label shown in the interface.
55 **value**: list of strings
56 An array of strings with which to initialize the popup.
57 **init**: int
58 Initial state of the popup.
59 **rate**: str {'k', 'i'}
60 Indicates if the popup is handled at initialization time only
61 ('i') with reserved variables or with a function ('k') that can
62 be called at any time during playback.
63 **col**: str
64 Color of the widget.
65 **help**: str
66 Help string shown in the popup tooltip.
67
68