From: Mattia B. <mb...@ds...> - 2002-07-06 21:16:35
|
> Hi Marcus, > Validators are similar to, but not the same as, Perl/Tk. As you say, in > Perl/Tk, changes to the underlying variable immediately appear in the Tk > widget - a great feature but also a source of problems, as you have found. > > However, I think that Wx validators only transfer the data to the control > when $window->TransferDataToWindow is called, and back again when > $window->TransferDataFromWindow is called. (I'll check this out with some > trials). This is correct. > For wxDialogs, these are both called automatically as part of Dialog > initialisation and dismissal (TransferDataFromWindow is only called when the > modal result is wxID_OK, I think). And this too. BTW, there is a wxValidator overview in the wxWindows manual (Topics overview -> wxValidator overview; I am not sure how much C++=oriented it is, but may be worth reading, especially "How validators interact with dialogs") > One feature I'm thinking of implementing is the ability to supply a callback > for the TransferToWindow and TransferFromWindow wxValidator methods, so that > we can supply data from object methods and pump data back into object > methods, rather than having to rely on variable addresses. (Most of my Perl > code is OO, and so I want to be able to use property accessors, rather than > property addresses). This looks like a nice feature, BTW Regards Mattia |