@@ -29,10 +29,13 @@ class TextBox(Control):
29
29
30
30
def __init__ (self , * args , ** kwargs ):
31
31
# if mask is given, create a masked control
32
+ # (formatting codes only supported in masked TextCtrl)
32
33
if 'mask' in kwargs and kwargs ['mask' ]:
33
- if all ([(ch in ("#" , "." )) for ch in kwargs ['mask' ]]):
34
+ fmt = kwargs .get ("format" )
35
+ mask = kwargs ['mask' ]
36
+ if all ([(ch in ("#" , "." )) for ch in mask ]) and not fmt :
34
37
self ._wx_class = wx_masked_NumCtrl
35
- elif kwargs ['mask' ] == 'date' :
38
+ elif kwargs ['mask' ] == 'date' and not fmt :
36
39
self ._wx_class = wx_DatePickerCtrl
37
40
else :
38
41
self ._wx_class = wx_masked_TextCtrl
@@ -240,6 +243,8 @@ def _set_value(self, new_value):
240
243
241
244
mask = InitSpec (_get_mask , _set_mask , type = 'string' , default = None ,
242
245
doc = "template to control allowed user input" )
246
+ format = InitSpec (None , None , type = 'string' , default = None ,
247
+ _name = "_formatcodes" , doc = "internal format code" )
243
248
244
249
245
250
class wx_masked_TextCtrl (masked .TextCtrl ):
@@ -295,6 +300,8 @@ def __init__(self, *args, **kwargs):
295
300
#groupDigits = False,
296
301
#min = None,
297
302
#max = None,
303
+ if "formatcodes" in kwargs :
304
+ del kwargs ["formatcodes" ]
298
305
masked .NumCtrl .__init__ (self , * args , ** kwargs )
299
306
300
307
def GetMask (self ):
0 commit comments