SetMask and AddInplaceButton issues |
Post Reply |
Author | |
mstuart
Groupie Joined: 06 April 2010 Location: United States Status: Offline Points: 36 |
Post Options
Thanks(0)
Posted: 14 April 2010 at 12:55pm |
Hi all,
I use the code included at the end of this (small portion), to load a PropertyGrid. Specifically this part of the code loads a phone number, and in the next item the phone extension. I need help with my implementation of the property grid and masks, because the UI end result of this is not what I would have expected. I would have hoped that using masks would give a better result. Here's some snapshots and comments of my property grid: 1) Notice after loading the phone number hasn't taken on the mask defined in the Item.SetMask code. I would have assumed the display value/caption would have taken on the mask format. Our software allows the user to define a setting for the telephone format for "local" phone numbers as well as international telephone numbers, by country. So this phone mask is not always the same for each account phone number. As well as our software is sold around the world, so each country defines their own local telephone format. What do I need to do to fix that? 2) The button margins are non-existent. I've added a space either side of the Caption text. After clicking into all 4 phone/fax number and extension items: 1) Value becomes bold. I didn't change the value. I'm assuming the mask was applied and therefore CJ sees it as a change. (.HighlightChangedItems = True) 2) Buttons are bold as well. Why? The value should be enough to know there was a change. 3) Button text is now cramped, hard to read. Adding space either side of Caption fixes this for now, but needs a Margin property. Is there one? 1) Extension item shows underscore "_", which I feel is not a pleasing UI look. What can I do to better this? 2) Clicking into the extension "field" when it has no value, puts the cursor at the END of the "field". Before being able to put a value in the "field", I have to click at the beginning of it. I would expect the cursor to go to the beginning, ready for me to start typing, without extra interaction needed. 3) I don't see what the SetMask Prompt part does. I have set it to " ". Not sure what this does. Final thoughts: I just really feel there could be a better implementation of masks. I could list some, but I'm sure you all have this handled by now. What have you discovered for masks that better implements the UI? VB6 partial code: Dim Category As PropertyGridItem Dim Item As PropertyGridItem Dim Button As PropertyGridInplaceButton 'load phone number Set Item = Category.AddChildItem(PropertyItemString, "Phone Number", rs.Fields(FID_PhoneNumber).Value) Item.SetMask "(000) 000-0000", "(___) ___-____" Set Button = Item.AddInplaceButton(1) Button.Caption = " Dial " Button.ToolTip = "Click to dial the number" Button.Enabled = Len(Item.Value) > 0 'load extension Set Item = Category.AddChildItem(PropertyItemString, " extension", rs.Fields(FID_PhoneExtension).Value) Item.SetMask "00000", "_____", " " |
|
Regards,
Mark Stuart Product: Xtreme SuitePro (ActiveX) v13.2.1 Platform: WinXP (32bit)/Win7 (64bit) Language: VB6 (SP6), Magic eDeveloper v9.4, uniPaaS v1.9 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
1. In this case you must format the value that is going into the constructor to match EXACTLY the Mask or it wont show on creation. So you must then set the MaskedText if you choose not to format before creation (will still be bold if you set format after, last line resets default value so it won't think it changed):
Set Item = Category.AddChildItem(PropertyItemString, "Phone", "") Item.SetMask "(000) 000-0000", "(___) ___-____" Item.MaskedText = rs.Fields(FID_PhoneNumber).Value Item.DefaultValue = Item.Value If you need different masks depending on country you can either check the systems regional settings and choose the appropriate mask, or just have some "options" dialog the user can open and set their region or even mask. The cursor will be set wherever you click in the field...not always at the end. 2. I added wndPropertyGrid.HighlightChangedButtonItems so you can choose whether the button text will get bolded. I also fixed the width for bold text buttons. It was using the old width before the bold text. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |