Dialog with dynamic number of edit boxes - Programmer
This is a discussion on Dialog with dynamic number of edit boxes - Programmer ; I want to make a dialog window with non-fixed number of edit boxes. Is
there an easy way to do this with MFC? It seems like this is not the
job for dialog editor.
Any suggestion for an alternative solution ...
-
Dialog with dynamic number of edit boxes
I want to make a dialog window with non-fixed number of edit boxes. Is
there an easy way to do this with MFC? It seems like this is not the
job for dialog editor.
Any suggestion for an alternative solution would also be
appreciated... I just need to input a number of values, except that I
don't know beforehand how many (it will be known before the dialog is
created). Sample code or outline would be nice...
Thanks for any help,
David
-
Re: Dialog with dynamic number of edit boxes
David Ananas wrote:
> I want to make a dialog window with non-fixed number of edit boxes. Is
> there an easy way to do this with MFC? It seems like this is not the
> job for dialog editor.
>
> Any suggestion for an alternative solution would also be
> appreciated... I just need to input a number of values, except that I
> don't know beforehand how many (it will be known before the dialog is
> created). Sample code or outline would be nice...
>
> Thanks for any help,
>
> David
An easy alternative solution is to create the maximum required number of
edit boxes with the dialog resource editor. At run time you make some
of them invisible with m_edit[n].ShowWindow().
But if you prefer you can create them at runtime.
m_pEdit[n] = new CEdit();
m_pEdit[n]->Create(...);
To handle messages sent by dynamically created controls you can type in
an ON_CONTROL_RANGE macro in the dialog message map.
--
Scott McPhillips [VC++ MVP]
-
Re: Dialog with dynamic number of edit boxes
On Fri, 05 Mar 2004 19:41:01 -0500, "Scott McPhillips [MVP]"
wrote:
>David Ananas wrote:
>> I want to make a dialog window with non-fixed number of edit boxes. Is
>> there an easy way to do this with MFC? It seems like this is not the
>> job for dialog editor.
>>
>> Any suggestion for an alternative solution would also be
>> appreciated... I just need to input a number of values, except that I
>> don't know beforehand how many (it will be known before the dialog is
>> created). Sample code or outline would be nice...
>>
>> Thanks for any help,
>>
>> David
>
>An easy alternative solution is to create the maximum required number of
>edit boxes with the dialog resource editor. At run time you make some
>of them invisible with m_edit[n].ShowWindow().
>
>But if you prefer you can create them at runtime.
> m_pEdit[n] = new CEdit();
> m_pEdit[n]->Create(...);
>To handle messages sent by dynamically created controls you can type in
>an ON_CONTROL_RANGE macro in the dialog message map.
>
>--
>Scott McPhillips [VC++ MVP]
In addition to what Scott says, note that you can override PreCreateWindow to
adjust the size of your dialog box so that it all looks nice and neat.
Dynamic resizing is also possible, although it is often a bit of a fiddle to get
it 'bit perfect'.
Quandon