File: wx.lib.masked.numctrl.NumCtrl.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (416 lines) | stat: -rw-r--r-- 18,283 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.masked.numctrl

.. highlight:: python



.. _wx.lib.masked.numctrl.NumCtrl:

==========================================================================================================================================
|phoenix_title|  **wx.lib.masked.numctrl.NumCtrl**
==========================================================================================================================================

Masked edit control supporting "native" numeric values, ie. .SetValue(3), for
example, and supporting a variety of formatting options, including automatic
rounding specifiable precision, grouping and decimal place characters, etc.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>NumCtrl</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.masked.numctrl.NumCtrl_inheritance.png" alt="Inheritance diagram of NumCtrl" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.TextCtrl.html" title="wx.TextCtrl" alt="" coords="558,392,647,421"/> <area shape="rect" id="node11" href="wx.lib.masked.textctrl.BaseMaskedTextCtrl.html" title="wx.lib.masked.textctrl.BaseMaskedTextCtrl" alt="" coords="347,469,639,499"/> <area shape="rect" id="node2" href="wx.Control.html" title="wx.Control" alt="" coords="499,315,587,344"/> <area shape="rect" id="node3" href="wx.TextEntry.html" title="wx.TextEntry" alt="" coords="611,315,711,344"/> <area shape="rect" id="node4" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="435,5,536,35"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="487,83,597,112"/> <area shape="rect" id="node9" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="482,160,603,189"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="560,5,641,35"/> <area shape="rect" id="node7" href="wx.lib.masked.maskededit.MaskedEditMixin.html" title="wx.lib.masked.maskededit.MaskedEditMixin" alt="" coords="235,392,532,421"/> <area shape="rect" id="node8" href="wx.lib.masked.numctrl.NumCtrlAccessorsMixin.html" title="wx.lib.masked.numctrl.NumCtrlAccessorsMixin" alt="" coords="5,469,323,499"/> <area shape="rect" id="node10" href="wx.lib.masked.numctrl.NumCtrl.html" title="wx.lib.masked.numctrl.NumCtrl" alt="" coords="217,547,439,576"/> <area shape="rect" id="node12" href="wx.Window.html" title="wx.Window" alt="" coords="498,237,587,267"/> </map> 
   </p>

|


|super_classes| Known Superclasses
==================================

:class:`wx.lib.masked.numctrl.NumCtrlAccessorsMixin`, :class:`wx.lib.masked.textctrl.BaseMaskedTextCtrl`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.masked.numctrl.NumCtrl.__init__`                                  Default class constructor.
:meth:`~wx.lib.masked.numctrl.NumCtrl.ChangeValue`                               Sets the value of the control to the value specified.
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetAllowNegative`                          (For regularization of property accessors)
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetAllowNone`                              (For regularization of property accessors)
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetAutoSize`                               
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetBounds`                                 This function returns a two-tuple (min,max), indicating the
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetDecimalChar`                            
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetFraction`                               Returns the fractional portion of the value as a float. If there is no
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetFractionWidth`                          Get the fraction width.
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetGroupChar`                              
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetGroupDigits`                            (For regularization of property accessors)
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetIntegerWidth`                           Get the integer width.
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetLimited`                                (For regularization of property accessors)
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetLimitOnFieldChange`                     (For regularization of property accessors)
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetMax`                                    Gets the maximum value of the control.  It will return the current
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetMin`                                    Gets the lower bound value of the control.  It will return
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetSelectOnEntry`                          
:meth:`~wx.lib.masked.numctrl.NumCtrl.GetValue`                                  Returns the current numeric value of the control.
:meth:`~wx.lib.masked.numctrl.NumCtrl.IsGroupingAllowed`                         
:meth:`~wx.lib.masked.numctrl.NumCtrl.IsInBounds`                                Returns ``True`` if no value is specified and the current value
:meth:`~wx.lib.masked.numctrl.NumCtrl.IsLimited`                                 Returns ``True`` if the control is currently limiting the
:meth:`~wx.lib.masked.numctrl.NumCtrl.IsLimitedOnFieldChange`                    Returns ``True`` if the control is currently limiting the
:meth:`~wx.lib.masked.numctrl.NumCtrl.IsNegativeAllowed`                         
:meth:`~wx.lib.masked.numctrl.NumCtrl.IsNoneAllowed`                             
:meth:`~wx.lib.masked.numctrl.NumCtrl.OnTextChange`                              Handles an event indicating that the text control's value
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetAllowNegative`                          
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetAllowNone`                              Change the behavior of the validation code, allowing control
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetAutoSize`                               
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetBounds`                                 This function is a convenience function for setting the min and max
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetDecimalChar`                            
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetFractionWidth`                          Set the fraction width of the control
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetGroupChar`                              
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetGroupDigits`                            
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetIntegerWidth`                           Set the integer width of the control
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetLimited`                                If called with a value of True, this function will cause the control
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetLimitOnFieldChange`                     If called with a value of True, this function will cause the control
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetMax`                                    Sets the maximum value of the control. If a value of None
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetMin`                                    Sets the minimum value of the control.  If a value of None
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetParameters`                             This function is used to initialize and reconfigure the control.
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetSelectOnEntry`                          
:meth:`~wx.lib.masked.numctrl.NumCtrl.SetValue`                                  Sets the value of the control to the value specified.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: NumCtrl(BaseMaskedTextCtrl, NumCtrlAccessorsMixin)

   Masked edit control supporting "native" numeric values, ie. .SetValue(3), for
   example, and supporting a variety of formatting options, including automatic
   rounding specifiable precision, grouping and decimal place characters, etc.

   .. method:: __init__ ( self, parent, id=-1, value = 0, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TE_PROCESS_TAB, validator = wx.DefaultValidator, name = "masked.num", \*\*kwargs )

      Default class constructor.
      
      :param wx.Window `parent`: the window parent. Must not be ``None``;
      :param integer `id`: window identifier. A value of -1 indicates a default value;
      :param integer `value`: value to be shown;
      :param `pos`: the control position. A value of (-1, -1) indicates a default position,
       chosen by either the windowing system or wxPython, depending on platform;
      :type `pos`: tuple or :class:`wx.Point`
      :param `size`: the control size. A value of (-1, -1) indicates a default size,
       chosen by either the windowing system or wxPython, depending on platform;
      :param integer `style`: the window style;
      :param wx.Validator `validator`: this is mainly provided for data-transfer, as control does
        its own validation;
      :param string `name`: the window name;


   .. method:: ChangeValue(self, value)

      Sets the value of the control to the value specified.
      The resulting actual value of the control may be altered to
      conform with the bounds set on the control if limited,
      or colored if not limited but the value is out-of-bounds.
      A ValueError exception will be raised if an invalid value
      is specified.
      
      This method does not fire a change event.
      
      :param integer `value`: new value


   .. method:: GetAllowNegative(self)

      (For regularization of property accessors) 


   .. method:: GetAllowNone(self)

      (For regularization of property accessors) 


   .. method:: GetAutoSize(self)


   .. method:: GetBounds(self)

      This function returns a two-tuple (min,max), indicating the
      current bounds of the control.  Each value can be None if
      that bound is not set.


   .. method:: GetDecimalChar(self)


   .. method:: GetFraction(self, candidate=None)

      Returns the fractional portion of the value as a float. If there is no
      fractional portion, the value returned will be 0.0.


   .. method:: GetFractionWidth(self)

      Get the fraction width.


   .. method:: GetGroupChar(self)


   .. method:: GetGroupDigits(self)

      (For regularization of property accessors) 


   .. method:: GetIntegerWidth(self)

      Get the integer width.


   .. method:: GetLimited(self)

      (For regularization of property accessors) 


   .. method:: GetLimitOnFieldChange(self)

      (For regularization of property accessors) 


   .. method:: GetMax(self)

      Gets the maximum value of the control.  It will return the current
      maximum integer, or None if not specified.


   .. method:: GetMin(self)

      Gets the lower bound value of the control.  It will return
      None if not specified.


   .. method:: GetSelectOnEntry(self)


   .. method:: GetValue(self)

      Returns the current numeric value of the control.


   .. method:: IsGroupingAllowed(self)


   .. method:: IsInBounds(self, value=None)

      Returns ``True`` if no value is specified and the current value
      of the control falls within the current bounds.  This function can
      also be called with a value to see if that value would fall within
      the current bounds of the given control.
      
      :param `value`: value to check


   .. method:: IsLimited(self)

      Returns ``True`` if the control is currently limiting the
      value to fall within the current bounds.


   .. method:: IsLimitedOnFieldChange(self)

      Returns ``True`` if the control is currently limiting the
      value to fall within the current bounds.


   .. method:: IsNegativeAllowed(self)


   .. method:: IsNoneAllowed(self)


   .. method:: OnTextChange( self, event )

      Handles an event indicating that the text control's value
      has changed, and issue EVT_NUM event.
      
      .. note::
      
        Using :meth:`TextCtrl.SetValue` to change the control's contents from
        within a EVT_CHAR handler can cause double text events. So we check
        for actual changes to the text before passing the events on.


   .. method:: SetAllowNegative(self, value)


   .. method:: SetAllowNone(self, allow_none)

      Change the behavior of the validation code, allowing control
      to have a value of None or not, as appropriate.  If the value
      of the control is currently None, and allow_none is False, the
      value of the control will be set to the minimum value of the
      control, or 0 if no lower bound is set.
      
      :param boolean `allow_none`: ``True`` if None is allowed


   .. method:: SetAutoSize(self, value)


   .. method:: SetBounds(self, min=None, max=None)

      This function is a convenience function for setting the min and max
      values at the same time.  The function only applies the maximum bound
      if setting the minimum bound is successful, and returns ``True`` only if both operations succeed.
      
      .. note:: leaving out an argument will remove the corresponding bound.
      
      :param `min`: Minium value for the control
      :type `min`: integer or None
      :param `max`: Minium value for the control
      :type `max`: integer or None


   .. method:: SetDecimalChar(self, value)


   .. method:: SetFractionWidth(self, value)

      Set the fraction width of the control
      
      :param integer `value`: the width value


   .. method:: SetGroupChar(self, value)


   .. method:: SetGroupDigits(self, value)


   .. method:: SetIntegerWidth(self, value)

      Set the integer width of the control
      
      :param integer `value`: the width value


   .. method:: SetLimited(self, limited)

      If called with a value of True, this function will cause the control
      to limit the value to fall within the bounds currently specified.
      If the control's value currently exceeds the bounds, it will then
      be limited accordingly.
      
      If called with a value of False, this function will disable value
      limiting, but coloring of out-of-bounds values will still take
      place if bounds have been set for the control.
      
      :param boolean `limited`: define value limiting


   .. method:: SetLimitOnFieldChange(self, limit)

      If called with a value of True, this function will cause the control
      to prevent navigation out of the current field if its value is out-of-bounds,
      and limit the value to fall within the bounds currently specified if the
      control loses focus.
      
      If called with a value of False, this function will disable value
      limiting, but coloring of out-of-bounds values will still take
      place if bounds have been set for the control.
      
      :param boolean `limit`: define value limiting


   .. method:: SetMax(self, max=None)

      Sets the maximum value of the control. If a value of None
      is provided, then the control will have no explicit maximum value.
      If the value specified is less than the current minimum value, then
      the function returns ``False`` and the maximum will not change from its
      current setting. On success, the function returns True.
      
      If successful and the current value is greater than the new upper
      bound, if the control is limited the value will be automatically
      adjusted to this maximum value; if not limited, the value in the
      control will be colored as invalid.
      
      If max > the max value allowed by the width of the control,
      the function will return False, and the max will not be set.
      
      :param `max`: Minium value for the control
      :type `max`: integer or None


   .. method:: SetMin(self, min=None)

      Sets the minimum value of the control.  If a value of None
      is provided, then the control will have no explicit minimum value.
      If the value specified is greater than the current maximum value,
      then the function returns ``False`` and the minimum will not change from
      its current setting.  On success, the function returns True.
      
      If successful and the current value is lower than the new lower
      bound, if the control is limited, the value will be automatically
      adjusted to the new minimum value; if not limited, the value in the
      control will be colored as invalid.
      
      If min > the max value allowed by the width of the control,
      the function will return False, and the min will not be set.
      
      :param `min`: Minium value for the control
      :type `min`: integer or None


   .. method:: SetParameters(self, \*\*kwargs)

      This function is used to initialize and reconfigure the control.
      See :class:`~lib.masked.timectrl.TimeCtrl` module overview for available
      parameters.


   .. method:: SetSelectOnEntry(self, value)


   .. method:: SetValue(self, value)

      Sets the value of the control to the value specified.
      The resulting actual value of the control may be altered to
      conform with the bounds set on the control if limited,
      or colored if not limited but the value is out-of-bounds.
      A ValueError exception will be raised if an invalid value
      is specified.
      
      :param integer `value`: new value