View Name of Sender

Bill Norris

Active Member
Licensed User
Longtime User
I need to get the actual name of the view that is the Sender when using the send=sender syntax. I can't store it in Tag because I'm storing other info there.
 

warwound

Expert
Licensed User
Longtime User
Yes a custom Type used as a Tag value will work or you could use a Map perhaps to store more than one value as the Tag.

Martin.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
I'm not really up to speed on custom types and/or maps. Where to begin?

Let's say you have a View named MyView.

Currently you're saving a value as it's Tag:

B4X:
MyView.Tag="A string"

MyView's Tag is being used solely to store a single value.
Instead create and initialize a Map, assign it as MyView's Tag object:

B4X:
Dim TagValues As Map
TagValues.Initialize
TagValues.Put("OriginalValue", "A string")
TagValues.Put("ViewName", "My view name")
TagValues.Put("YetAnotherValue", 123.45)
MyView.Tag=TagValues

That way you can use the Tag's Map object to store as many individual values as you need.

Martin.
 
Upvote 0

CharlesIPTI

Active Member
Licensed User
Longtime User
Please forgive me

I have had to use custom types as my main informational storage devices and throwing them additionally into views just adds to the complexity and confusion.

However it is needed in B4A and I respect why is is a commonly implemented process to accomplish the required tasks..

I appreciate the idea of adding a map as the "type" of your custom type. I think that was a great Idea.

Pass some complex types with sub types around for a bit though and it becomes QUITE painful. Is B4A getting classes soon ?

:sign0104::sign0087:
 
Upvote 0

Bill Norris

Active Member
Licensed User
Longtime User
RE: Great!

Wonderful! NOw, do I retrieve those values using in index on the tag property, as in

myview.tag(0)
myview.tag(1)

or do I use

myview.originalvalue
myview.viewname
 
Upvote 0

CharlesIPTI

Active Member
Licensed User
Longtime User
Create Map instance
set instance = to view.tag.

then you can iterate the content of the map using the key value pairs

Basic4android - Collections (Core)

See Map on web page linked above

For i = 0 To Map1.Size - 1
Dim Key, Value As String
Key = Map1.GetKeyAt(i)
Value = Map1.GetValueAt(i)
Next

Similar to a list, a map can hold any object, however .....
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Wonderful! NOw, do I retrieve those values using in index on the tag property, as in

myview.tag(0)
myview.tag(1)

or do I use

myview.originalvalue
myview.viewname

You need to create a new Map object and assign the View's Tag to that new Map.
You can then access the Map's values using the Map's Get method:

B4X:
Dim TagValues As Map
TagValues=MyView.Tag
Dim ViewName As String
ViewName=TagValues.Get("ViewName")

Martin.
 
Upvote 0

CharlesIPTI

Active Member
Licensed User
Longtime User
Nope

saw some reference in the chat room about it

So thanks for the referral

DUCK what the .... Wikipedia time ...

Thanks man
 
Upvote 0
Top