Stuck in a problem with validators

David,

David Anderson wrote:

Hi you all
Well the thing is... i'm using a validator that do this
def __init__(self, data, key):
         wx.PyValidator.__init__(self)
         self.data = data
         self.key = key
def TransferFromWindow(self):
         textCtrl = self.GetWindow()
         self.data[self.key] = textCtrl.GetValue()
         return True

So i'll add the stuff in a dictionary..
The thing is, the stuff is only added to the dic data if I click on the 'ok' button from the dialog,
but I want to access those info on the dic before closing the dialog...
Any ideas of how to solve this problem?

When you want to access it call dialog.TransferDataFromWindow(), doc for it:
TransferDataFromWindow(self)
Transfers values from child controls to data areas specified by their validators. Returns false if a transfer failed. If the window has wx.WS_EX_VALIDATE_RECURSIVELY extra style flag set, the method will also call TransferDataFromWindow() of all child windows.

Above doesn't show it, but you are aware that you need a Clone function in your validator?

Werner

From window put stuff in the box, I dont want to put, I want to get
And I’ve a clone method

···

On Wed, Apr 30, 2008 at 1:42 PM, Werner F. Bruhin werner.bruhin@free.fr wrote:

David,

David Anderson wrote:

Hi you all

Well the thing is… i’m using a validator that do this

def init(self, data, key):

     wx.PyValidator.__init__(self)

     self.data = data

     self.key = key

def TransferFromWindow(self):

     textCtrl = self.GetWindow()

     self.data[self.key] = textCtrl.GetValue()

     return True

So i’ll add the stuff in a dictionary…

The thing is, the stuff is only added to the dic data if I click on the ‘ok’ button from the dialog,

but I want to access those info on the dic before closing the dialog…

Any ideas of how to solve this problem?

When you want to access it call dialog.TransferDataFromWindow(), doc for it:

TransferDataFromWindow(self)

Transfers values from child controls to data areas specified by their validators. Returns false if a transfer failed. If the window has wx.WS_EX_VALIDATE_RECURSIVELY extra style flag set, the method will also call TransferDataFromWindow() of all child windows.

Above doesn’t show it, but you are aware that you need a Clone function in your validator?

Werner


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users