Click here to Skip to main content
Click here to Skip to main content

Dialog Shortcut Consistency Checker

, 16 May 2000
Rate this:
Please Sign up or sign in to vote.
A tool to check the consistency of your dialog shortcuts.

Introduction

Have you ever had the problem of trying to figure out what caption to use for a control, label, or button because you were running out of letters of the alphabet to underline? And then still get it wrong? Even a small dialog with a number of controls can be a nightmare.

This little utility program, which is written in awk, reads a resource file and for each dialog indicates what letters you have underlined. It can even run as a tool under Visual Studio.

Unlike the Developer Studio "Check Mnemonics" menu item, this gives you a complete picture across all your dialogs. I often print the listings out and use them to cross-check that I've used consistent shortcuts for the same concept in all dialogs. And unlike the "Check Mnemonics", it doesn't stop on the first one, or force you to go past the one you know conflicts to find the next one.

Actually, although the program is little, the downloadable executable is large because it contains the entire awk runtime, which is the only way I can legally redistribute a compiled awk binary. If you have an awk system of your own (there are several public domain versions, as well as a few free downloads around) you should be able to run it. However, I compiled it using Thompson Automation tawk 5.0, and don't guarantee that it will compile or run in other awk systems. If you have a problem and can get around it, let me know and send me the modified source file, and I'll see about integrating it into a more vendor-neutral awk. However, the tawk system is quite nice, comes with a native code compiler, and complete documentation. It is a product I have used for many years (since its original 1.0 release under a different vendor) and I recommend it highly.

For each dialog, it first prints out all the text/captions which have no shortcuts assigned, then for each assigned shortcut letter, prints out the text/captions that are assigned to that letter. A conflict is shown by printing "***" at the start of the line that contains the conflict. This is illustrated below, an excerpt from the listing for one project I did.

--------------------------------------------------------------------------
IDD_TRACE_OPTIONS
C 	"Trace &COM port traffic"
D 	"Master &Debug"
 *** 	"Trace Threa&ds"
F 	"Trace &Finder"
G 	"Lo&g to file"
I 	"Trace &Input"
K 	"Trace Loc&ks"
L 	"&Launch Logger"
M 	"&Memory Check"
O 	"Trace &Output"
Q 	"Trace &Queue operations"
U 	"Trace &Update logic"
W 	"Trace Dynamic &Window Management"

To use it, if you have downloaded the executable, you can type

dialogs whatever.rc

or to get the output stored to a file

dialogs whatever.rc > whatever.lst

If you are using your own awk, the command line will probably look something like the one below, which works with Thompson Automation awk:

myawk -f dialogs.awk whatever.rc > whatever.lst

If you want to add it to VC++ 6.0, go to the Tools menu, choose Customize, use the "New" icon to create a new entry. For the tool name, use something like Dialog Checker. For the executable, type the location where you have put the executable, or the command line you use to activate the awk script. Then for the arguments, use the string

$(FileDir)\$(WkspName).rc

(this assumes that your .rc file has the same name as your workspace, which is typical). Select the option to use an output window. Now you can invoke the checker as a VC++ tool. You will get the output in a window whose tab name is "Dialog Checker" or whatever other name you chose.

The executable is compiled as a standalone tawk executable. If you already have Thomson Automation's tawk compiler or some other awk program, you can just download the source. I use a function 'toupper' which is not part of standard awk, but otherwise I don't think I use anything unusual that other awk variants don't have.


The views expressed in these essays are those of the author, and in no way represent, nor are they endorsed by, Microsoft.

Send mail to newcomer@flounder.com with questions or comments about this article.
Copyright © 1999 <!--webbot bot="Substitution" s-variable="CompanyLongName" startspan -->The Joseph M. Newcomer Co.<!--webbot bot="Substitution" endspan i-checksum="64444" --> All Rights Reserved.
www.flounder.com/mvp_tips.htm

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Joseph M. Newcomer

United States United States
No Biography provided

Comments and Discussions

 
GeneralAdding support for CTEXT PinmemberRob Hudson4-Oct-05 22:46 
GeneralNice, could be extended to menus also PinsussAnonymous26-Jul-02 0:47 
GeneralRe: Nice, could be extended to menus also PinmemberRob Hudson7-Sep-05 1:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 17 May 2000
Article Copyright 2000 by Joseph M. Newcomer
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid