Android Question how to Backwards reference?

Discussion in 'Android Questions' started by Robert Valentino, Apr 7, 2015.

  1. Robert Valentino

    Robert Valentino Well-Known Member Licensed 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

    Code:
    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.

    Code:
    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Are you using the same layout file for multiple panels?
     
  3. Robert Valentino

    Robert Valentino Well-Known Member Licensed 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: Apr 8, 2015
  4. Robert Valentino

    Robert Valentino Well-Known Member Licensed 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:

    Code:
    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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice