Can a grid column be masked?

View: New views
3 Messages — Rating Filter:   Alert me  

Can a grid column be masked?

by Steve Rose-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a form with a pageframe. The detail page has a maskedTextBox to
display and edit a phone number and is constructed this way:
dabo.ui.dMaskedTextBox(self,Width=100,DataSource =
"address",DataField="HomePhone",Mask="###-###-####"). This displays as
expected, i.e., 555-222-1111. Data saved to the table from the maskedTextBox
is saved without the dashes. On the first page I have a grid displaying
records from the same table. One column is linked to the phone number but
displays the phone number without the dashes, i.e., 5552221111. Is there a
way to format this column so it appears as phone number with the dashes? Or
should I be approaching this thing another way?

Any help appreciated.


Steve Rose


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: Dabo-users@...
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/28cfef1c0807171922m2a9901bp9749d65cf0f2b060@...

Re: Can a grid column be masked?

by Paul McNett :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steve Rose wrote:

> I have a form with a pageframe. The detail page has a maskedTextBox to
> display and edit a phone number and is constructed this way:
> dabo.ui.dMaskedTextBox(self,Width=100,DataSource =
> "address",DataField="HomePhone",Mask="###-###-####"). This displays as
> expected, i.e., 555-222-1111. Data saved to the table from the maskedTextBox
> is saved without the dashes. On the first page I have a grid displaying
> records from the same table. One column is linked to the phone number but
> displays the phone number without the dashes, i.e., 5552221111. Is there a
> way to format this column so it appears as phone number with the dashes? Or
> should I be approaching this thing another way?
>
> Any help appreciated.

Until we get a masked grid renderer, you can set up a VirtualField in
your bizobj to force it. IOW something like:

class MyBiz(dabo.biz.dBizobj):
   self.VirtualFields["masked_phone_num"] = self.getMaskedPhone

   def getMaskedPhone(self):
     phone = self.Record.phone
     return "%s-%s-%s" % (phone[0:3], phone[3:6], phone[6:10])

And then make the DataField of that column "masked_phone_num".

Paul


_______________________________________________
Post Messages to: Dabo-users@...
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/488039A3.9020005@...

Re: Can a grid column be masked?

by Ed Leafe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jul 18, 2008, at 1:35 AM, Paul McNett wrote:

> Until we get a masked grid renderer, you can set up a VirtualField in
> your bizobj to force it. IOW something like:


        Steve, if you want to take a crack at creating a masked renderer, you  
can take a look at gridRenderers.py in the dabo.ui.uiwx directory. If  
it looks doable for you, we'll be glad to help with any questions. And  
if it works well, we'd love to add it to our "bag of tricks".

-- Ed Leafe





_______________________________________________
Post Messages to: Dabo-users@...
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/D098B8FD-892C-4918-B8E4-62CAF369D79E@...
LightInTheBox - Buy quality products at wholesale price