|
From: Mikel on 13 May 2008 06:56 Hi all: I'm creating an edit control on the fly, to implement in-place editing on a CListCtrl, and I was wondering wether I need to define an ID for it in resource.h or I can use whatever value I choose safely. The CEdit::Create reference has this example, where they use '1' as the ID: void CMyView::OnInitialUpdate() { CView::OnInitialUpdate(); // dynamically create an edit control on the view CEdit* pEdit = new CEdit; pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(10, 10, 100, 100), this, 1); } I don't usually create controls on the fly so I'm not quite sure if this is safe or it's just looking for trouble. My first thought is that it's not really safe, but I'd like to know it for sure. Any ideas? Thanks in advance for your help Mikel
From: David Wilkinson on 13 May 2008 07:34 Mikel wrote: > Hi all: > I'm creating an edit control on the fly, to implement in-place editing > on a CListCtrl, and I was wondering wether I need to define an ID for > it in resource.h or I can use whatever value I choose safely. > > The CEdit::Create reference has this example, where they use '1' as > the ID: > > void CMyView::OnInitialUpdate() > { > CView::OnInitialUpdate(); > > // dynamically create an edit control on the view > CEdit* pEdit = new CEdit; > pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | > WS_BORDER, > CRect(10, 10, 100, 100), this, 1); > } > > I don't usually create controls on the fly so I'm not quite sure if > this is safe or it's just looking for trouble. My first thought is > that it's not really safe, but I'd like to know it for sure. Mikel: The ID's have to be unique in the dialog you are working on. 1 is probably not good because IDOK is 1 (and IDCANCEL is 2). -- David Wilkinson Visual C++ MVP
From: Joseph M. Newcomer on 13 May 2008 10:13 As already observed, 1 is an exceptionally bad choice here. I tend to create controls like this when I need to do this in the range of 10000-30000. joe On Tue, 13 May 2008 03:56:31 -0700 (PDT), Mikel <mikel.luri(a)gmail.com> wrote: >Hi all: >I'm creating an edit control on the fly, to implement in-place editing >on a CListCtrl, and I was wondering wether I need to define an ID for >it in resource.h or I can use whatever value I choose safely. > >The CEdit::Create reference has this example, where they use '1' as >the ID: > >void CMyView::OnInitialUpdate() >{ > CView::OnInitialUpdate(); > > // dynamically create an edit control on the view > CEdit* pEdit = new CEdit; > pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | >WS_BORDER, > CRect(10, 10, 100, 100), this, 1); >} > >I don't usually create controls on the fly so I'm not quite sure if >this is safe or it's just looking for trouble. My first thought is >that it's not really safe, but I'd like to know it for sure. > >Any ideas? > >Thanks in advance for your help >Mikel Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Mikel on 13 May 2008 10:35 On 13 mayo, 16:13, Joseph M. Newcomer <newco...(a)flounder.com> wrote: > As already observed, 1 is an exceptionally bad choice here. I tend to create controls > like this when I need to do this in the range of 10000-30000. > joe > > > > > > On Tue, 13 May 2008 03:56:31 -0700 (PDT), Mikel <mikel.l...(a)gmail.com> wrote: > >Hi all: > >I'm creating an edit control on the fly, to implement in-place editing > >on a CListCtrl, and I was wondering wether I need to define an ID for > >it in resource.h or I can use whatever value I choose safely. > > >The CEdit::Create reference has this example, where they use '1' as > >the ID: > > >void CMyView::OnInitialUpdate() > >{ > > CView::OnInitialUpdate(); > > > // dynamically create an edit control on the view > > CEdit* pEdit = new CEdit; > > pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | > >WS_BORDER, > > CRect(10, 10, 100, 100), this, 1); > >} > > >I don't usually create controls on the fly so I'm not quite sure if > >this is safe or it's just looking for trouble. My first thought is > >that it's not really safe, but I'd like to know it for sure. > > >Any ideas? > > >Thanks in advance for your help > >Mikel > > Joseph M. Newcomer [MVP] > email: newco...(a)flounder.com > Web:http://www.flounder.com > MVP Tips:http://www.flounder.com/mvp_tips.htm- Ocultar texto de la cita - > > - Mostrar texto de la cita - Thanks for your answers. I also felt that 1 was not the best choice, but since that's what they use in the example for CEdit::Create's documentation, I thought that maybe it was OK. Just one thought: why don't they write examples that are correct in the documentation?
From: AliR (VC++ MVP) on 13 May 2008 12:20 Just out of curiosity, shouldn't the parent of the edit control be the list control? AliR. P.S. I'm assuming that you are not happy with the default inplace editing capability of list controls "Mikel" <mikel.luri(a)gmail.com> wrote in message news:27a951a4-f101-4843-8aef-57ede81abefe(a)8g2000hse.googlegroups.com... On 13 mayo, 16:13, Joseph M. Newcomer <newco...(a)flounder.com> wrote: > As already observed, 1 is an exceptionally bad choice here. I tend to > create controls > like this when I need to do this in the range of 10000-30000. > joe > > > > > > On Tue, 13 May 2008 03:56:31 -0700 (PDT), Mikel <mikel.l...(a)gmail.com> > wrote: > >Hi all: > >I'm creating an edit control on the fly, to implement in-place editing > >on a CListCtrl, and I was wondering wether I need to define an ID for > >it in resource.h or I can use whatever value I choose safely. > > >The CEdit::Create reference has this example, where they use '1' as > >the ID: > > >void CMyView::OnInitialUpdate() > >{ > > CView::OnInitialUpdate(); > > > // dynamically create an edit control on the view > > CEdit* pEdit = new CEdit; > > pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | > >WS_BORDER, > > CRect(10, 10, 100, 100), this, 1); > >} > > >I don't usually create controls on the fly so I'm not quite sure if > >this is safe or it's just looking for trouble. My first thought is > >that it's not really safe, but I'd like to know it for sure. > > >Any ideas? > > >Thanks in advance for your help > >Mikel > > Joseph M. Newcomer [MVP] > email: newco...(a)flounder.com > Web:http://www.flounder.com > MVP Tips:http://www.flounder.com/mvp_tips.htm- Ocultar texto de la cita - > > - Mostrar texto de la cita - Thanks for your answers. I also felt that 1 was not the best choice, but since that's what they use in the example for CEdit::Create's documentation, I thought that maybe it was OK. Just one thought: why don't they write examples that are correct in the documentation?
|
Next
|
Last
Pages: 1 2 Prev: problem while calling UpdateData(false) in a loop Next: FREE GODADDY COUPON CODES |