Re: Units of Measure in Edit Controls

From: Dan McCarty (dmccarty_at_gmail.com)
Date: 12/28/04


Date: 28 Dec 2004 12:07:55 -0800

Seeing how no one has replied yet,* maybe I should be more specific
about my app.

I have an app that I'm moving to WinCE (4.2) with MFC and there are a
number of complicated dialogs--about 30--that each contain a number of
various fields. In each dialog there are a lot of different units of
measure in use. (e.g., 5.08 metres, 185 PSI, 1.8 in, 200 mm, 1.2 ms, 2
s, etc.).

Instead of maintaining a separate chunk of code in each dialog like
this...
value.Format("%d ms", m_value1)
c_value1.SetWindowText(value)
value.Format("%d ms", m_value2)
c_value2.SetWindowText(value)
...
...ad infinitum

...I thought that I might be able to come up with a custom property or
number for each field that defines its units of measure and store that
value along with the field.

Could I set the field's label's caption to something like "%d ms" and
store it as the format as the dialog init'd, then use that value to
format the field later? Alternatively, could I use a global handler
and use the unique field ID (I will maintain nightly vigil over the
resource file to make sure they are unique) to retrieve the field's
formatting? Alternatively, could I just shoot my foot off for coming
up with such silly ideas? I don't know, are they silly?

I guess my real problem is that I'm not very familiar with MFC. I'm
sure that this must be an easy problem, but I'm just not bright enough
to see the easy solution. I've spent some time running Google and
Usenet searches but haven't come up with anything. There are only n
types of units of measure, so there must be some way to store which
type of n belongs to each field, but I just don't see how to do it.

Thanks in advance for any help,
Dan.

* Whenever I post something and don't get any replies, I like to
convince myself that my question was just too specific and advanced for
everybody. But it usually turns out that I was just so far off the
deep end that everyone ignored me.



Relevant Pages

  • A good way to store data/values? (vb.net, compact framework)
    ... I need to store type, date, description, and total for each ... effectively use xml as an ini replacement. ... What bothers me is that the answer is rite there in that example app ... my history table, not to mention store a balance total and all the ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Threading question
    ... A program has a main execution thread, ... You go to the store to buy something. ... > In my real app I'm crunching numbers (entirely in C#, ... > "Kevin Spencer" wrote in message ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Time Machine Troubles
    ... store Mac applications. ... And quite a few people use such volumes to store data. ... The security hole in the app is exploited. ... Though this is, admittedly, mostly because Windows users ...
    (comp.sys.mac.advocacy)
  • Re: Newbie: Saving as Word doc
    ... I've inherited a VB app that experts here say is poorly written. ... Merely changing a file's extension does NOT "convert" that ... application has to support the file's format). ... > goes back into the folder, opens every doc, and resaves it as a Word doc. ...
    (microsoft.public.vb.general.discussion)
  • Re: Output to text files or a database?
    ... This software has to do with the retrieval and processing of travel ... With plain text files being the universally loved file format, ... Another small app would read these text files, ... from the database, after all. ...
    (comp.unix.programmer)