View versus Custom Type Casting

CharlesIPTI

Active Member
Licensed User
Longtime User
How Do I get My Custom Types out of a panel holding them in my activity.. Its time to make them "look different" now that they have been modified by the user so its time to update the UI.. Sooo Please how do I get my Custom Types out of this panel I've placed them on, so I can update their content.
I have of course tried to get the object type directly from panOrderBinsBase instead of generically using view but that fails also ....
When I try to get current bin from custTyp as shown below I get this error:


Compiling code. 0.77
Compiling layouts code. 0.02
Generating R file. 0.00
Compiling generated Java code. Error
B4A line: 819
currentBin = custTyp
javac 1.7.0_03
src\ipti\rfpickcartandroid\postmain.java:7141: error: inconvertible types
_currentbin = (uilogic._t_orderbinobj)(_custtyp.getObject());Debug.locals.put("currentBin", _currentbin);
^
required: _t_orderbinobj
found: View
1 error



B4X:
Sub ResetBins


    For i = 0 To panOrderBinsBase.NumberOfViews - 1
      
                     Dim currentBin As t_orderBinObj
                     Dim sourcePanel As Panel
                     Dim objData As typ_OrdData
                     Dim subPanel As Panel
                     Dim custTyp As View                   
                     Dim binCrtl As t_orderBinObj   
                     
                  
         custTyp = panOrderBinsBase.GetView(i)         
         currentBin = custTyp                  
         'currentBin = panOrderBinsBase.GetView(i)
         
sourcePanel = currentBin.panelObj
objData = sourcePanel.Tag
Log("PoD Tag Info BinNo: " &  objData.i32BinNo)
Log("PoD Tag Info Color: " &  objData.ordCol)
Log("PoD Tag Info Msg: " &  objData.ordMessage)      

      'Log("*************   sourcePanel *********** " & sourcePanel.)
         
            '   sourcePanel = currentBin.panelObj
            '   objData = sourcePanel.Tag      
            
               If objData.ordCol = ARGB_ACTIVE_PICK Then 
                     objData.ordCol = ARGB_DEFAULT
                     sourcePanel.Color = ARGB_DEFAULT
                     objData.ordClicked = False
            End If
    Next

End Sub


B4X:
Type t_orderBinsControl(lstObO As List) 
Type t_orderBinObj (panelObj As Panel, lstLbls As List)
         Type typ_OrdData (ordCol As String, _
         ordNoId As String, _
         ordClicked As Boolean, _
         ordMessage As String, _
         ordLblNm As String, _
         i32BinNo As Int)
B4X:
Sub CreateBinControl(iBinNoPassed As Int, passedOrdAssignObj As typ_cOrderAssignment) As t_orderBinObj


'ordBinLablesList As List,         

         Dim strOrdNo As String
         Dim obj As typ_OrdData               
         Dim tmpLbl As Label
         Dim strLblName As String         
         'Dim strBinNo As String   
         Dim strContainerNo As String

         strContainerNo = "55"   '    ************* strContainerNo ******* BOX ****************
         
         strOrdNo = passedOrdAssignObj.ordId   
         
         

'         If iBinNoPassed < 1 Then
'         iBinNoPassed = Rnd(1,20)
'         End If                  
               
         Dim retValObj As t_orderBinObj   'complex object Custom panel & list of Labels 
         Dim panelAlpha As Panel
         Dim tmpLbls As List   

         retValObj.Initialize()                 ' The Composite Type 
         retValObj.panelObj.Initialize("OrderBinEvent")      
         retValObj.lstLbls.Initialize
         tmpLbls.Initialize
         
         panelAlpha.Initialize("OrderBinEvent")



         obj.ordCol = postMain.ARGB_DEFAULT
         obj.ordNoId = strOrdNo
         obj.ordClicked = False
         obj.i32BinNo = iBinNoPassed +1
               
         panelAlpha.Tag = obj   
         panelAlpha.Color = postMain.ARGB_DEFAULT



      Dim tmpLst As List            
      tmpLst = HarvestOrdBinLbls     ' Go Get the data Required To Fill these Controls (Views)
                                                                ' List of label Names as string   
                                                
            For x = 0 To tmpLst.Size -1   
                  
                     Dim tmpLbl As Label      
                     tmpLbl.Initialize("")
                     
                     tmpLbl  = tmpLst.Get(x)
                     strLblName = tmpLbl.Tag
                     obj.ordMessage = "panel " & obj.ordNoId 
                  
            
         #Region ---{ REFERENCE }------------
      '   retValObj.panelObj.AddView(lblBinVal, 5%x, 1%y, 9.5%x, 33.3%y)   
      '   
      '   retValObj.panelObj.AddView(lblOrderNoID,1%x,  5%y,  9.5%x, 33.3%y) 
      '   retValObj.panelObj.AddView(lblOrderNoVal,7%x, 5%y, 9.5%x, 33.3%y) 
      '   
      '   retValObj.panelObj.AddView(lblStatusID, 1%x, 9%y, 12.6%x, 33.3%y)
      '   retValObj.panelObj.AddView(lblStatusVal,7%x, 9%y, 12.6%x, 33.3%y)
      '   
      '   retValObj.panelObj.AddView(lblContainerNoID,  22%x, 1%y, 9.5%x, 33.3%y)      
      '   retValObj.panelObj.AddView(lblContainerNoVal, 27%x, 1%y, 9.5%x, 33.3%y)

      '         lblBinID.Text=strBinNo         
      '        lblBinVal.Text = z         
      '         lblOrderNoID.Text = "Order: "      
      '         lblOrderNoVal.Text = strOrdNo               
      '         lblStatusID.Text = "Status: "      
      '         lblStatusVal.Text = strStatus       
      '         lblContainerNoID.Text = strContainerNo                  
      '        lblContainerNoVal.Text = "20"
      #End Region   
         
#Region------{ Physical Placement Label Content Controlled HERE }---------------------         


         Select strLblName
               Case "BinID"
                  tmpLbl.Text="Bin: "      
                  panelAlpha.AddView(tmpLbl,  1%x, 1%y, 9.5%x, 33.3%y)
               'retValObj.panelObj.AddView(tmpLbl,  1%x, 1%y, 9.5%x, 33.3%y)
               
              Case "BinVal"      ' PROOF Do they Match    obj.i32BinNo = iBinNoPassed
               Blah Blah Bah and so on 
      End Select

      #End Region


                  tmpLbl = SetlblFontOrderBins(tmpLbl)           ''Try Catch ??? 
                  retValObj.panelObj = panelAlpha
                  tmpLbls.Add(tmpLbl)
                  
                  retValObj.lstLbls =tmpLbls 
         
         Next

      Return retValObj
End Sub
B4X:
Initial Placement  / creation  



                                 For xOrds = 0 To MAX_BIN_COUNT-1
                                             iCurrentPanelNo = xOrds            
                                             Dim ordDataObj As typ_OrdData 
                                             Dim panAlpha As Panel         
                                             binCrtl = binCtrlObjLst.Get(xOrds)
                                             binCrtl.panelObj.RemoveView                  
                                             
                                       If xOrds < 2 Then
                                          strRowID = "Alpha"   
                                          ordDataObj.ordNoId = strRowID & " " & ( xOrds + 1)   
                                          
                                                                     If bNew Then 
                                                                     iPositionOnX = 0
                                                                     bNew = False
                                                                     Else
                                                                     iPositionOnX = iPositionOnX + iTwoPanelWidth + 1dip   
                                                                        bNew = True
                                                                     End If                                                                                                                                                                                    
                                       panOrderBinsBase.AddView(binCrtl.panelObj,iPositionOnX,iPanelTop,iTwoPanelWidth,iPanelHeight)                           


panOrderBinsBase  has the binCtrl objects so how Do I dig them back out to modify them



panOrderBinsBase has the binCtrl objects so how Do I dig them back out to modify them
 
Last edited:

CharlesIPTI

Active Member
Licensed User
Longtime User
Disreggard I Solved it

Apparently I cant address the custom type as itself but the tag as created containing another custom type is readily accessible and thats all i needed , that and the objects color itself ,, so its a panel so I can get to that as well... Odd what if i wanted to get to the list of labels I added to the custom type ...
oh well
 
Upvote 0
Top