Problems with wx.lib.masked.combobox.BaseMaskedComboBox

Hello!
I am trying to set up a masked combobox using wx.lib.masked.combobox.BaseMaskedComboBox with autocompletion. However, I've found a couple of problems. On one hand, if I run the code as I provide it in the test.py file, I get an error caused by the 'Antigua and Bermuda' option on the Country combobox. This is the traceback:

Traceback (most recent call last):
   File "test.py", line 56, in <module>
     Query(None, -1)
   File "test.py", line 27, in __init__
     self.Country = wx.lib.masked.combobox.BaseMaskedComboBox(panel, -1,size=(200, -1), choices=countries)
   File "/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/combobox.py", line 97, in __init__
     MaskedEditMixin.__init__( self, name, **kwargs )
   File "/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py", line 1857, in __init__
     self.SetCtrlParameters(**kwargs)
   File "/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py", line 2012, in SetCtrlParameters
     self._validateChoices()
   File "/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py", line 2661, in _validateChoices
     raise ve
ValueError: "Antigua and Bermuda" could not be entered into field -1 of control "maskedComboBox"

Then, if I remove this choice, I can run the code. However, it doesn't autocomplete when I start typing the name in the country combobox. Can anyone help?
Cheers!

Dani

test.py (71 Bytes)

···

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.valverde@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!

I think you attached the wrong file.

···

On 9/28/10 2:54 AM, Dani Valverde wrote:

Hello!
I am trying to set up a masked combobox using
wx.lib.masked.combobox.BaseMaskedComboBox with autocompletion. However,
I've found a couple of problems. On one hand, if I run the code as I
provide it in the test.py file, I get an error caused by the 'Antigua
and Bermuda' option on the Country combobox. This is the traceback:

Traceback (most recent call last):
File "test.py", line 56, in <module>
Query(None, -1)
File "test.py", line 27, in __init__
self.Country = wx.lib.masked.combobox.BaseMaskedComboBox(panel,
-1,size=(200, -1), choices=countries)
File
"/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/combobox.py",
line 97, in __init__
MaskedEditMixin.__init__( self, name, **kwargs )
File
"/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py",
line 1857, in __init__
self.SetCtrlParameters(**kwargs)
File
"/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py",
line 2012, in SetCtrlParameters
self._validateChoices()
File
"/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py",
line 2661, in _validateChoices
raise ve
ValueError: "Antigua and Bermuda" could not be entered into field -1 of
control "maskedComboBox"

Then, if I remove this choice, I can run the code. However, it doesn't
autocomplete when I start typing the name in the country combobox. Can
anyone help?

--
Robin Dunn
Software Craftsman

Hello!
I send the file again (it is the same but removing the "Antigua and Bermuda" option in the countries choice of the combobox. To summarize, the masked combobox does not auto-complete and if I add the "Antigua and Bermuda" option in the countries choice of the combobox I cannot run the code, because I get the traceback in the mail before.
Cheers!

Dani

test.py (2.2 KB)

···

On 09/28/2010 06:49 PM, Robin Dunn wrote:

On 9/28/10 2:54 AM, Dani Valverde wrote:

Hello!
I am trying to set up a masked combobox using
wx.lib.masked.combobox.BaseMaskedComboBox with autocompletion. However,
I've found a couple of problems. On one hand, if I run the code as I
provide it in the test.py file, I get an error caused by the 'Antigua
and Bermuda' option on the Country combobox. This is the traceback:

Traceback (most recent call last):
File "test.py", line 56, in <module>
Query(None, -1)
File "test.py", line 27, in __init__
self.Country = wx.lib.masked.combobox.BaseMaskedComboBox(panel,
-1,size=(200, -1), choices=countries)
File
"/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/combobox.py",

line 97, in __init__
MaskedEditMixin.__init__( self, name, **kwargs )
File
"/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py",

line 1857, in __init__
self.SetCtrlParameters(**kwargs)
File
"/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py",

line 2012, in SetCtrlParameters
self._validateChoices()
File
"/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py",

line 2661, in _validateChoices
raise ve
ValueError: "Antigua and Bermuda" could not be entered into field -1 of
control "maskedComboBox"

Then, if I remove this choice, I can run the code. However, it doesn't
autocomplete when I start typing the name in the country combobox. Can
anyone help?

I think you attached the wrong file.

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.valverde@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!

Hello!
I send the file again (it is the same but removing the "Antigua and
Bermuda" option in the countries choice of the combobox. To summarize,
the masked combobox does not auto-complete

Pass the autoSelect=True arg when creating the combobox.

and if I add the "Antigua and
Bermuda" option in the countries choice of the combobox I cannot run the
code, because I get the traceback in the mail before.

I expect that it is simply too long for the default mask template. Try specifying a different mask. Also you probably want to be using wx.lib.masked.ComboBox instead of wx.lib.masked.combobox.BaseMaskedComboBox.

···

On 9/28/10 10:06 AM, Dani Valverde wrote:

--
Robin Dunn
Software Craftsman

Thank you Robin. I passed the autoSelect=True argument when creating the combobox and now it autocompletes. However, when I use wx.lib.masked.ComboBox instead of wx.lib.masked.combobox.BaseMaskedComboBox I keep getting the error. Which other masks can I try?

Dani

···

On 09/28/2010 10:51 PM, Robin Dunn wrote:

On 9/28/10 10:06 AM, Dani Valverde wrote:

Hello!
I send the file again (it is the same but removing the "Antigua and
Bermuda" option in the countries choice of the combobox. To summarize,
the masked combobox does not auto-complete

Pass the autoSelect=True arg when creating the combobox.

and if I add the "Antigua and
Bermuda" option in the countries choice of the combobox I cannot run the
code, because I get the traceback in the mail before.

I expect that it is simply too long for the default mask template. Try specifying a different mask. Also you probably want to be using wx.lib.masked.ComboBox instead of wx.lib.masked.combobox.BaseMaskedComboBox.

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.valverde@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!

I don't use the masked edit controls much myself so all I can do is guess. From the behavior and the raised exception is seems that the mask is not allowing enough characters for the values you want to use, so my guess is that setting a different mask with more allowed characters will take care of the problem. You should read through the docstrings in the masked edit modules to learn more about that.

···

On 9/29/10 3:43 AM, Dani Valverde wrote:

Thank you Robin. I passed the autoSelect=True argument when creating the
combobox and now it autocompletes. However, when I use
wx.lib.masked.ComboBox instead of
wx.lib.masked.combobox.BaseMaskedComboBox I keep getting the error.
Which other masks can I try?

--
Robin Dunn
Software Craftsman

Thank you so much. I will read carefully the docstrings to get the answer. In the meantime, if anyone could provide any hint it will be highly appreciated (I'm not very good at decoding the docstrings).
Cheers!

Dani

···

On 09/29/2010 08:31 PM, Robin Dunn wrote:

On 9/29/10 3:43 AM, Dani Valverde wrote:

Thank you Robin. I passed the autoSelect=True argument when creating the
combobox and now it autocompletes. However, when I use
wx.lib.masked.ComboBox instead of
wx.lib.masked.combobox.BaseMaskedComboBox I keep getting the error.
Which other masks can I try?

I don't use the masked edit controls much myself so all I can do is guess. From the behavior and the raised exception is seems that the mask is not allowing enough characters for the values you want to use, so my guess is that setting a different mask with more allowed characters will take care of the problem. You should read through the docstrings in the masked edit modules to learn more about that.

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.valverde@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!

Thank you so much, finally I got it. I need to use the wx.lib.masked.ComboBox with a long '*' mask argument while passing the autoSelect = True argument.
Cheers!

Dani

···

On 09/29/2010 08:31 PM, Robin Dunn wrote:

On 9/29/10 3:43 AM, Dani Valverde wrote:

Thank you Robin. I passed the autoSelect=True argument when creating the
combobox and now it autocompletes. However, when I use
wx.lib.masked.ComboBox instead of
wx.lib.masked.combobox.BaseMaskedComboBox I keep getting the error.
Which other masks can I try?

I don't use the masked edit controls much myself so all I can do is guess. From the behavior and the raised exception is seems that the mask is not allowing enough characters for the values you want to use, so my guess is that setting a different mask with more allowed characters will take care of the problem. You should read through the docstrings in the masked edit modules to learn more about that.

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.valverde@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!

What mask are you using, can you show your code for the particular CB?

I use mostly this:
         self.country.SetCtrlParameters(mask = u"*{50}", formatcodes = "S",
                                        emptyInvalid = True)

Note the "*" which means accept any valid unicode character.

Werner

···

On 30/09/2010 17:39, Dani Valverde wrote:

Thank you so much, finally I got it. I need to use the wx.lib.masked.ComboBox with a long '*' mask argument while passing the autoSelect = True argument.

Thank you so much Werner, I'll keep it in mind. By the way, is there any way to set it "read only"? I mean, this control reads the contents from a MySQL table which name is "Countries" and sends the content to another MySQL table which name is "DayData". So, if the user modifies the value read from the "Countries" table it will send the modified (wrong) value to the "DayData" table. How can I prevent it?
Cheers!

Dani

···

On 09/30/2010 06:29 PM, werner wrote:

On 30/09/2010 17:39, Dani Valverde wrote:

Thank you so much, finally I got it. I need to use the wx.lib.masked.ComboBox with a long '*' mask argument while passing the autoSelect = True argument.

What mask are you using, can you show your code for the particular CB?

I use mostly this:
        self.country.SetCtrlParameters(mask = u"*{50}", formatcodes = "S",
                                       emptyInvalid = True)

Note the "*" which means accept any valid unicode character.

Werner

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.valverde@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!

Thank you so much, finally I got it. I need to use the wx.lib.masked.ComboBox with a long '*' mask argument while passing the autoSelect = True argument.

What mask are you using, can you show your code for the particular CB?

I use mostly this:
        self.country.SetCtrlParameters(mask = u"*{50}", formatcodes = "S",
                                       emptyInvalid = True)

Note the "*" which means accept any valid unicode character.

Werner

Thank you so much Werner, I'll keep it in mind. By the way, is there any way to set it "read only"?

style = wx.CB_READONLY

I mean, this control reads the contents from a MySQL table which name is "Countries" and sends the content to another MySQL table which name is "DayData". So, if the user modifies the value read from the "Countries" table it will send the modified (wrong) value to the "DayData" table. How can I prevent it?

You don't use the text as the foreign key in DayData, do you?

If yes, I would suggest to change it to use the primary key of Countries as foreign key in DayData.

For this you would use

cb.Append(item[0], item[1])

item[0] = string shown in cb
item[1] = pk of countries

which you can get from the cb with:
comboBox.GetClientData(cbSel)

You might also want to look at Dabo - http://dabodev.com/ , it didn't exist when I started created my application, so I used validators to set/get data to widgets and use sqlalchemy to get to the database.

Werner

···

On 30/09/2010 18:52, Dani Valverde wrote:

On 09/30/2010 06:29 PM, werner wrote:

On 30/09/2010 17:39, Dani Valverde wrote:

Cheers!

Dani

Thank you Werner! However, isn't there any method to just not allow the user to modify the choices provided?

Dani

···

On 09/30/2010 08:59 PM, werner wrote:

On 30/09/2010 18:52, Dani Valverde wrote:

On 09/30/2010 06:29 PM, werner wrote:

On 30/09/2010 17:39, Dani Valverde wrote:

Thank you so much, finally I got it. I need to use the wx.lib.masked.ComboBox with a long '*' mask argument while passing the autoSelect = True argument.

What mask are you using, can you show your code for the particular CB?

I use mostly this:
        self.country.SetCtrlParameters(mask = u"*{50}", formatcodes = "S",
                                       emptyInvalid = True)

Note the "*" which means accept any valid unicode character.

Werner

Thank you so much Werner, I'll keep it in mind. By the way, is there any way to set it "read only"?

style = wx.CB_READONLY

I mean, this control reads the contents from a MySQL table which name is "Countries" and sends the content to another MySQL table which name is "DayData". So, if the user modifies the value read from the "Countries" table it will send the modified (wrong) value to the "DayData" table. How can I prevent it?

You don't use the text as the foreign key in DayData, do you?

If yes, I would suggest to change it to use the primary key of Countries as foreign key in DayData.

For this you would use

cb.Append(item[0], item[1])

item[0] = string shown in cb
item[1] = pk of countries

which you can get from the cb with:
comboBox.GetClientData(cbSel)

You might also want to look at Dabo - http://dabodev.com/ , it didn't exist when I started created my application, so I used validators to set/get data to widgets and use sqlalchemy to get to the database.

Werner

Cheers!

Dani

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.valverde@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!

Yes, that answer was a bit higher up in the message, i.e. just after your question :wink:

Werner

···

On 01/10/2010 09:53, Dani Valverde wrote:

On 09/30/2010 08:59 PM, werner wrote:

On 30/09/2010 18:52, Dani Valverde wrote:

On 09/30/2010 06:29 PM, werner wrote:

On 30/09/2010 17:39, Dani Valverde wrote:

Thank you so much, finally I got it. I need to use the wx.lib.masked.ComboBox with a long '*' mask argument while passing the autoSelect = True argument.

What mask are you using, can you show your code for the particular CB?

I use mostly this:
        self.country.SetCtrlParameters(mask = u"*{50}", formatcodes = "S",
                                       emptyInvalid = True)

Note the "*" which means accept any valid unicode character.

Werner

Thank you so much Werner, I'll keep it in mind. By the way, is there any way to set it "read only"?

style = wx.CB_READONLY

I mean, this control reads the contents from a MySQL table which name is "Countries" and sends the content to another MySQL table which name is "DayData". So, if the user modifies the value read from the "Countries" table it will send the modified (wrong) value to the "DayData" table. How can I prevent it?

You don't use the text as the foreign key in DayData, do you?

If yes, I would suggest to change it to use the primary key of Countries as foreign key in DayData.

For this you would use

cb.Append(item[0], item[1])

item[0] = string shown in cb
item[1] = pk of countries

which you can get from the cb with:
comboBox.GetClientData(cbSel)

You might also want to look at Dabo - http://dabodev.com/ , it didn't exist when I started created my application, so I used validators to set/get data to widgets and use sqlalchemy to get to the database.

Werner

Cheers!

Dani

Thank you Werner! However, isn't there any method to just not allow the user to modify the choices provided?

Thank you so much!

Dani

···

On 10/01/2010 10:29 AM, werner wrote:

On 01/10/2010 09:53, Dani Valverde wrote:

On 09/30/2010 08:59 PM, werner wrote:

On 30/09/2010 18:52, Dani Valverde wrote:

On 09/30/2010 06:29 PM, werner wrote:

On 30/09/2010 17:39, Dani Valverde wrote:

Thank you so much, finally I got it. I need to use the wx.lib.masked.ComboBox with a long '*' mask argument while passing the autoSelect = True argument.

What mask are you using, can you show your code for the particular CB?

I use mostly this:
        self.country.SetCtrlParameters(mask = u"*{50}", formatcodes = "S",
                                       emptyInvalid = True)

Note the "*" which means accept any valid unicode character.

Werner

Thank you so much Werner, I'll keep it in mind. By the way, is there any way to set it "read only"?

style = wx.CB_READONLY

I mean, this control reads the contents from a MySQL table which name is "Countries" and sends the content to another MySQL table which name is "DayData". So, if the user modifies the value read from the "Countries" table it will send the modified (wrong) value to the "DayData" table. How can I prevent it?

You don't use the text as the foreign key in DayData, do you?

If yes, I would suggest to change it to use the primary key of Countries as foreign key in DayData.

For this you would use

cb.Append(item[0], item[1])

item[0] = string shown in cb
item[1] = pk of countries

which you can get from the cb with:
comboBox.GetClientData(cbSel)

You might also want to look at Dabo - http://dabodev.com/ , it didn't exist when I started created my application, so I used validators to set/get data to widgets and use sqlalchemy to get to the database.

Werner

Cheers!

Dani

Thank you Werner! However, isn't there any method to just not allow the user to modify the choices provided?

Yes, that answer was a bit higher up in the message, i.e. just after your question :wink:

Werner

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.valverde@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!

Hello Werner,
I have been looking to your code and (sorry for my poor knowledge, I starting with wx.python) I don't understand it. Could you comment it a little bit? Furthermore, I need to use it with other applications not bound to database. How can I protect the combobox from being edited by the user? Please, can you use the provided test file?
Cheers!

Dani

test.py (2.25 KB)

···

On 10/01/2010 10:29 AM, werner wrote:

On 01/10/2010 09:53, Dani Valverde wrote:

On 09/30/2010 08:59 PM, werner wrote:

On 30/09/2010 18:52, Dani Valverde wrote:

On 09/30/2010 06:29 PM, werner wrote:

On 30/09/2010 17:39, Dani Valverde wrote:

Thank you so much, finally I got it. I need to use the wx.lib.masked.ComboBox with a long '*' mask argument while passing the autoSelect = True argument.

What mask are you using, can you show your code for the particular CB?

I use mostly this:
        self.country.SetCtrlParameters(mask = u"*{50}", formatcodes = "S",
                                       emptyInvalid = True)

Note the "*" which means accept any valid unicode character.

Werner

Thank you so much Werner, I'll keep it in mind. By the way, is there any way to set it "read only"?

style = wx.CB_READONLY

I mean, this control reads the contents from a MySQL table which name is "Countries" and sends the content to another MySQL table which name is "DayData". So, if the user modifies the value read from the "Countries" table it will send the modified (wrong) value to the "DayData" table. How can I prevent it?

You don't use the text as the foreign key in DayData, do you?

If yes, I would suggest to change it to use the primary key of Countries as foreign key in DayData.

For this you would use

cb.Append(item[0], item[1])

item[0] = string shown in cb
item[1] = pk of countries

which you can get from the cb with:
comboBox.GetClientData(cbSel)

You might also want to look at Dabo - http://dabodev.com/ , it didn't exist when I started created my application, so I used validators to set/get data to widgets and use sqlalchemy to get to the database.

Werner

Cheers!

Dani

Thank you Werner! However, isn't there any method to just not allow the user to modify the choices provided?

Yes, that answer was a bit higher up in the message, i.e. just after your question :wink:

Werner

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.valverde@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!

Hi Dani,

...

Hello Werner,
I have been looking to your code and (sorry for my poor knowledge, I starting with wx.python) I don't understand it. Could you comment it a little bit? Furthermore, I need to use it with other applications not bound to database. How can I protect the combobox from being edited by the user? Please, can you use the provided test file?

I attach the changed script. As I don't have mssql I changed all your imports so it is easier to just activate/deactivate one.

In my code countries (or codes in general) are only loaded when needed and not on construction of the widget, therefore I can use "SetCtrlParameters", in your case you should need to move at least the "mask" parameter - see code.

Werner

P.S.
I will send you off list a little sample db application which shows how I do it using validators etc - just for your information, do whatever you like with it.

testDani.py (2.36 KB)

···

On 01/10/2010 15:10, Dani Valverde wrote:

Thank you so much, I'll check it.

Dani

···

On 10/01/2010 04:23 PM, werner wrote:

Hi Dani,

On 01/10/2010 15:10, Dani Valverde wrote:
...

Hello Werner,
I have been looking to your code and (sorry for my poor knowledge, I starting with wx.python) I don't understand it. Could you comment it a little bit? Furthermore, I need to use it with other applications not bound to database. How can I protect the combobox from being edited by the user? Please, can you use the provided test file?

I attach the changed script. As I don't have mssql I changed all your imports so it is easier to just activate/deactivate one.

In my code countries (or codes in general) are only loaded when needed and not on construction of the widget, therefore I can use "SetCtrlParameters", in your case you should need to move at least the "mask" parameter - see code.

Werner

P.S.
I will send you off list a little sample db application which shows how I do it using validators etc - just for your information, do whatever you like with it.

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.valverde@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!