PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: James Padgett on March 05, 2011, 11:43:48 AM

Title: Change text in multiple text boxes?
Post by: James Padgett on March 05, 2011, 11:43:48 AM
Are these two methods by best options for doing this?

Say I have 5 text boxes, FF_FORM1_Text1,...Text2 ...  etc...
If I want to set the text for each of them based on a loop counter say...
For x = 1 to 5
if x = 1 then FF_TextBox_SetText (HWND_FORM1_TEXT1, "One")
if x = 2 then FF_TextBox_SetText (HWND_FORM1_TEXT2, "Two")
if x = 3 then FF_TextBox_SetText (HWND_FORM1_TEXT3, "Three")

Or
Select Case x
   Case 1
        FF_TextBox_SetText (HWND_FORM1_TEXT1, "One")
   Case 2
        FF_TextBox_SetText (HWND_FORM1_TEXT2, "Two")
....



Title: Re: Change text in multiple text boxes?
Post by: Robert Eaton on March 05, 2011, 02:14:46 PM
I'm certainly not the expert in the room here, but best in what respect?

Select case is probably going to be faster if you're dealing with integers. :-\
Title: Re: Change text in multiple text boxes?
Post by: Rolf Brandt on March 05, 2011, 03:09:03 PM
You could use a textbox array: Text1(0), Text1(1), etc.
and then
FF_TextBox_SetText (HWND_FORM1_TEXT1(x), TheText)

Title: Re: Change text in multiple text boxes?
Post by: Jim Dunn on March 05, 2011, 06:53:30 PM
I know Rolf meant:

   for x = 1 to 5
      FF_TextBox_SetText( HWND_FORM1_TEXT1(x), TheText(x) )
   next x

: )
Title: Re: Change text in multiple text boxes?
Post by: James Padgett on March 05, 2011, 08:53:26 PM
Sweet!!!!
I wasn't aware I could address controls that way...

Thanks....
Title: Re: Change text in multiple text boxes?
Post by: David Kenny on March 06, 2011, 02:47:50 AM
James,

Copy a control, then paste... A dialog will ask you if you want to create a control array.  Select yes. Pasting again will create a third one.  One thing you need to check is the sequence of the values in the Control Index Properties and, in the case of an option group, the Index Properties. Pasting controls, especially if you copy and paste multiple controls at a time, can leave those properties needing a manual touch up.  That should get you started.

David