Re: Dynamic Dialog

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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]
>
>
.



Relevant Pages

  • Controls which support Transparent background
    ... Framework and Microsoft vision of the future. ... VDS offers you complete set of Visual Controls, ... Separated modules for run-time and design time modes. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Software and a Perfect Society
    ... They don't buy future security problems. ... The developers have chosen to include this for "service and ... features" and failed to put in proper controls at the start, ... if design "right" this could all be avoided. ...
    (comp.dcom.telecom)
  • CORCS09 - Call for papers
    ... and practical aspects of component based design of such systems. ... Any submission whose content is relevant to the area of resource ... Papers must be submitted electronically via the CORCS 2009 Submission Page. ...
    (comp.specification.z)
  • CORCS09 - Call for papers - Extended submission
    ... and practical aspects of component based design of such systems. ... Any submission whose content is relevant to the area of resource ... Papers must be submitted electronically via the CORCS 2009 Submission ...
    (comp.specification.z)
  • Re: Resource Levleing Calculations
    ... For each Drawing, we: ... Design (with the resource). ... Production Operations Build schedule. ...
    (microsoft.public.project)