Android Question CSBuilder Click And Label Click

alon

Active Member
Licensed User
Longtime User
Hi All,


I am using CSBuilder to mark a specific text in a string,

the marked text is a phone number which in the click event of the CSBuilder,

I need to dial to the phone number.

The problem is that I have two click events one for the CSBuilder

and the other is on the label which the CSBuilder text is displayed on.

Now the first event fired is the Label_click, and I need to know if the user clicked on the marked text

or on the label.

Is there any solution for that issue?


Thanks in advance
 
Upvote 0
https://www.b4x.com/android/forum/threads/charsequence-csbuilder-tutorial.76226/#content
Check the Tutorial about the Clickable word and use this technique to mark the number clickable. Use the event to dial the number then...

Thansk 4 the quick answer,
But I know how to make the text clickable,
the problem is that I have click event of the cs builder which should make a dial
and also a click event on the lable which doing something else.
now when the user click on the cs builder the label click event also fired.

Thanks
 
Upvote 0
Maybe it is better to switch to LongClick instead for the label. Otherwise you will get false clicks.

I am afraid that it will be a problem for the users already used to click on the label.
But if there is no other solution I will consider doing it.
btw, is there a long click for the cs builder?
 
Upvote 0
btw, is there a long click for the cs builder?
No.

Workaround to ignore label clicks:
Code:
Sub Process_Globals
   Private LastCSClick As Long
End Sub

Sub Globals
   Private Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   Dim cs As CSBuilder
   cs.Initialize.Append("1 2 3 ").Clickable("csLabel1", "tag").Append("click").Pop.Append("...").PopAll
   Label1.Text = cs
   cs.EnableClickEvents(Label1)
End Sub

Sub csLabel1_Click (Tag As Object)
   LastCSClick = DateTime.Now
   Log("cs click")
End Sub

Sub Label1_Click
   Sleep(0)
   If LastCSClick + 200 > DateTime.Now Then
       Log("Ignoring label click")
       Return
   End If
   Log("Label1_Click")
End Sub
 
Upvote 0
No.

Workaround to ignore label clicks:
Code:
Sub Process_Globals
   Private LastCSClick As Long
End Sub

Sub Globals
   Private Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   Dim cs As CSBuilder
   cs.Initialize.Append("1 2 3 ").Clickable("csLabel1", "tag").Append("click").Pop.Append("...").PopAll
   Label1.Text = cs
   cs.EnableClickEvents(Label1)
End Sub

Sub csLabel1_Click (Tag As Object)
   LastCSClick = DateTime.Now
   Log("cs click")
End Sub

Sub Label1_Click
   Sleep(0)
   If LastCSClick + 200 > DateTime.Now Then
       Log("Ignoring label click")
       Return
   End If
   Log("Label1_Click")
End Sub


Thanks , I will try it.
 
Upvote 0

Similar Threads

Back
Top