Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!crdgw1!sagittarius!dixon From: dixon@sagittarius.crd.ge.com (walt dixon) Newsgroups: comp.windows.ms.programmer Subject: edit controls containing floating point numbers Message-ID: <18368@crdgw1.crd.ge.com> Date: 9 Apr 91 17:37:45 GMT Sender: news@crdgw1.crd.ge.com Reply-To: dixon@crd.ge.com (walt dixon) Organization: General Electric Corp. R&D, Schenectady, NY Lines: 41 I am in the process of writing my first serious windows application. This program works with floating point numbers and occasionally must accept input/display output in a dialog box. I seem to be standing on my head to work with floating point numbers, so I am appealing to the collective wisdom of the net for a better solution. I am currently working with a small memory model and explicitly naming text segments. I have written far procedures that call relevant library routines, ie char * far lib_gcvt(...) { gcvt(...) } These interface procedures are in the default TEXT segment so there are no problems using the small model libraries. I'm using this technique so I don't clutter up my TEXT segment with a lot of dialog procedures. I reasoned that the conversions were complex enough and called infrequently enough that the extra call overhead is insignificant. This approach seems reasonable. Where I am having difficulty is detecting invalid numbers. My current solution is to subclass the edit controls. Whenever one of these controls looses input focus, I retrieve the text string and try to do a floating point conversion. If the conversion fails, I beep and reset focus. I know there are some problems with this approach. Does anyone have any suggestions? Please respond direcly to me and I will post a summary. Thanks Walt Dixon {internet: dixon@crd.ge.com } {us mail: ge-crd } { po box 8 } { schenectady, ny 12301 } {phone: 518-387-5798 (W) } { 518-875-6203 (H) } Walt Dixon dixon@crd.ge.com