Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder 2 Preview » View Thread |
Messages 1 to 3 of 3 total |
Dynamic checkbox creation |
Thu, Apr 30 2015 7:12 PM | Permanent Link |
Kane Jun EZ-Tech, Inc | Hi all
I am trying to create checkbox dynamically with following code in EWB2. with tcheckbox.create(panel1) do begin caption:= 'x'; // <--- This line cause compiler error ... end; So I work around with this c:tcheckbox; c:=tcheckbox.create(nil); c.parent:=panel1; However if I do this when I iterating component, componentcount of panel1 does not count c. Any help would be appreciated. |
Thu, Apr 30 2015 10:25 PM | Permanent Link |
Raul Team Elevate | On 4/30/2015 7:12 PM, Kane Jun wrote:
> I am trying to create checkbox dynamically with following code in EWB2. > with tcheckbox.create(panel1) do > begin > caption:= 'x'; // <--- This line cause compiler error > ... > end; I'm seeing it here also but just for caption - other other properties work just fine though. for example this is ok: with TCheckBox.create(self) do begin name := 'MyDynamicCheckbox'; Parent := BasicPanel2 ; end; Would need Tim to comment. > c:tcheckbox; > > c:=tcheckbox.create(nil); > c.parent:=panel1; > > However if I do this when I iterating component, componentcount of panel1 does not count c. Yes - because you set the owner to nil (create(nil)) and componentcount represents objects owned by the panel. Parent property is for controls contained within the panel so in your case above your panel1.ControlCount would be 1 (the checkbox) while componentcount would be 0 (since panel is just parent and not owner of checkbox). As an example you could do what IDE does with something like this : with TCheckBox.create(self) do begin Parent := panel1; name := 'MyDynamicCheckbox'; //... end; and then loop thru control like this : for i := 0 to panel1.ControlCount -1 do begin //do something with the control end; Raul |
Fri, May 1 2015 6:34 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Kane,
<< I am trying to create checkbox dynamically with following code in EWB2. with tcheckbox.create(panel1) do begin caption:= 'x'; // <--- This line cause compiler error ... end; >> Yep, this is a bug and will be fixed in the final release. Thanks, Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, April 19, 2024 at 07:09 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |