Re: Dynamic Dialog
- From: Ramesh <Ramesh@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 13 Jun 2005 20:34:02 -0700
I will try out your suggestion Scott, thanks.
But then, the resource IDs should already have been defined during design
time, right? Is there no way we can define the whole thing during run time
i.e., adding the control, defining the resource ID, assigning event handler,
etc (I guess not)?
"Scott McPhillips [MVP]" wrote:
> Ramesh wrote:
>
> > Scott,
> >
> > Thanks very much for the quick reply. The reason I have to add them
> > dynamically as opposed to during design time is because the number strings
> > available in the registry is variable.
> >
> > If you can throw some light (i.e., sample code) on how to add the event
> > handlers to the dynamically added controls that will be really helpful. I am
> > not familiar with the ON_CONTROL_RANGE macro.
> >
> > Thanks again
> >
> > K. Ramesh
>
> If you know the maximum number of strings then dynamic creation is not
> necessary. Just put the maximum number on the resource template. The
> number of controls that you make visible can be dynamic (and the size of
> the dialog can be dynamic).
>
> To handle a message from dynamically created controls you first select
> an unused range of ID values to be used for the controls. Define them
> in resource.h:
> #define IDC_RADIO_0 2000
> #define IDC_RADIO_4
>
> Add to message map:
> ....
> ON_CONTROL_RANGE(BN_CLICKED, IDC_RADIO_0, IDC_RADIO_4, OnClickedRadio)
> END_MESSAGE_MAP()
>
> void CSomeView::OnClickedRadio(UINT nID)
> {
>
> }
>
> --
> Scott McPhillips [VC++ MVP]
>
>
.
- Follow-Ups:
- Re: Dynamic Dialog
- From: Scott McPhillips [MVP]
- Re: Dynamic Dialog
- References:
- Dynamic Dialog
- From: Ramesh
- Re: Dynamic Dialog
- From: Scott McPhillips [MVP]
- Re: Dynamic Dialog
- From: Ramesh
- Re: Dynamic Dialog
- From: Scott McPhillips [MVP]
- Dynamic Dialog
- Prev by Date: Re: CoCreateInstance return REGDB_E_CLASSNOTREG
- Next by Date: Re: Message Compiler
- Previous by thread: Re: Dynamic Dialog
- Next by thread: Re: Dynamic Dialog
- Index(es):
Relevant Pages
|