[comp.windows.ms] Dialog Box I/O

eabg020@orion.oac.uci.edu (Donald Doherty) (09/12/90)

     I have been struggling with Dialog Box I/O and seem to
be getting nowhere.

     All I want to do is, upon initialization of the box, send
the floating point value of a parameter to an edit control.  While
the box is open the user has the option of changing that value.  If
he does, the new value must replace the old parameter.

     I have not even been able to do this successfully.  There seems
to be something fundamental that I am not understanding.  I would
like to eventually have the edit control tied with a scroll bar that
is set to a range of valid floating point numbers for the particular
parameter.  The value in the edit control would change with scroll
bar use and visa versa.

     Any help or suggestions (examples?) will be greatly appreciated.


Don D.

eabg020@orion.oac.uci.edu

rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) (09/12/90)

In article <26ED58C3.7051@orion.oac.uci.edu> eabg020@orion.oac.uci.edu (Donald Doherty) writes:
>
>     I have been struggling with Dialog Box I/O and seem to
>be getting nowhere.
>
>     All I want to do is, upon initialization of the box, send
>the floating point value of a parameter to an edit control.  While
>the box is open the user has the option of changing that value.  If
>he does, the new value must replace the old parameter.

Well, I don't have the SDK manual in mind and not here at this machine
too, but you should be able to do this by using sprintf() to print the
value to a small char array and then set it into the edit control using
one of the edit-contol messages (or even SetWindowText() ?) during
WM_INITDIALOG of the dialog box function. Oh, well, SetWindowText() may
only work with static controls, but there is a EM_SETTEXT message or
something similar (I used it long time ago) to send to the control using
a far pointer to the text as lParam. During WM_COMMAND with IDOK, you
can then retrieve the text from the control with EM_GETTEXT and use
strtod() to get a double value.

>     I have not even been able to do this successfully.  There seems
>to be something fundamental that I am not understanding.  I would
>like to eventually have the edit control tied with a scroll bar that
>is set to a range of valid floating point numbers for the particular
>parameter.  The value in the edit control would change with scroll
>bar use and visa versa.

You have to create a separate scollbar conrol on your box and handle
it's messages and set the edit control's contents during handling of
these scrollbar messages. The tracking of changes to the contents of the
edit control (to adapt the scollbar position) is not as easy as the
opposite case.

Kai Uwe Rommel

--
/* Kai Uwe Rommel
 * Munich
 * rommel@lan.informatik.tu-muenchen.dbp.de
 */