Salinda001
New Member
I created a Xcustom list view as shown in this thread,
to get data i used SQLite database.
To load the layout I used the following code as shown in the above thread,
This all works fine... but,
Now what I want is when click the Edit button, I want to get the text from iv.lblstyle.text
Here is the Code I used,
then I get an error to initialize the label (iv.lblstyle.text)
How to get the text ? :-(
[B4X] [XUI] xCustomListView - cross platform CustomListView
Update: As several other libraries depend on xCustomListView library, it is no longer recommended to use the code module. Use the library instead. There are several extension classes that add more features to xCLV. They are listed at the end of this post. Video tutorial: xCustomListView is...
www.b4x.com
to get data i used SQLite database.
To load the layout I used the following code as shown in the above thread,
B4X:
Sub Process_Globals
Private xui as XUI
Type itemvalue ( lblcode As Label, lblstyle As Label, lblgsm As Label ,btnedit As Button, btndelete As Button)
End Sub
Private Sub CreateItem (Code As String, GSM As String, Style As String, iv As itemvalue) As B4XView
Dim p As Panel = xui.CreatePanel("")
p.SetLayoutAnimated(0,0,0,100%x, 215dip)
iv.Initialize
iv.lblcode = lblccode
iv.lblgsm = lblgsm
iv.lblstyle = lblstyle
iv.btndelete = btndelete
iv.btnedit = btnedit
p.LoadLayout("Items")
lblcode.text = FabricCode
lblgsmt.Text = GSM
lblstyle.Text = Style
Return p
End Sub
Sub ShowDB
CustomListView1.Clear
Dim iv As itemvalue
Connection.myCUR = Connection.mySQL.ExecQuery("SELECT * from Customer")
If Connection.myCUR.RowCount > 0 Then
For i = 0 To Connection.myCUR.RowCount - 1
Connection.myCUR.Position = i
CustomListView1.Add(CreateItem(Connection.myCUR.GetString("Code"),Connection.myCUR.GetString("GSM"),Connection.myCUR.GetString("Style"),iv),iv)
Next
End If
End Sub
This all works fine... but,
Now what I want is when click the Edit button, I want to get the text from iv.lblstyle.text
Here is the Code I used,
B4X:
Sub btnedit_Click
Status = "U"
Dim index As Int = CustomListView1.GetItemFromView(Sender)
Dim iv As itemvalue = CustomListView1.GetValue(index)
Dim Value As String
Value = iv.lblstyle.text
Connection.myCUR = Connection.mySQL.ExecQuery("SELECT * from Customer WHERE Style='" & Value & "'")
If Connection.myCUR.RowCount > 0 Then
For i = 0 To Connection.myCUR.RowCount - 1
Connection.myCUR.Position = i
c = Connection.myCUR.GetString("Code")
st = Connection.myCUR.GetString("Style")
gsm = Connection.myCUR.GetString("GSM")
Next
End If
End Sub
then I get an error to initialize the label (iv.lblstyle.text)
How to get the text ? :-(