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?
 

LucaMs

Expert
Licensed User
Longtime User
It works well:

1608299544080.png
 

LucaMs

Expert
Licensed User
Longtime User
It compiles wrongly in the example I linked to which is why I want Erel's comment on it.
But we don't know what is the bug in that code; certanly not the Tag property of B4XImageView, which has no bugs.
 

LucaMs

Expert
Licensed User
Longtime User
@stari posted only a routine, not a project, so I assume you have compiled your own project, including his code; post it.
 

LucaMs

Expert
Licensed User
Longtime User
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:
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:

LucaMs

Expert
Licensed User
Longtime User
@stari has probably put some ImageViews in his layout; then, in the click event, he assigns the Sender object to a local variable of type B4XImageView and this is the problem.
 
Last edited:

stari

Active Member
Licensed User
Longtime User
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:
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
 

LucaMs

Expert
Licensed User
Longtime User
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:
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).
 

LucaMs

Expert
Licensed User
Longtime User
Found the problem.

where, as you can see, the object clicked is of type clsCard, a class I created and included, not a B4XImageView or other stuff.
My clsCard class uses @Star-Dust's SD_XUIVew library, which provides its own B4XImageView (same name, big problem!).
 
Last edited:
Top