Lucas Eduardo Active Member Licensed User Apr 24, 2020 #1 Hello, i am trying to make a layout that have three views in each item of CLV and it's a CLVNested. I did an example project to demonstrate that it's not working. Is there a way to do this with CLVNested ? this is not working Code: Sub Label1_Click Dim index As Int = clvItem.GetItemFromView(Sender) Log("label1: "&index) End Sub Sub Label2_Click Dim index As Int = clvItem.GetItemFromView(Sender) Log("label2: "&index) End Sub Attachments clickNested.zip clickNested.zip 13.8 KB · Views: 405
Hello, i am trying to make a layout that have three views in each item of CLV and it's a CLVNested. I did an example project to demonstrate that it's not working. Is there a way to do this with CLVNested ? this is not working Code: Sub Label1_Click Dim index As Int = clvItem.GetItemFromView(Sender) Log("label1: "&index) End Sub Sub Label2_Click Dim index As Int = clvItem.GetItemFromView(Sender) Log("label2: "&index) End Sub
Erel B4X founder Staff member Licensed User Longtime User Apr 26, 2020 #2 CLVItem_ItemClick event is raised whenever an internal item is clicked. You can see how it is handled in tpc_OnInterceptTouchEvent. It should be simple to pass the X offset and find the correct view based onit. Upvote 0
CLVItem_ItemClick event is raised whenever an internal item is clicked. You can see how it is handled in tpc_OnInterceptTouchEvent. It should be simple to pass the X offset and find the correct view based onit.
Lucas Eduardo Active Member Licensed User Apr 27, 2020 #3 Sorry, i don't how to do this. Can you give an example? Thank you. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Apr 27, 2020 #4 Change CallSub2 to CallSub3 and add the X parameter to the event. Upvote 0
Lucas Eduardo Active Member Licensed User Apr 27, 2020 #5 Erel said: Change CallSub2 to CallSub3 and add the X parameter to the event. Click to expand... Code: CallSub3(ScrollingCLV, "Panel" & "ClickHandler", ScrollingCLV.GetRawListItem(innerIndex).Panel, X) Thank you for your reply, i followed your suggest and i get this error java.lang.Exception: Sub panelclickhandler signature does not match expected signature. What could be? Upvote 0
Erel said: Change CallSub2 to CallSub3 and add the X parameter to the event. Click to expand... Code: CallSub3(ScrollingCLV, "Panel" & "ClickHandler", ScrollingCLV.GetRawListItem(innerIndex).Panel, X) Thank you for your reply, i followed your suggest and i get this error java.lang.Exception: Sub panelclickhandler signature does not match expected signature. What could be?
DonManfred Expert Licensed User Longtime User Apr 27, 2020 #6 Lucas Eduardo said: java.lang.Exception: Sub panelclickhandler signature does not match expected signature. Click to expand... have you added the new parameter to panelclickhandler? Upvote 0
Lucas Eduardo said: java.lang.Exception: Sub panelclickhandler signature does not match expected signature. Click to expand... have you added the new parameter to panelclickhandler?
Lucas Eduardo Active Member Licensed User Apr 27, 2020 #7 I don't think so, i don't undestand where add this new parameter to panelclickhandler. Can you show me? i tryed this, but gave me the same error Code: Sub CLVItem_ItemClick (Index As Int, Value As Object, test As Int) Log("test: "&test) Log("Value: "&Value) Log("Index: "&Index) End Sub Thank you. Last edited: Apr 27, 2020 Upvote 0
I don't think so, i don't undestand where add this new parameter to panelclickhandler. Can you show me? i tryed this, but gave me the same error Code: Sub CLVItem_ItemClick (Index As Int, Value As Object, test As Int) Log("test: "&test) Log("Value: "&Value) Log("Index: "&Index) End Sub Thank you.
Erel B4X founder Staff member Licensed User Longtime User Apr 28, 2020 #8 You are correct. My previous suggestion will not work. You can instead store the offset in a global variable and get it inside the event sub. Code: Sub CLVItem_ItemClick (Index As Int, Value As Object) Dim offset As Int = Nested.ClickedOffset Upvote 0
You are correct. My previous suggestion will not work. You can instead store the offset in a global variable and get it inside the event sub. Code: Sub CLVItem_ItemClick (Index As Int, Value As Object) Dim offset As Int = Nested.ClickedOffset
Lucas Eduardo Active Member Licensed User Apr 28, 2020 #9 Erel said: You can instead store the offset in a global variable and get it inside the event sub. Click to expand... I did it but i don't know how to get the correct view. i tryed this but gave me an error. Code: Dim lbl As Label = clvItem.GetPanel(Index).GetView(offset) and Code: Dim lbl As Label = clvItem.GetPanel(clvItem.FindIndexFromOffset(offset)).GetView(0) Probably not the correct way to get the view, can you show me the correct way? Thank you. Last edited: Apr 28, 2020 Upvote 0
Erel said: You can instead store the offset in a global variable and get it inside the event sub. Click to expand... I did it but i don't know how to get the correct view. i tryed this but gave me an error. Code: Dim lbl As Label = clvItem.GetPanel(Index).GetView(offset) and Code: Dim lbl As Label = clvItem.GetPanel(clvItem.FindIndexFromOffset(offset)).GetView(0) Probably not the correct way to get the view, can you show me the correct way? Thank you.
Erel B4X founder Staff member Licensed User Longtime User Apr 28, 2020 #10 Assuming that your items layouts are not too complicated it should be quite simple. Something like: Code: Dim pnl As B4XView = clvItem.GetPanel(Index) For i = 0 To pnl.NumberOfViews - 1 Dim v As B4XView = pnl.GetView(i) if v.Left <= offset And v.Left + v.Width >= offset Then Log("This view") End If Last edited: Apr 28, 2020 Upvote 0
Assuming that your items layouts are not too complicated it should be quite simple. Something like: Code: Dim pnl As B4XView = clvItem.GetPanel(Index) For i = 0 To pnl.NumberOfViews - 1 Dim v As B4XView = pnl.GetView(i) if v.Left <= offset And v.Left + v.Width >= offset Then Log("This view") End If
Lucas Eduardo Active Member Licensed User Apr 28, 2020 #11 Erel said: clvItem.NumberOfViews Click to expand... Is it the correct way to get total of NumberOfViews? Code: Public Sub getNumberOfViews As Int Return CLV.GetPanel(0).NumberOfViews End Sub or should be this? Code: For i = 0 To clvItem.GetPanel(0).NumberOfViews - 1 Upvote 0
Erel said: clvItem.NumberOfViews Click to expand... Is it the correct way to get total of NumberOfViews? Code: Public Sub getNumberOfViews As Int Return CLV.GetPanel(0).NumberOfViews End Sub or should be this? Code: For i = 0 To clvItem.GetPanel(0).NumberOfViews - 1
Erel B4X founder Staff member Licensed User Longtime User Apr 28, 2020 #12 I've fixed my code. It should be pnl.NumberOfViews. Upvote 0
Lucas Eduardo Active Member Licensed User Apr 28, 2020 #13 I'm never getting the Log("This view") In my layout i just have two labels. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Apr 28, 2020 #14 Debug it. Put a breakpoint and check the offset and the views. Upvote 0
Lucas Eduardo Active Member Licensed User Apr 28, 2020 #15 pnl.NumberOfViews returns 0. Is it correct? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Apr 30, 2020 #16 It is correct. If it is not what you expect then you did something wrong. Upvote 0