Android Question xCustomListView lazy loading problems

alon

Active Member
Licensed User
Longtime User
hi,
I had a problem with my app crash , because of a big amount of objects on the listview.
So, I am using now xCustomListView with lazy loading, and I'm having a few problems.
My Idea was to first, build an empty items (panel) on the list view
And then when scrolling to build the items on each panel.
First problem was that the panel's height was changed but the list item height remain the same height when it fisrt build it,
So I resized the item's height after building the panel's items using the command: clvDoh.ResizeItem(i,p.Height )

After doing that I am having 2 problems.
1. The panel color is changed to the original color ,(every panel have a different color)
2. when I am using the command: clvDoh.ScrollToItem(clvDoh.GetSize-1) ,
it jumps to a different location, the location of the first size of the item (when it was empty).


Thanks


B4X:
Sub clvDoh_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
  
    Dim ExtraSize As Int = 20
    For i = 0 To clvDoh.Size - 1
        Dim p As Panel = clvDoh.GetPanel(i)
      
        If i > FirstIndex - ExtraSize And i < LastIndex + ExtraSize Then
            'visible+
            If p.NumberOfViews = 0 Then
                            
                Dim cRec As Cursor
                cRec=DBUtils.FnOpenRecSet (Starter.sql,GetQuerySeker & " and RecId = " & p.Tag )                           
                CreateItemSeker(i,clvDoh.AsView.Width, clvDoh.AsView.Height,cRec,False,p)
                clvDoh.ResizeItem(i,p.Height )

            End If
        Else
            'not visible
            If p.NumberOfViews > 0 Then
                UpdateSekerNivdak(p,True)
                p.RemoveAllViews '<--- remove the layout
            End If
        End If
    Next
End Sub
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Why can't you set the height correctly when the program starts? It will be simpler and more efficient than resizing the list all the time.
Another option is to add items when the ReachEnd event fires. This way you don't need to deal with lazy loading.

It is difficult to answer your questions without seeing a small example that demonstrates it. Resizing the items inside the VisibleRangeChanged event is probably not a good idea.
 
Upvote 0

alon

Active Member
Licensed User
Longtime User
Why can't you set the height correctly when the program starts? It will be simpler and more efficient than resizing the list all the time.
Another option is to add items when the ReachEnd event fires. This way you don't need to deal with lazy loading.

It is difficult to answer your questions without seeing a small example that demonstrates it. Resizing the items inside the VisibleRangeChanged event is probably not a good idea.

Because I don't know what will be the exact height for each Item.
 
Upvote 0

alon

Active Member
Licensed User
Longtime User
What do you need to do to find out the height?

i am adding items on each panel according to the sql db , some panels have 10 items and some have only 2. so not all het panels have the same height.
 
Upvote 0

alon

Active Member
Licensed User
Longtime User
How many items are in the database? It will most probably be fast enough to extract them before you create the list and use the data to determine the height. Measure it.

100 panels (for now, it could be more than that), on each panel I have between 30 to 50 items.


I extract them as you Saied and it take a few sec to load ,
I guess it is good enough for now.


The new problem with lazy loading is that I also had a search option, and now I can't find what I am looking for in the list because lazy loading removed the panel's view.

Should I do the search in the sql sb instead on the list?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I extract them as you Saied and it take a few sec to load ,
Sounds a bit too slow. Make sure to test it in release mode.

Creating 100 panels shouldn't take a few seconds.

Should I do the search in the sql sb instead on the list?
Yes. The list should only be used to visualize the data. The data is stored in the database.
 
Upvote 0

alon

Active Member
Licensed User
Longtime User
Sounds a bit too slow. Make sure to test it in release mode.

Creating 100 panels shouldn't take a few seconds.


Yes. The list should only be used to visualize the data. The data is stored in the database.

It does take a few sec, but what else can I do?
 
Upvote 0

alon

Active Member
Licensed User
Longtime User
Post the relevant code.


Here is the code.

Thanks.

B4X:
Private Sub FillDohSeker()
    lLastItemFocus = -1
    ProgressDialogShow2("Loading Records",False)
    clvDoh.Clear
    Dim cRec As Cursor
    Dim sQuery As String
    sQuery = GetQuerySeker '28-10-2019
    cRec=DBUtils.FnOpenRecSet(Starter.sql,sQuery )
    If cRec.RowCount = 0 Then
        ProgressDialogHide
        Return
    End If
    For i = 0 To cRec.RowCount -1 'Creating The Itmes Parents and childs
        cRec.Position =i
        Sleep(0)
        clvDoh.Add( CreateItemSeker(i, clvDoh.AsView.Width, clvDoh.AsView.Height,cRec,True,Null) , $"Item #${i}"$) '24-10-2019
    Next
    ProgressDialogHide
    If bJumpToLastItem Then '    28-10-2019
        bJumpToLastItem = False
        clvDoh.ScrollToItem (clvDoh.Size-1)
    Else
        If lLastItemFocus > -1 Then '09-09-2019
            clvDoh.JumpToItem ( lLastItemFocus)
        End If
    End If
   
   
End Sub
Sub CreateItemSeker(iListIndex As Int, Width As Int, Height As Int,cRec As Cursor,bEmptyPanel As Boolean,p2 As Panel) As Panel
    '28-10-2019 = Add bEmptyPanel
   
   
    Dim p As Panel
    Dim su As StringUtils
   
    p.Initialize("")
    '24-10-2019Activity.AddView(p,   0,  0 , Width, Height)
   
    p.SetLayout(0 ,  0,  Width, Height) '24-10-2019
   
   
    p.LoadLayout("frmItemSeker")
    p.Color = Colors.White
    '24-10-2019p.RemoveView
   
    If bEmptyPanel = False Then '28-10-2019
        p = p2
        p.RemoveAllViews
    End If
   
    Dim lCurTop,i ,j,x As Long
    p.Color = Colors.White
    If iListIndex Mod 2 <> 0 Then
        p.Color = Colors.RGB(231,230,230)
    End If
    Try
        p.Tag = cRec.GetLong("RecId")
               
        Dim lblItemSeker(14) As Label :    Dim lblItemSekerBG(14) As ColorDrawable: Dim txtItemSeker(14) As EditText:    Dim txtItemSekerBG(14) As ColorDrawable
        Dim lblTarikItemSeker(6) As Label
        Dim lblTarikItemSekerBG(6) As ColorDrawable
        Dim lblPeula(13) As Label:Dim lblNum As Label
        Dim lblPeulaBG(13) As ColorDrawable
           
        For i = 0 To lblItemSekerBG.Length - 1
            lblItemSekerBG(i).Initialize2(Colors.White   ,   30, 5,  Colors.RGB(11, 73,122))
        Next
       
        For i = 0 To txtItemSekerBG.Length - 1
            txtItemSekerBG(i).Initialize2(Colors.White   ,    0,  5,  Colors.RGB(11, 73,122))
        Next
       
        For i = 0 To lblTarikItemSekerBG.Length - 1
            lblTarikItemSekerBG(i).Initialize2(Colors.White   ,    0,  5,  Colors.RGB(11, 73,122))
        Next
       
        For i = 0 To lblPeulaBG.Length - 1
            lblPeulaBG(i).Initialize2(Colors.White ,  20,  5, Colors.Red)
        Next       
       
        lCurTop = 1%y:    i=-1:     j=-1:     x=-1
        '===========
        lblNum = SetlblNum(lblNum,iListIndex)
        p.AddView(lblNum,lblNum.Left, lblNum.Top,lblNum.Width,lblNum.Height)
        lCurTop = lCurTop + lblNum.Height + 1%y
       
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "מיקום העמדה:"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)   
       
        txtItemSeker(i).Initialize("txtItemSeker" & i)
        txtItemSeker(i).Left = 2%x
        txtItemSeker(i).Top = lCurTop
        txtItemSeker(i).Width = 60%x
        txtItemSeker(i).Background = txtItemSekerBG(i)
        txtItemSeker(i).TextColor = Colors.Black
        txtItemSeker(i).TextSize = 20
        txtItemSeker(i).SingleLine= True
        txtItemSeker(i).Gravity = Gravity.RIGHT
        txtItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        txtItemSeker(i).Text = cRec.GetString("Mikum")
        txtItemSeker(i).Typeface = Typeface.DEFAULT_BOLD 'Make text bold
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 1
        tItemSeker.sFielsName = "Mikum"
        txtItemSeker(i).Tag = tItemSeker
       
        '
        txtItemSeker(i).Height = su.MeasureMultilineTextHeight(txtItemSeker(i), txtItemSeker(i).Text)+ 2%y
        p.AddView(txtItemSeker(i),txtItemSeker(i).Left, txtItemSeker(i).Top,txtItemSeker(i).Width,txtItemSeker(i).Height)
       
        lCurTop = lCurTop + txtItemSeker(i).Height + 2%y       
       
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "סוג מטפה:"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)       
       
        j=j+1
        lblTarikItemSeker(j).Initialize("lblTarikItemSeker" & j)
        lblTarikItemSeker(j).Left = 2%x
        lblTarikItemSeker(j).Top = lCurTop
        lblTarikItemSeker(j).Width = 60%x
        lblTarikItemSeker(j).Background = lblTarikItemSekerBG(j)
        lblTarikItemSeker(j).Text = cRec.GetString("SugMataf")
        lblTarikItemSeker(j).TextColor = Colors.Black
        lblTarikItemSeker(j).TextSize = 20
        lblTarikItemSeker(j).Gravity = Gravity.RIGHT
        lblTarikItemSeker(j).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 1
        tItemSeker.sFielsName = "SugMataf"
        tItemSeker.lRecidZtables = cRec.GetLong("RecidZtables")
       
        lblTarikItemSeker(j).Tag = tItemSeker
        '
        lblTarikItemSeker(j).Height = su.MeasureMultilineTextHeight(lblTarikItemSeker(j), lblTarikItemSeker(j).Text) + 2%y
        p.AddView(lblTarikItemSeker(j),lblTarikItemSeker(j).Left, lblTarikItemSeker(j).Top,lblTarikItemSeker(j).Width,lblTarikItemSeker(j).Height)
       
        lCurTop = lCurTop + lblTarikItemSeker(j).Height + 2%y
       
        '===============
        'Peulot
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 2%x
        lblPeula(x).Top = lCurTop - 1%y
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "מילוי"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "MiluyMataf"
        tItemSeker.bMarked=False
       
        If cRec.GetLong("hMiluyMataf") <> 0 Or cRec.GetLong("nhMiluyMataf") <> 0 Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
       
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 25%x
        lblPeula(x).Top = lCurTop - 1%y
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "חדש"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        tItemSeker.vNnew = lblPeula(x) 'Assign NewMataf To Objet MiluyMataf
       
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "NewMataf"
        tItemSeker.bMarked=False
       
        If cRec.GetLong("hNewMataf") <> 0 Or cRec.GetLong("nhNewMataf") <> 0 Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)       
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 48%x
        lblPeula(x).Top = lCurTop - 1%y
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "החלפה"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        tItemSeker.vHachlafa = lblPeula(x) 'Assign HachlafaMataf To Objet NewMataf
        tItemSeker.vMiluy = lblPeula(x-2) 'Assign MiluyMataf To Objet NewMataf
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "HachlafaMataf"
        tItemSeker.bMarked=False
        tItemSeker.vNnew = lblPeula(x-1)
       
        If cRec.GetLong("hHachlafaMataf") <> 0 Or cRec.GetLong("nhHachlafaMataf") <> 0 Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
       
       
        lCurTop = lCurTop + lblPeula(x).Height + 1%y
        '===============               
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "מס' סידורי:"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)
       
       
        txtItemSeker(i).Initialize("txtItemSeker" & i)
        txtItemSeker(i).Left = 2%x
        txtItemSeker(i).Top = lCurTop
        txtItemSeker(i).Width = 60%x
        txtItemSeker(i).Background = txtItemSekerBG(i)
        txtItemSeker(i).Text = cRec.GetString("Siduri")
        txtItemSeker(i).TextColor = Colors.Black
        txtItemSeker(i).TextSize = 20
        txtItemSeker(i).SingleLine= True
'        txtItemSeker(i).Gravity = Gravity.RIGHT
        txtItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 1
        tItemSeker.sFielsName = "Siduri"
        txtItemSeker(i).Tag = tItemSeker
        '
        txtItemSeker(i).Height = su.MeasureMultilineTextHeight(txtItemSeker(i), txtItemSeker(i).Text)+ 2%y
        p.AddView(txtItemSeker(i),txtItemSeker(i).Left, txtItemSeker(i).Top,txtItemSeker(i).Width,txtItemSeker(i).Height)
       
        lCurTop = lCurTop + txtItemSeker(i).Height + 2%y
       
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "יצרן:"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)
       
       
        j=j+1
        lblTarikItemSeker(j).Initialize("lblTarikItemSeker" & j)
        lblTarikItemSeker(j).Left = 2%x
        lblTarikItemSeker(j).Top = lCurTop
        lblTarikItemSeker(j).Width = 60%x
        lblTarikItemSeker(j).Background = lblTarikItemSekerBG(j)
        lblTarikItemSeker(j).Text = cRec.GetString("Yazran")
        lblTarikItemSeker(j).TextColor = Colors.Black
        lblTarikItemSeker(j).TextSize = 20
        lblTarikItemSeker(j).Gravity = Gravity.RIGHT
        lblTarikItemSeker(j).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 1
        tItemSeker.sFielsName = "Yazran"
        lblTarikItemSeker(j).Tag = tItemSeker
        '
        lblTarikItemSeker(j).Height = su.MeasureMultilineTextHeight(lblTarikItemSeker(j), lblTarikItemSeker(j).Text)+ 2%y
        p.AddView(lblTarikItemSeker(j),lblTarikItemSeker(j).Left, lblTarikItemSeker(j).Top,lblTarikItemSeker(j).Width,lblTarikItemSeker(j).Height)
       
        lCurTop = lCurTop + lblTarikItemSeker(j).Height + 2%y
       
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "תוקף ב.ל:"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)
       
        j=j+1
        lblTarikItemSeker(j).Initialize("lblTarikItemSeker" & j)
        lblTarikItemSeker(j).Left = 2%x
        lblTarikItemSeker(j).Top = lCurTop
        lblTarikItemSeker(j).Width = 60%x
        lblTarikItemSeker(j).Background = lblTarikItemSekerBG(j)
        lblTarikItemSeker(j).Text = cRec.GetString("Tokef")
        If cRec.GetString("Tokef") = "01/01/1900" Then  lblTarikItemSeker(j).Text =""
        lblTarikItemSeker(j).TextColor = Colors.Black
        lblTarikItemSeker(j).TextSize = 20
        lblTarikItemSeker(j).Gravity = Gravity.RIGHT
        lblTarikItemSeker(j).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 1
        tItemSeker.sFielsName = "Tokef"
        lblTarikItemSeker(j).Tag = tItemSeker
        '
        lblTarikItemSeker(j).Height = su.MeasureMultilineTextHeight(lblTarikItemSeker(j), lblTarikItemSeker(j).Text)+ 2%y
        p.AddView(lblTarikItemSeker(j),lblTarikItemSeker(j).Left, lblTarikItemSeker(j).Top,lblTarikItemSeker(j).Width,lblTarikItemSeker(j).Height)
       
        lCurTop = lCurTop + lblTarikItemSeker(j).Height + 2%y
       
       
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "שש שנתי:"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)
       
       
        j=j+1
        lblTarikItemSeker(j).Initialize("lblTarikItemSeker" & j)
        lblTarikItemSeker(j).Left = 2%x
        lblTarikItemSeker(j).Top = lCurTop
        lblTarikItemSeker(j).Width = 60%x
        lblTarikItemSeker(j).Background = lblTarikItemSekerBG(j)
        lblTarikItemSeker(j).Text = cRec.GetString("Shnati")
        If cRec.GetString("Shnati") = "01/01/1900" Then  lblTarikItemSeker(j).Text =""
        lblTarikItemSeker(j).TextColor = Colors.Black
        lblTarikItemSeker(j).TextSize = 20
        lblTarikItemSeker(j).Gravity = Gravity.RIGHT
        lblTarikItemSeker(j).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 1
        tItemSeker.sFielsName = "Shnati"
        lblTarikItemSeker(j).Tag = tItemSeker
        '
        lblTarikItemSeker(j).Height = su.MeasureMultilineTextHeight(lblTarikItemSeker(j), lblTarikItemSeker(j).Text)+ 2%y
        p.AddView(lblTarikItemSeker(j),lblTarikItemSeker(j).Left, lblTarikItemSeker(j).Top,lblTarikItemSeker(j).Width,lblTarikItemSeker(j).Height)
       
        lCurTop = lCurTop + lblTarikItemSeker(j).Height + 2%y
       
   
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "גלגלון:"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)
       
       
        txtItemSeker(i).Initialize("txtItemSeker" & i)
        txtItemSeker(i).Left = 2%x + 25%x + 21%x
        txtItemSeker(i).Top = lCurTop
        txtItemSeker(i).Width = 60%x - 25%x - 21%x
        txtItemSeker(i).Background = txtItemSekerBG(i)
        txtItemSeker(i).Text = cRec.GetLong("Galgalon")
        If txtItemSeker(i).Text = "0" Then txtItemSeker(i).Text = ""
        txtItemSeker(i).TextColor = Colors.Black
        txtItemSeker(i).TextSize = 20
        txtItemSeker(i).SingleLine= True
        txtItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        txtItemSeker(i).InputType=txtItemSeker(i).INPUT_TYPE_NUMBERS
        IME.SetLengthFilter(txtItemSeker(i), 4)
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 2
        tItemSeker.sFielsName = "Galgalon"
        txtItemSeker(i).Tag = tItemSeker
        '
        txtItemSeker(i).Height = su.MeasureMultilineTextHeight(txtItemSeker(i), txtItemSeker(i).Text)+ 2%y
        p.AddView(txtItemSeker(i),txtItemSeker(i).Left, txtItemSeker(i).Top,txtItemSeker(i).Width,txtItemSeker(i).Height)
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 2%x
        lblPeula(x).Top = lCurTop
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "חדש"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "NewGalgalon"
        tItemSeker.bMarked=False
       
        If cRec.GetLong("hNewGalgalon") <> 0 Or cRec.GetLong("nhNewGalgalon") <> 0 Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 25%x
        lblPeula(x).Top = lCurTop
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "החלפה"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        tItemSeker.vHachlafa = lblPeula(x)
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "HachlafaGalgalon"
        tItemSeker.bMarked=False
        tItemSeker.vNnew = lblPeula(x-1)
       
        If cRec.GetLong("hHachlafaGalgalon") <> 0 Or cRec.GetLong("nhHachlafaGalgalon") <> 0 Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If       
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
        lCurTop = lCurTop + txtItemSeker(i).Height + 2%y
       
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "ב""ש:"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)
       
       
        txtItemSeker(i).Initialize("txtItemSeker" & i)
        txtItemSeker(i).Left = 2%x + 25%x + 21%x
        txtItemSeker(i).Top = lCurTop
        txtItemSeker(i).Width = 60%x - 25%x - 21%x
        txtItemSeker(i).Background = txtItemSekerBG(i)
        txtItemSeker(i).Text = cRec.GetLong("BS")
        If txtItemSeker(i).Text = "0" Then txtItemSeker(i).Text = ""
        txtItemSeker(i).TextColor = Colors.Black
        txtItemSeker(i).TextSize = 20
        txtItemSeker(i).SingleLine= True
        txtItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        txtItemSeker(i).InputType=txtItemSeker(i).INPUT_TYPE_NUMBERS
        IME.SetLengthFilter(txtItemSeker(i), 4)
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 2
        tItemSeker.sFielsName = "BS"
        txtItemSeker(i).Tag = tItemSeker
        '
        txtItemSeker(i).Height = su.MeasureMultilineTextHeight(txtItemSeker(i), txtItemSeker(i).Text)+ 2%y
        p.AddView(txtItemSeker(i),txtItemSeker(i).Left, txtItemSeker(i).Top,txtItemSeker(i).Width,txtItemSeker(i).Height)
       
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 2%x
        lblPeula(x).Top = lCurTop
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "חדש"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "NewBS"
        tItemSeker.bMarked=False
       
        If cRec.GetLong("hNewBS") <> 0  Or cRec.GetLong("nhNewBS") <> 0 Then 
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If   
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
       
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 25%x
        lblPeula(x).Top = lCurTop
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "החלפה"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        tItemSeker.vHachlafa = lblPeula(x)
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "HachlafaBS"
        tItemSeker.bMarked=False
        tItemSeker.vNnew = lblPeula(x-1)
       
        If cRec.GetLong("hHachlafaBS") <> 0 Or cRec.GetLong("nhHachlafaBS") <> 0 Then 
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
       
       
        lCurTop = lCurTop + txtItemSeker(i).Height + 2%y
       
        'Zarnuk Canceld
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "זרנוק 2'':"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        lblItemSeker(i).Visible = False
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)
       
       
        txtItemSeker(i).Initialize("txtItemSeker" & i)
        txtItemSeker(i).Left = 2%x
        txtItemSeker(i).Top = lCurTop
        txtItemSeker(i).Width = 60%x
        txtItemSeker(i).Background = txtItemSekerBG(i)
        txtItemSeker(i).Text = cRec.GetLong("Zarnuk")
        If txtItemSeker(i).Text = "0" Then txtItemSeker(i).Text = ""
        txtItemSeker(i).TextColor = Colors.Black
        txtItemSeker(i).TextSize = 20
        txtItemSeker(i).SingleLine= True
        txtItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        txtItemSeker(i).InputType=txtItemSeker(i).INPUT_TYPE_NUMBERS
        IME.SetLengthFilter(txtItemSeker(i), 4)
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 2
        tItemSeker.sFielsName = "Zarnuk"
        txtItemSeker(i).Tag = tItemSeker
        txtItemSeker(i).Visible = False
        '
        txtItemSeker(i).Height = su.MeasureMultilineTextHeight(txtItemSeker(i), txtItemSeker(i).Text)+ 2%y
        p.AddView(txtItemSeker(i),txtItemSeker(i).Left, txtItemSeker(i).Top,txtItemSeker(i).Width,txtItemSeker(i).Height)
   
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "זרנוק ב.ל:"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)
       
       
        j=j+1
        lblTarikItemSeker(j).Initialize("lblTarikItemSeker" & j)
        lblTarikItemSeker(j).Left = 2%x + 25%x + 21%x
        lblTarikItemSeker(j).Top = lCurTop
        lblTarikItemSeker(j).Width = 60%x - 25%x - 21%x
        lblTarikItemSeker(j).Background = lblTarikItemSekerBG(j)
        lblTarikItemSeker(j).Text = cRec.GetString("TarikZarnukBL1")
        If cRec.GetString("TarikZarnukBL1") = "01/01/1900" Then 
            lblTarikItemSeker(j).Text =""
        Else
            If  lblTarikItemSeker(j).Text.Trim.Length > 6 Then
                lblTarikItemSeker(j).Text = lblTarikItemSeker(j).Text.SubString(6) 'Get The Year
            End If
        End If
        lblTarikItemSeker(j).TextColor = Colors.Black
        lblTarikItemSeker(j).TextSize = 20
        lblTarikItemSeker(j).Gravity = Gravity.RIGHT
        lblTarikItemSeker(j).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 1
        tItemSeker.sFielsName = "TarikZarnukBL1"
        lblTarikItemSeker(j).Tag = tItemSeker
        '
        lblTarikItemSeker(j).Height = su.MeasureMultilineTextHeight(lblTarikItemSeker(j), lblTarikItemSeker(j).Text)+ 2%y
        p.AddView(lblTarikItemSeker(j),lblTarikItemSeker(j).Left, lblTarikItemSeker(j).Top,lblTarikItemSeker(j).Width,lblTarikItemSeker(j).Height)
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 2%x
        lblPeula(x).Top = lCurTop
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "חדש"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "NewZarnuk1"
        tItemSeker.bMarked=False
       
        If cRec.GetLong("hNewZarnuk1") <> 0 Or cRec.GetLong("nhNewZarnuk1") <> 0   Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 25%x
        lblPeula(x).Top = lCurTop
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "החלפה"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        tItemSeker.vHachlafa = lblPeula(x)
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "HachlafaZarnuk1"
        tItemSeker.bMarked=False
        tItemSeker.vNnew = lblPeula(x-1)
       
        If cRec.GetLong("hHachlafaZarnuk1") <> 0 Or cRec.GetLong("nhHachlafaZarnuk1") <> 0 Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
       
       
        lCurTop = lCurTop + lblTarikItemSeker(j).Height + 2%y
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "זרנוק ב.ל:"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)
       
        j=j+1
        lblTarikItemSeker(j).Initialize("lblTarikItemSeker" & j)
        lblTarikItemSeker(j).Left = 2%x + 25%x + 21%x
        lblTarikItemSeker(j).Top = lCurTop
        lblTarikItemSeker(j).Width = 60%x - 25%x - 21%x
        lblTarikItemSeker(j).Background = lblTarikItemSekerBG(j)
        lblTarikItemSeker(j).Text = cRec.GetString("TarikZarnukBL2")
        If cRec.GetString("TarikZarnukBL2") = "01/01/1900" Then
            lblTarikItemSeker(j).Text =""
        Else
            If  lblTarikItemSeker(j).Text.Trim.Length > 6 Then
                lblTarikItemSeker(j).Text = lblTarikItemSeker(j).Text.SubString(6) 'Get The Year
            End If
        End If
        lblTarikItemSeker(j).TextColor = Colors.Black
        lblTarikItemSeker(j).TextSize = 20
        lblTarikItemSeker(j).Gravity = Gravity.RIGHT
        lblTarikItemSeker(j).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 1
        tItemSeker.sFielsName = "TarikZarnukBL2"
        lblTarikItemSeker(j).Tag = tItemSeker
        '
        lblTarikItemSeker(j).Height = su.MeasureMultilineTextHeight(lblTarikItemSeker(j), lblTarikItemSeker(j).Text)+ 2%y
        p.AddView(lblTarikItemSeker(j),lblTarikItemSeker(j).Left, lblTarikItemSeker(j).Top,lblTarikItemSeker(j).Width,lblTarikItemSeker(j).Height)
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 2%x
        lblPeula(x).Top = lCurTop
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "חדש"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "NewZarnuk2"
        tItemSeker.bMarked=False
       
        If cRec.GetLong("hNewZarnuk2") <> 0 Or cRec.GetLong("nhNewZarnuk2") <> 0 Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 25%x
        lblPeula(x).Top = lCurTop
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "החלפה"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        tItemSeker.vHachlafa = lblPeula(x)
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "HachlafaZarnuk2"
        tItemSeker.bMarked=False
        tItemSeker.vNnew = lblPeula(x-1)
       
        If cRec.GetLong("hHachlafaZarnuk2") <> 0 Or cRec.GetLong("nhHachlafaZarnuk2") <> 0 Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
       
        lCurTop = lCurTop + lblTarikItemSeker(j).Height + 2%y
        i=i+1
        lblItemSeker(i).Initialize("lblItemSeker" & i)
        lblItemSeker(i).Left = 64%x
        lblItemSeker(i).Top = lCurTop
        lblItemSeker(i).Width = 34%x
        lblItemSeker(i).Background = lblItemSekerBG(i)
        lblItemSeker(i).Text = "מזנק"
        lblItemSeker(i).TextColor = Colors.Black
        lblItemSeker(i).TextSize = 20
        lblItemSeker(i).Gravity = Gravity.CENTER
        lblItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        '
        lblItemSeker(i).Height = su.MeasureMultilineTextHeight(lblItemSeker(i), lblItemSeker(i).Text)+ 2%y
        p.AddView(lblItemSeker(i),lblItemSeker(i).Left, lblItemSeker(i).Top,lblItemSeker(i).Width,lblItemSeker(i).Height)
       
       
        txtItemSeker(i).Initialize("txtItemSeker" & i)
        txtItemSeker(i).Left = 2%x  + 25%x + 21%x
        txtItemSeker(i).Top = lCurTop
        txtItemSeker(i).Width = 60%x - 25%x  - 21%x
        txtItemSeker(i).Background = txtItemSekerBG(i)
        txtItemSeker(i).Text = cRec.GetLong("Maznek")
        If txtItemSeker(i).Text = "0" Then txtItemSeker(i).Text = ""
        txtItemSeker(i).TextColor = Colors.Black
        txtItemSeker(i).TextSize = 20
        txtItemSeker(i).SingleLine= True
'        txtItemSeker(i).Gravity = Gravity.RIGHT
        txtItemSeker(i).Padding = Array As Int(10 , 0,10,0 )
        txtItemSeker(i).InputType=txtItemSeker(i).INPUT_TYPE_NUMBERS
        IME.SetLengthFilter(txtItemSeker(i), 4)
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 2
        tItemSeker.sFielsName = "Maznek"
        txtItemSeker(i).Tag = tItemSeker
        '
        txtItemSeker(i).Height = su.MeasureMultilineTextHeight(txtItemSeker(i), txtItemSeker(i).Text)+ 2%y
        p.AddView(txtItemSeker(i),txtItemSeker(i).Left, txtItemSeker(i).Top,txtItemSeker(i).Width,txtItemSeker(i).Height)
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 2%x
        lblPeula(x).Top = lCurTop 
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "חדש"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "NewMaznek"
        tItemSeker.bMarked=False
        If cRec.GetLong("hNewMaznek") <> 0 Or cRec.GetLong("nhNewMaznek") <> 0 Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
       
        x=x+1
        lblPeula(x).Initialize("lblPeula" & x)
        lblPeula(x).Left = 25%x
        lblPeula(x).Top = lCurTop
        lblPeula(x).Width = 20%x
        lblPeula(x).Background = lblPeulaBG(x)
        lblPeula(x).Text = "החלפה"
        lblPeula(x).TextColor = Colors.Black
        lblPeula(x).TextSize = 20
        lblPeula(x).Gravity = Gravity.CENTER
        lblPeula(x).Padding = Array As Int(10 , 0,10,0 )
        tItemSeker.vHachlafa = lblPeula(x)
        Dim tItemSeker As ItemSeker
        tItemSeker.Initialize
        tItemSeker.iFieldType = 3
        tItemSeker.sFielsName = "HachlafaMaznek"
        tItemSeker.bMarked=False
        tItemSeker.vNnew = lblPeula(x-1)
        If cRec.GetLong("hHachlafaMaznek") <> 0 Or cRec.GetLong("nhHachlafaMaznek") <> 0 Then
                tItemSeker.bMarked=True
                lblPeulaBG(x).Initialize2(Colors.Yellow ,  20,  5, Colors.Red)
                lblPeula(x).Background = lblPeulaBG(x)
        End If
        lblPeula(x).Tag = tItemSeker
        '
        lblPeula(x).Height = su.MeasureMultilineTextHeight(lblPeula(x), lblPeula(x).Text)+ 2%y
        p.AddView(lblPeula(x),lblPeula(x).Left, lblPeula(x).Top,lblPeula(x).Width,lblPeula(x).Height)
       
        lCurTop = lCurTop + txtItemSeker(i).Height + 2%y
       
    Catch
        Log(LastException)
    End Try
    p = CreateItemSekere2 (p,lCurTop,i,cRec,iListIndex)
   
    p.Height=lItemSekerHeight '24-10-2019
    Return p
   
End Sub
Sub clvDoh_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
    '28-10-2019
    Dim ExtraSize As Int = 20
    For i = 0 To clvDoh.Size - 1
        Dim p As Panel = clvDoh.GetPanel(i)
        If i > FirstIndex - ExtraSize And i < LastIndex + ExtraSize Then
            'visible+
            If p.NumberOfViews = 0 Then
                Dim cRec As Cursor
                cRec=DBUtils.FnOpenRecSet (Starter.sql,GetQuerySeker & " and RecId = " & p.Tag )
                CreateItemSeker(i,clvDoh.AsView.Width, clvDoh.AsView.Height,cRec,False,p)
            End If
        Else
            'not visible
            If p.NumberOfViews > 0 Then
                UpdateSekerNivdak(p,True)
                p.RemoveAllViews '<--- remove the layout
            End If
        End If
    Next
End Sub
 
Upvote 0
Top