My.ADVISOR.com Sign-In
ID
Password

Member Center / Sign-Up
   
SUBSCRIPTION STATUS
If you are a subscriber to this publication, sign-in to access locked articles. To subscribe or renew go to www.AdvisorStore.com.
Go to Article
Advanced Search 

WINDOWS VISTA

Using Windows Features in Microsoft Visual FoxPro Applications

The Windows Vista User Interface gets a well-needed makeover, yet how can you make it work for you?

 Subscribers: Sign-in to activate download link
By Doug Hennig


With the rollout of Windows Vista, we have to think about new and modern ways to display and present information in VFP applications. The new version of Windows gives us far more configuration power then before, but it requires us to spend some extra time to learn all the new features in Vista. In the first of this two-part article on how to create Windows Vista-compatible VFP applications, I discussed the ways Vista impacts VFP applications, with a focus on security, folder and Registry virtualization, and deployment. In this article, I’ll go over opportunities to take advantage of new Vista features, including user interface improvements, Windows Desktop Search, RSS feeds, and XML Paper Specification.

Figure 1: Font vs. Font — FontTest.SCX shows the relative sizes of text in Segoe UI vs. Tahoma vs. Arial.

User Interface

One of the first things you notice about Vista is that its user interface is much more attractive than its previous versions. While some decry this as "eye candy," having a great looking desktop makes using your computer more interesting and fun and hopefully makes you more productive, although that's tough to measure.
There are several things you can do with your VFP applications to make them more Vista-like, including selecting Vista fonts, using the new dialogs, and creating new icons.

Font Selection
Operating systems before Vista use MS Sans Serif as the system font. MS Sans Serif isn't a TrueType or ClearType font, so it doesn't scale very well at different resolutions, making it difficult to create a form that looks good under all conditions **Possible Pull Quote**. As a result, most VFP developers use the default font for VFP controls, Arial, or some other TrueType font (I prefer Tahoma), which means VFP forms look different than system dialogs.

Vista introduces a new system font: Segoe UI (pronounced "SEE-go"). It's a ClearType font designed specifically for user interfaces. As a result, it scales nicely and is the recommended font for all dialogs. For more information about Segoe UI, see http://msdn2.microsoft.com/en-us/library/aa511295.aspx.

As you can see in Table 1, Segoe UI's font characteristics are similar to Tahoma. Note that the average character width (FONTMETRIC(6)) for Segoe UI is slightly larger than Tahoma but the maximum width (FONTMETRIC(7)) is slightly smaller. As a result, strings tend to be roughly the same width in both fonts, and both are a little smaller than Arial text.

The source code for this article includes FontTest.SCX (figure 1), which shows the relative sizes of text in Segoe UI vs. Tahoma vs. Arial. Enter the text and the size to test, then click the Measure TXT button to measure the text size as it would appear in a form (using TXTWIDTH(Text, Font, Size) * FONTMETRIC(6, Text, Font, Size)) or the Measure GDI+ button to measure the text size as it would appear in a report (using the FFC GDI+ classes).

Because your applications may run on both Windows Vista and older operating systems, you may wish to use Segoe UI when the application runs on Vista and Tahoma when it runs on Windows XP or earlier. To do this, change your base classes to select the font based on the operating system using code similar to this in the Init method:

if os(3) >= '6'
  This.FontName = 'Segoe UI'
else
  This.FontName = 'Tahoma'
endif os(3) >= '6'


Table 1: The font characteristics of Segoe UI are similar to Tahoma.
Font NameFONTMENTRIC(6) 9pt.FONTMETRIC (7) 9pt. FONTMENTRIC(6) 14pt.FONTMETRIC (7) 14pt.
Tahoma525840
Segoe UI6221036
Arial532851

Doug HennigDoug Hennig is the author of Stonefield Database Toolkit (SDT), Stonefield Query, MemberData Editor, Anchor Editor, and CursorAdapter and DataEnvironment builders that come with Microsoft Visual FoxPro, and the My namespace and updated Upsizing Wizard in Sedna. Doug is co-author of the "What’s New in Visual FoxPro" series. He has spoken at every Microsoft FoxPro Developers Conference since 1997 and at user groups and developer conferences in several countries. Doug has been a Microsoft Most Valuable Professional (MVP) since 1996, and was awarded the 2006 FoxPro Community Lifetime Achievement Award. http://www.stonefield.com, http://www.stonefieldquery.com, http://doughennig.blogspot.com dhennig@stonefield.com

Printer-friendly
page layout

Using Windows Features in VFP Applications

No reader comments ... yet.

    What do YOU think about this topic? Share your advice and thoughts using this form.

    Your Name

    REQUIRED : PUBLIC

    Your E-Mail

    REQUIRED : PRIVATE

    Job, Company

    OPTIONAL : PUBLIC

    City, State, Country

    OPTIONAL : PUBLIC

    Your Web Site

    OPTIONAL : PUBLIC

    Your Comment

    Please help everyone by keeping your comments on-topic, using clean language, and not defaming or making personal attacks.


    Your e-mail address is required, but it will not be displayed to the public or given to anyone. See our Privacy Policy. Comments become visible after they pass our spam filter, and spammers and abusers are permanently blocked. Please report spam or abuse.

    ARTICLE INFO

    Web Edition: 2007 Week 42, Doc #19195

    FREE ACCESS FREE ACCESS



    Subscribers, sign-in for Download link.

    Keyword Tags: Application Development, Development, Microsoft, Microsoft Visual FoxPro, Microsoft Windows, Microsoft .NET Framework, Security, User Interface, XML

    Use of this or any other site, content, product or service of Advisor Media constitutes acceptance of Terms of Use.
    Portions copyright ©1983-2010 Advisor Media, LLC. All Rights Reserved.
    Reuse or reproduction of any portion or quantity of Advisor Media's copyrighted content, in any form, for any purpose, requires written permission.
    ADVISOR®, the ADVISOR logo, and other names and logos that incorporate ADVISOR are registered trademarks, trademarks or service marks of Advisor Media, LLC in the United States and/or other countries.
    Other trademarks are used for identification, editorial or descriptive purposes and are the property of their owners.
    Hosted by Prominic.NET Website powered by
    LOTUS SOFTWARE
    ztmsvf0709 hennd11 posted 2007-10-15 mod 03/08/2010 03:10:03 AM ztdbms/ztdbms
    domino-144.advisor.com my.advisor.com 03/11/2010 10:46:45 AM