Solved

Prefix for Windows controls....

Posted on 2000-02-25
4
421 Views
Last Modified: 2013-11-20
I was reading through some of the Hungarian Notation, and I began to wonder about the prefixes in the variable names. If I create an edit control and use DDX to access it, what prefix should I use? Are there any standard prefixes to all Windows controls? Is it, m_edit...., m_combo and so on? All suggections are appreciated....
0
Comment
Question by:joakimf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Expert Comment

by:Deckmeister
ID: 2557460
Hi,

I use the same name than the control's ID. For instance, you create a editbox, a listbox and a tree control.
Then, you would have :
IDC_EDIT_DOGNAME   -> m_EditDogName
IDC_LIST_DOGS      -> m_ListDogs (usually I write m_ListOfDogs)
IDC_TREE_BREEDINGS -> m_TreeBreedings (or m_TreeOfBreedings)

And so on.
I think it works fine, because you always know the data type you work with.

But I don't know official standard prefixes to control variables.
0
 
LVL 12

Expert Comment

by:migel
ID: 2557961
Hi!
I usually use prefix m_wnd....CtrlType
where ... - is control name -
and CtrlType - is its type
for example for Edit control for input Num1:
m_wndNum1Edit
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 50 total points
ID: 2558989
> Are there any standard prefixes to all Windows controls?

No, there isn't. The Hungarian Whitepaper predates MFC by about three years.

Some people do this:

   m_wndFirstName
   m_wndLastName
   m_wndExempt

and that lets you know they're windows, but doesn't tell you the type.  Some people do

   m_editFirstName
   m_editLastName
   m_checkExempt  

and that's better (in my opinion).

It's really a preference thing, and you need to decide for yourself (and maybe your team or organization) what works best for you. Besides: nobody _really_ follows Hungarian fully, anyway.

..B ekiM
0
 
LVL 1

Author Comment

by:joakimf
ID: 2562273
Thanks for your comments
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question