Weird? Tag return

enonod

Well-Known Member
Licensed User
Longtime User
Because I cannot pass a variable to an Event...
I have tried the following and failed. Sub exited doing nothing.
B4X:
Elsewhere 
bFlag=True
btnEOK.Tag=bFlag

Sub btnEOK_click
   If btnEOK.tag=False Then 
      Log("Data Saved")
   Else If btnEOK.tag=True Then  'I tried just else, and it 'appeared' to work
      Log("Closed")                'until I added the =True to prove it
   End If
End Sub

The I used a variable and it worked, can somebody say why please. [EDIT] Debugging shows that the tag has the correct value.
B4X:
Sub btnEOK_click
Dim b as boolean
b=btnEOK.Tag
   If b=False Then 
      Log("Data Saved")
   Else If b Then  
      Log("Closed")            
   End If
End Sub
 
Last edited:

klaus

Expert
Licensed User
Longtime User
In this case If btnEOK.tag=False Then is considered by default as a String.
This would work If btnEOK.tag="False" Then

With
Dim b as Boolean
b=btnEOK.Tag

You convert the String to a Boolean variable.
I had a similar problem with Integer values, neede as you to define a variable to convert it.

Best rgeards.
 
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
Thank you for confirming that I am not insane; well not over this anyway.
 
Upvote 0
Top