PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Floating Date Mask
This tip was submitted by Jack Szczypa. This is a great tip especially useful for people who work with international applications.

If you decide on putting an edit mask for a date field in your Datawindow, PowerBuilder displays something like 00/00/0000. It looks OK but the user still does not know whether the first two zeros are to be month or day entry.

Here is what I do. On top of the Datawindow date field put a text object that looks exactly the same as the Datawindow field (same size, border, font etc.). Make sure to click 'Bring To Front' option for the text object. In the Properties window of the text object type following:

  1. General tab, Text Property:
    Type the visual representation of your date mask, for example: dd/mm/yyyy
  2. Expressions tab, Visible property:
    if ( IsNull (date_field_name), 1, 0 )

Now when user tabs to the field or clicks on it, the text object will hide and date field is open for entry. If user leaves the field with null value the text object will come into view again to display what kind of date format we need for this field.

You can download a sample of this great tip from the component download page.

 

Top of Page

Legal Notice

Ken Howe 2011