Hello
I am converting a b4A app to B4I and am stuck on this.
i need to be able to update the screen after every
change to the Grid array variable and the corresponding gridlabel color made
by the code.
This is some demonstration code to show the problem i am having.
If you have a solution then please tell me and what you would like for it.
Many Thanks
John
I am converting a b4A app to B4I and am stuck on this.
i need to be able to update the screen after every
change to the Grid array variable and the corresponding gridlabel color made
by the code.
This is some demonstration code to show the problem i am having.
If you have a solution then please tell me and what you would like for it.
Many Thanks
John
B4X:
Sub Process_Globals
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Dim Grid(10,10) As Int
Dim GridLabel (10*10) As Label
Dim Xsize,Ysize As Float
Dim XPlay,YPlay As Int
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
NavControl.ShowPage(Page1)
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
Xsize = 100%x / 10
Ysize = 100%y / 10
Dim Index As Int
For x=0 To 10-1
For y=0 To 10-1
Index = x+(y*9)
GridLabel(Index).Initialize ("LabelEvent")
GridLabel(Index).Text = "Label "&Index
GridLabel(Index).Tag = Index
Page1.RootPanel.AddView (GridLabel(Index),x*Xsize,y*Ysize,Xsize,Ysize)
Next
Next
'This loop is to demonstrate a call from code.
'The display updates at the end of the loop
'I need it to update after every change to grid array variable.
'
For k=0 To 10000
UpdateCell
Next
End Sub
Private Sub Application_Background
End Sub
Sub UpdateCell
XPlay = Rnd(0,10)
YPlay = Rnd(0,10)
Grid(XPlay,YPlay) = Colors.RGB(Rnd(0,255),Rnd(0,255),Rnd(0,255))
GridLabel(XPlay+(YPlay*9)).Color = Grid(XPlay,YPlay)
End Sub