When I want to group a bunch of text boxes together to perform the same function - like clear the text, I add them an OBJECT[] and loop through it.
So, I usually add them into the array inside _new() or _init() then I can loop through the object array to perform something. OBJECT[] elements are just pointers to the Textbox (or whatever control you want) so it is fairly tight. I also like this because I can use different OBJECT[] to help control the same Textboxes, but for different reasons. I do this for speed at the expense of another array without having IFs tested inside the loop. (you may think the speed difference might be trivial, but it is important to me) Also, remove or delete all the items in OBJECT[] if you destroy the controls. You may have pointers pointing to invalid/unused memory. -Nando ---------- Original Message ----------- From: Charlie <[email protected]> To: [email protected] Sent: Fri, 13 Dec 2013 05:47:34 -0800 (PST) Subject: Re: [Gambas-user] How do you deal with multiple objects (Textboxes) > Hi Richard, > > Thanks for the reply. Here is the code I am using. I thought there must be a > better way. > > Charlie. > > Public Sub ClearTable() > QTY1.text = "" > QTY2.text = "" > QTY3.text = "" > QTY4.text = "" > QTY5.text = "" > QTY6.text = "" > QTY7.text = "" > QTY8.text = "" > QTY9.text = "" > QTY10.text = "" > WH1.text = "" > WH2.text = "" > WH3.text = "" > WH4.text = "" > WH5.text = "" > WH6.text = "" > WH7.text = "" > WH8.text = "" > WH9.text = "" > WH10.text = "" > PTNO1.text = "" > PTNO2.text = "" > PTNO3.text = "" > PTNO4.text = "" > PTNO5.text = "" > PTNO6.text = "" > PTNO7.text = "" > PTNO8.text = "" > PTNO9.text = "" > PTNO10.text = "" > BookInOut1.Hide > BookInOut2.Hide > BookInOut3.Hide > BookInOut4.Hide > BookInOut5.Hide > BookInOut7.Hide > BookInOut8.Hide > BookInOut9.Hide > BookInOut10.Hide > Desc1.text = "" > Desc2.text = "" > Desc3.text = "" > Desc4.text = "" > Desc5.text = "" > Desc6.text = "" > Desc7.text = "" > Desc9.text = "" > Desc9.text = "" > Desc10.text = "" > > -- > View this message in context: > http://gambas.8142.n7.nabble.com/How-do-you-deal- > with-multiple-objects-Textboxes-tp44646p44655.html Sent from the gambas-user > mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Rapidly troubleshoot problems before they affect your business. Most IT > organizations don't have a clear picture of how application performance > affects their revenue. With AppDynamics, you get 100% visibility into your > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk > _______________________________________________ > Gambas-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gambas-user ------- End of Original Message ------- ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
