Ed Leafe wrote:
> On Sep 29, 2010, at 4:03 PM, Jim Byrnes wrote:
>
>> I wanted to see how a Masked Textbox worked so I put together a
>> quick test app in the classdesigner. Now I see that a Masked
>> Textbox is not an option.
>
> Hmmm... I've never needed one, so I never wrapped it. Can you create
> a ticket so that I don't forget to add this to the Class Designer?
>
>> Hand coding in dabo is still a mystery to me so if I have a panel
>> with a vertical sizer with 3 slots in it and the first slot has a
>> grid in it. How would I add a Masked Textbox to the middle slot?
>
> You can't add one to the Class Designer and interact with it; the
> 'wrapping' I mention is the glue that lets the Class Designer
> interact with the control.
> You could do it in code, but it would be tricky, since you'd have to
> find the panel that would be created by the empty slot, get its
> parent, sizer position and settings, remove the panel, add the masked
> textbox to the parent, insert it into the sizer at the same position
> and apply the sizer settings.
Actually it seems to be easier than that to do. I opened the .cdxml
file for my test app and changed the line <dTextBox... to
<dMaskedTextBox.. After saving it and opening the CD it showed in the
Properties sheet as a dMaskedTextBox. I was able to give it a RegId and
change the border spacing. It respected changes I made using Edit Sizer
Settings control. Down in the EditCode section it showed up but had no
methods. I clicked on the New button and added the method:
def afterInit(self):
self.setProperties({"Mask":"A{2} - #{3}"})
I saved it and ran the form and it worked just like I expected a
dMaskedTextBox to work. It displayed a textbox with a - in it. To the
left of the - it would accept only 2 uppercase letters and 3 numbers to
the right. I printed its value and got the 2 letters and 3 numbers with
no - . To be sure I shutdown the CD and ran it from the cmdline and it
still worked as expected.
So from this limited testing is seems you can without too much trouble
use a dMaskedTextBox in the CD. I'm going to backup a project I am
working on and try to replace a normal textbox with a masked one and see
if it still works.
> An easier way to play with the class is to simply run it. Every
> control class has self-test code which is run if you run the
> control's script directly. IOW, cd to the 'uiwx' directory, and run:
>
> python dMaskedTextBox.py
>
> Feel free to modify the code in the block beginning with: if __name__
> == "__main__" if you want to try stuff out.
>
> -- Ed Leafe
>
Regards, Jim
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]