[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Updated CW_Field Replacements

Hi Folks,

Hope all of your computers survived the New Year! :-)

I kept waiting around for Struan to step into the breech
here and update my CW_FIELD replacement programs so that you
can specify the format of numbers in the field, but he must
have other things to do. :-)

So, anyway, since I found I needed this functionality 
myself, I went ahead and figured something out (although
I'm not sure this is what Struan had in mind when he made
the request for number formats in the field). It turns
out that actually formatting the numbers with a FORMAT
statement (which was how I originally unsuccessfully
approached the problem) is problematic, for several
reasons, but probably closely related to lousy initial
design choices.

But since all I really needed for my application is
a way to specify the number of digits to the right of
the decimal point in floating numbers and the number
of total digits in an integer number, I implemented
the functionality with new DECIMAL and DIGITS keywords.

The programs (which, as you recall, were designed
to solve the problem of CW_FIELD input fields not looking
editable on Windows machines) can be found here:


The first program is a "normal" compound widget and is
a drop-in replacement (with better functionality, obviously)
for CW_FIELD. The second program is the same as the first,
but written as an object compound widget to give people
some idea of how this is done.

Compiling either program will reveal an EXAMPLE program
at the bottom of the code that will exercise the program
functionality a bit for you, including this new formatting

As always, I appreciate the feedback.



David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155