Bug? B4XImageView Tag field purpose?

agraham

Expert
Licensed User
Longtime User
B4XImageView has a Public Tag As Object field but if you try to use it it will be compiled as a gettag() method and cause a missing symbol compilation error.
Was there an intended use for this public field or is it a bug?
 
It works well:

1608299544080.png
 
I'm not arguing any more. If you can't see my point then stop and wait for Erel to comment.
Don't get nervous, it's not worth it. ;)
Of course, I stop writing when I decide (or Erel, of course ?)

This is more or less the code posted by @stari. I wrote the string value of the Tag, obviously, he didn't; and this code doesn't produce that error.
B4X: Copy
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
  
    Private TappedCard As B4XImageView
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
  
    TappedCard.Tag = "abc_def.png"
  
    Dim card_name As String
    card_name = Regex.Split("_", TappedCard.Tag)(0).Replace("_", " ").Replace(".png", "")
    Log(card_name)
End Sub

Log:
abc
 
Last edited:
Don't get nervous, it's not worth it. ;)
Of course, I stop writing when I decide.

This is more or less the code posted by @stari. I wrote the string value of the Tag, obviously, he didn't; and this code doesn't produce that error.
B4X: Copy
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
  
    Private TappedCard As B4XImageView
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
  
    TappedCard.Tag = "abc_def.png"
  
    Dim card_name As String
    card_name = Regex.Split("_", TappedCard.Tag)(0).Replace("_", " ").Replace(".png", "")
    Log(card_name)
End Sub

Log:
abc
Hello
I trayed your sample.
I create Page5 in project from @Erel, TrhePagesExample.
Exactly the code you wrote, i put in Page 5. And?
I get ste same error message:
Compiling generated Java code. Error
B4A line: 23
TappedCard.Tag = \
src\b4a\example\b4xpage5.java:102: error: cannot find symbol
__ref._tappedcard /*b4a.example.b4ximageview*/ ._settag((Object)("abc_def.png"));
^
symbol: method _settag(Object)
location: variable _tappedcard of type b4ximageview
 
I trayed your sample.
You can't write that you tried my example without indicating which one!

I had to look for it and I suppose you are referring to this:
https://www.b4x.com/android/forum/threads/card-flip-flip-between-2-images.113408/post-708588

It has:
B4X: Copy
Sub Card_OneClick
    Dim Card As clsCard = Sender
    Card.FlipAnim(True)
End Sub

where, as you can see, the object clicked is of type clsCard, a class I created and included, not a B4XImageView or other stuff.
The project you attached here does not include that class (clsCard).
 
Back
Top