digitalmars.D.learn - accessing dfl objects
- Tyro[a.c.edwards] (18/18) May 05 2008 I should probably be posting this somewhere else but hopefully someone h...
- Milke Wey (22/45) May 06 2008 ntaining a number of text boxes, labels and a cancel and submit button. ...
- Tyro[a.c.edwards] (6/29) May 06 2008 Thanks for the assistance Mike... This works great if I'm trying to acce...
- Christian Hartung (17/50) May 08 2008 I think this should work:
I should probably be posting this somewhere else but hopefully someone here will be able to give me some advice. Following the examples provided with DFL, I have created a tabbed form containing a number of text boxes, labels and a cancel and submit button. onSubmit_click I need to save the information contained in the text boxes to a file, likewise onCancel_click, I need to set all textboxes to null. Problem is I'm not sure how to access all the different text boxes to save or update the values. all text boxes were created in the following manner: TextBox transactionData; // this is the only variable I use for textboxes with(transactionData = new TextBox) { // set properties; } control.add(transactionData) with(transactionData = new TextBox) { // set properties for new button; } control.add(transactionData) //etc... I've found that if I instantiate each TextBox at class scope, then I can access and update them later, however, since there will literally be hundreds of these boxes I don't want to have to declare a pointer to every single one. Is there another way? Any assistance is greatly appreciated. Andrew
May 05 2008
On Mon, 2008-05-05 at 23:35 -0400, Tyro[a.c.edwards] wrote:I should probably be posting this somewhere else but hopefully someone he=re will be able to give me some advice.=20 Following the examples provided with DFL, I have created a tabbed form co=ntaining a number of text boxes, labels and a cancel and submit button. onS= ubmit_click I need to save the information contained in the text boxes to a= file, likewise onCancel_click, I need to set all textboxes to null. Proble= m is I'm not sure how to access all the different text boxes to save or upd= ate the values.=20 all text boxes were created in the following manner: =20 TextBox transactionData; // this is the only variable I use for textboxes with(transactionData =3D new TextBox) { // set properties; } control.add(transactionData) with(transactionData =3D new TextBox) { // set properties for new button; } control.add(transactionData) //etc... =20 I've found that if I instantiate each TextBox at class scope, then I can =access and update them later, however, since there will literally be hundre= ds of these boxes I don't want to have to declare a pointer to every single= one. Is there another way?=20 Any assistance is greatly appreciated. AndrewI don't use DFL myself but looking at the on-line documentation something like this should do it. foreach(ctrl; control.controls) { =EF=BB=BFTextBox textBox =3D cast(=EF=BB=BFTextBox)ctrl; if ( textBox !is null ) { //Do something with the text box } } --=20 Mike Wey
May 06 2008
Milke Wey Wrote:On Mon, 2008-05-05 at 23:35 -0400, Tyro[a.c.edwards] wrote:[snip]Thanks for the assistance Mike... This works great if I'm trying to access the control itself, but in this case I'm trying to get to the objects embeded in the control. For example: I have a tabbed control with 7 tabs and each tab has a set of labels, buttons, and textboxes. This method allows me to access the properties of the tabbed control but I'm trying to find out how to access the textboxes on each tab. Thanks again, AndrewI've found that if I instantiate each TextBox at class scope, then I can access and update them later, however, since there will literally be hundreds of these boxes I don't want to have to declare a pointer to every single one. Is there another way? Any assistance is greatly appreciated. AndrewI don't use DFL myself but looking at the on-line documentation something like this should do it. foreach(ctrl; control.controls) { TextBox textBox = cast(TextBox)ctrl; if ( textBox !is null ) { //Do something with the text box } } -- Mike Wey
May 06 2008
Tyro[a.c.edwards] escreveu:Milke Wey Wrote:I think this should work: foreach(c; control.controls) { TabPage t = cast(TabPage)c; if(t !is null) { foreach(ctrl; t) { TextBox textBox = cast(TextBox)ctrl; if(textBox !is null) { // .... } } } }On Mon, 2008-05-05 at 23:35 -0400, Tyro[a.c.edwards] wrote:[snip]Thanks for the assistance Mike... This works great if I'm trying to access the control itself, but in this case I'm trying to get to the objects embeded in the control. For example: I have a tabbed control with 7 tabs and each tab has a set of labels, buttons, and textboxes. This method allows me to access the properties of the tabbed control but I'm trying to find out how to access the textboxes on each tab. Thanks again, AndrewI've found that if I instantiate each TextBox at class scope, then I can access and update them later, however, since there will literally be hundreds of these boxes I don't want to have to declare a pointer to every single one. Is there another way? Any assistance is greatly appreciated. AndrewI don't use DFL myself but looking at the on-line documentation something like this should do it. foreach(ctrl; control.controls) { TextBox textBox = cast(TextBox)ctrl; if ( textBox !is null ) { //Do something with the text box } } -- Mike Wey
May 08 2008