M m643 Member Licensed User Longtime User Jun 23, 2013 #1 Hi, I'm using the customlistview. Is there also the possibility to use the Longclick and show a menu? I can't this in the documentation. Michael
Hi, I'm using the customlistview. Is there also the possibility to use the Longclick and show a menu? I can't this in the documentation. Michael
Erel B4X founder Staff member Licensed User Longtime User Jun 24, 2013 #2 You will need to modify CustomListView code. See the Panel_Click sub. You will need to implement a similar sub for Panel_LongClick. Upvote 0
You will need to modify CustomListView code. See the Panel_Click sub. You will need to implement a similar sub for Panel_LongClick.
imgsimonebiliato Well-Known Member Licensed User Longtime User Dec 15, 2014 #3 Hello @m643 , have you solved this thread? Can you please post your code? Upvote 0
mangojack Expert Licensed User Longtime User Dec 15, 2014 #4 In the CustomListView class duplicate the Panel_Click Sub .. and change event name & parameter strings. Code: Private Sub Panel_LongClick If SubExists(CallBack, EventName & "_LongClick") Then Dim v As View v = Sender CallSub3(CallBack, EventName & "_LongClick", v.Tag, items.Get(v.Tag)) End If End Sub Then in your Main module .. Code: Sub clv1_LongClick (Index As Int,Value As Object) Upvote 0
In the CustomListView class duplicate the Panel_Click Sub .. and change event name & parameter strings. Code: Private Sub Panel_LongClick If SubExists(CallBack, EventName & "_LongClick") Then Dim v As View v = Sender CallSub3(CallBack, EventName & "_LongClick", v.Tag, items.Get(v.Tag)) End If End Sub Then in your Main module .. Code: Sub clv1_LongClick (Index As Int,Value As Object)
Shay Well-Known Member Licensed User Longtime User Dec 18, 2014 #5 Hi I did the above, and once I press long click I am getting: java.lang.Exception: Sub clv3_longclick signature does not match expected signature. at anywheresoftware.b4a.BA.raiseEvent2(BA.java:177) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:163) at anywheresoftware.b4a.BA.raiseEvent(BA.java:159) at anywheresoftware.b4a.objects.ViewWrapper$2.onLongClick(ViewWrapper.java:87) at android.view.View.performLongClick(View.java:4268) at android.widget.TextView.performLongClick(TextView.java:8309) at android.view.View$CheckForLongPress.run(View.java:17277) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4921) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) at dalvik.system.NativeStart.main(Native Method) java.lang.Exception: Sub clv3_longclick signature does not match expected signature. Upvote 0
Hi I did the above, and once I press long click I am getting: java.lang.Exception: Sub clv3_longclick signature does not match expected signature. at anywheresoftware.b4a.BA.raiseEvent2(BA.java:177) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:163) at anywheresoftware.b4a.BA.raiseEvent(BA.java:159) at anywheresoftware.b4a.objects.ViewWrapper$2.onLongClick(ViewWrapper.java:87) at android.view.View.performLongClick(View.java:4268) at android.widget.TextView.performLongClick(TextView.java:8309) at android.view.View$CheckForLongPress.run(View.java:17277) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4921) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) at dalvik.system.NativeStart.main(Native Method) java.lang.Exception: Sub clv3_longclick signature does not match expected signature.
DonManfred Expert Licensed User Longtime User Dec 18, 2014 #6 Shay said: clv3_longclick signature does not match expected signature. Click to expand... what IS the signature of your sub? Help us (giving more informations (code)) to help you Upvote 0
Shay said: clv3_longclick signature does not match expected signature. Click to expand... what IS the signature of your sub? Help us (giving more informations (code)) to help you
Shay Well-Known Member Licensed User Longtime User Dec 18, 2014 #7 You mean this? Code: Sub clv3_LongClick (Index As Int,Value As Object) Log("OK") End Sub Upvote 0
mangojack Expert Licensed User Longtime User Dec 18, 2014 #8 Shay .. just to be sure , can you post the class Panel_Longclick sub. Upvote 0
Shay Well-Known Member Licensed User Longtime User Dec 19, 2014 #9 Did Copy & Paste from the above Code: Private Sub Panel_LongClick If SubExists(CallBack, EventName & "_LongClick") Then Dim v As View v = Sender CallSub3(CallBack, EventName & "_LongClick", v.Tag, items.Get(v.Tag)) End If End Sub But now - this is strange: I put the same code on "CustomListView" example project and it is working fine How can it be? Upvote 0
Did Copy & Paste from the above Code: Private Sub Panel_LongClick If SubExists(CallBack, EventName & "_LongClick") Then Dim v As View v = Sender CallSub3(CallBack, EventName & "_LongClick", v.Tag, items.Get(v.Tag)) End If End Sub But now - this is strange: I put the same code on "CustomListView" example project and it is working fine How can it be?
Shay Well-Known Member Licensed User Longtime User Dec 19, 2014 #10 I found some clue, if I do this, it will not crash: Code: Sub clv3_LongClick Log("OK") End Sub so what can it be? Upvote 0
I found some clue, if I do this, it will not crash: Code: Sub clv3_LongClick Log("OK") End Sub so what can it be?
Erel B4X founder Staff member Licensed User Longtime User Dec 19, 2014 #11 Don't confuse the panel LongClick event that you add inside CustomListView class (with no parameters) to the one that is outside the class with the two parameters. Upvote 0
Don't confuse the panel LongClick event that you add inside CustomListView class (with no parameters) to the one that is outside the class with the two parameters.
Shay Well-Known Member Licensed User Longtime User Dec 19, 2014 #12 This is in the class: (as written in the example above) Code: Private Sub Panel_LongClick If SubExists(CallBack, EventName & "_LongClick") Then Dim v As View v = Sender CallSub3(CallBack, EventName & "_LongClick", v.Tag, items.Get(v.Tag)) End If End Sub and this is in my activity: Code: Sub clv3_LongClick (Index As Int,Value As Object) Log("OK") End Sub And as I said if I change it (in my activity) to: Code: Sub clv3_LongClick Log("OK") End Sub it is not crashing, so how do I fix it? Thanks Upvote 0
This is in the class: (as written in the example above) Code: Private Sub Panel_LongClick If SubExists(CallBack, EventName & "_LongClick") Then Dim v As View v = Sender CallSub3(CallBack, EventName & "_LongClick", v.Tag, items.Get(v.Tag)) End If End Sub and this is in my activity: Code: Sub clv3_LongClick (Index As Int,Value As Object) Log("OK") End Sub And as I said if I change it (in my activity) to: Code: Sub clv3_LongClick Log("OK") End Sub it is not crashing, so how do I fix it? Thanks
mangojack Expert Licensed User Longtime User Dec 19, 2014 #13 Shay .. your code looks OK and it should work.. ? picking at straws ... does your module contain a normal click sub ... and it works as expected ? Code: clv3_ItemClick (Index As Int, Value As Object) Upvote 0
Shay .. your code looks OK and it should work.. ? picking at straws ... does your module contain a normal click sub ... and it works as expected ? Code: clv3_ItemClick (Index As Int, Value As Object)
Shay Well-Known Member Licensed User Longtime User Dec 19, 2014 #14 Ok, I found the issue I had label which is init as: Label1.Initialize("clv3") (I did this since I used other listView and I wanted to have same trigger as clv3) so once I changed the name of the above label, now it is ok strange thing that ItemClick had no issue, only the LongClick Upvote 0
Ok, I found the issue I had label which is init as: Label1.Initialize("clv3") (I did this since I used other listView and I wanted to have same trigger as clv3) so once I changed the name of the above label, now it is ok strange thing that ItemClick had no issue, only the LongClick