Re: combo box default value by GuitarBill
GuitarBill
Fri Oct 01 04:19:59 CDT 2004
VC6 or 7?
Not familiar with 7 and I know this type of stuff did change...
But in 6: in ClassWizard/Member Variables select the combo box ID and 'Add
Variable', and select type 'Value'.
It will only allow mapping integer if it has the 'DropList' combo box style,
and only a CString if its a 'Dropdown' style.
Note: you can also create a 'Control' association (ie you can have both a
value mapping and a control interface), which is useful if you want to
manipulate the control, like adding items to the list.
I usually suffix control variable names with _ctrl so its clearer in the
cases when you have both (eg int m_droplist; CComboBox m_droplist_ctrl;)
Look into UpdateData() function, although this is done automatically during
InitDialog and OnOK processing... so as long as the value is set before
CDialog::OnInitDialog the control will come up with the item corresponding
to the integer; and after the dialog has been closed with an OK the integer
value will have been set as per list selection.
"Frank" <f_rubino@prodigy.net> wrote in message
news:1J57d.2008$5b1.1052@newssvr17.news.prodigy.com...
> Yes GuitarBill, it is a MFC dialog control. How exactly does one go about
> mapping it to an integer?
>
> "GuitarBill" <GuitarBill_at_cox_dot_net> wrote in message
> news:eRjxVerpEHA.2636@TK2MSFTNGP09.phx.gbl...
> > Is this is an MFC dialog control? If so you can map it to an integer and
> set
> > the default/initial value in the dialog's constructor (default is -1,
> > meaning nothing selected).
> >
> >
>
>
>