Saving textfield background Color

[quote=113112:@Shane Rampling]Hi Oliver, there are 4 rows of textfields in the project and each row has 21 textfields, each row will have it’s own color selected at the start of the row.

Cheers Shane[/quote]
You could create 4 subclasses of Textfields and treat each one as described above.

OR: you could create a new ControlSet for each row of TextFields.

  1. Select the first Textfield in the row and rename it to something like Row1_TextField
  2. In the property inspector switch to the second panel (click the gear tab, next to ID)
  3. Choose Control Set, New Control Set
  4. Now select the Textfields of the same row and make them member of this new controlset
  5. Repeat steps 1-4 for each new row of textfields
  6. To color each row individually, add code as follows:

[code] Dim cRow1 As Color = &c66CCFF00
Dim cRow2 As Color = &cFFCC6600

Dim i,j As Integer
j = Window1.ControlCount

For i = 0 to j-1
If Window1.Control(i).Name=“Row1_TextField” Then
TextField(Window1.Control(i)).BackColor = cRow1

ElseIf Window1.Control(i).Name="Row2_TextField" Then
  TextField(Window1.Control(i)).BackColor = cRow2
  
End If

Next
[/code]

Note: In this second example you would not need to create subclasses

Exampleproject:
http://osswald.com/xojo/test/colortest2.xojo_binary_project.zip

Many thanks Oliver, will have a play around with the code, it is much appreciated.

Cheers Shane.