Android Question how to Backwards reference?

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Not sure if my title is correct.

I have a Designer Screen that is LoadLayout into a panel and I set the fields in it with no problems.
I save the panel in a Grid array and later I want to do something with this panel but there seems to be no way to get references to the fields without doing another LoadLayout

B4X:
    Dim  ScorePanel   As Panel
	
       Dim  Column       As TGridSystemInfo = mGrid.GetColumnInformation(RowID, ColID)
	

	   ScorePanel.Initialize("ScorePanel")

	   mGrid.SetColumnPanel(RowID, ColID, ScorePanel)
	
          ScorePanel.LoadLayout("sShowScore")

	   sShowScore_Screen.Color    = Column.ColumnInfo.Format.ColumnColors.BGColor
	   sShowScore_Score.TextColor = Column.ColumnInfo.Format.ColumnColors.FGColor	
	   sShowScore_Putts.TextColor = Column.ColumnInfo.Format.ColumnColors.FGColor
	   sShowScore_Total.TextColor = Column.ColumnInfo.Format.ColumnColors.FGColor
	   sShowScore_SandShots.Color     = Colors.Transparent

If I try the following somewhere else in the program.

B4X:
      Dim  ScorePanel   As Panel
	
      ScorePanel =  mGrid.GetColumnPanel(RowID, ColID, ScorePanel)
	
     '  The following fields which are part of   sShowScore.bal  are not available unless I do a LoadLayout

	   sShowScore_Screen.Color    = Column.ColumnInfo.Format.ColumnColors.BGColor
	   sShowScore_Score.TextColor = Column.ColumnInfo.Format.ColumnColors.FGColor	
	   sShowScore_Putts.TextColor = Column.ColumnInfo.Format.ColumnColors.FGColor
	   sShowScore_Total.TextColor = Column.ColumnInfo.Format.ColumnColors.FGColor
	   sShowScore_SandShots.Color     = Colors.Transparent

So every time I want to do something with this Grid panel I need to load it again.

Is there something I am missing or some way to get references to the fields without doing a LoadLayout.

Otherwise I guess there is no reason for me to save the Panel for later.

BobVal
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Yes. It is a grid cell display that changes

Would be nice if I could re-establish the links using the panel
 
Last edited:
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
OK, I figured out how to do what I wanted:

But saving what screen name it is in the Tag I can do the following:

B4X:
	ScorePanel = mGrid.GetColumnPanel(RowID, ColID)
	
	If ScorePanel <> Null Then
	   HaveScore_Panel = True
	   
	   For Each V As View In ScorePanel.GetAllViewsRecursive	   
	       Log("View:" &V.Tag)

           Select V.Tag
             Case "sShowScore_Screen"    : sShowScore_Screen     = V  :  HaveScore_Screen    = True				   
             Case "sShowScore_Score"     : sShowScore_Score      = V  :  HaveScore_Score     = True
             Case "sShowScore_Putts"     : sShowScore_Putts      = V  :  HaveScore_Putts     = True
             Case "sShowScore_Total"     : sShowScore_Total      = V  :  HaveScore_Total     = True
             Case "sShowScore_Hcp"       : sShowScore_Hcp        = V  :  HaveScore_Hcp       = True
             Case "sShowScore_SandShots" : sShowScore_SandShots  = V  :  HaveScore_SandShots = True
  	    Case "sShowScore_Penalties" : sShowScore_Penalties  = V  :  HaveScore_Penalties = True
           End Select		   
	   Next
    End If

So instead of recreating the screen fields every time I can check which ones I have already created and reuse them.

NOW is this a waste of time? What I am trying to do is speed things up and make sure I am not wasting any resources.

Anyway this idea seems to work just great.
 
Upvote 0
Top