B4J Question [Solved] How "MainForm.RootPane.GetAllViewsRecursive" when view is SwiftButton?

Dadaista

Active Member
Licensed User
Longtime User
Hi

I changed buttons in app for SwiftButton and now the line below does not work
B4X:
For Each swb As node In MainForm.RootPane.GetAllViewsRecursive

I try with
B4X:
For Each swb As B4XView In MainForm.RootPane.GetAllViewsRecursive
If swb Is SwiftButton Then Log("SwiftButton")
That doesn't work either

How can I solved?
 

Cableguy

Expert
Licensed User
Longtime User
If I understand correctly, the swift button is a custom view.
The ide does not know what a custom view "is", nor what view it mimics... to the idea, the custom view is just a panel.
I would use the tag property of the base panel and use it as a means of getting that type of info.
 
Upvote 0

Dadaista

Active Member
Licensed User
Longtime User
The tag property of the SwiftButton contains a code "00000..."
Doesn't it matter if the tag is pre-filled with a code?
I am going to try...

Thx @Cableguy
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
The tag property of the SwiftButton contains a code "00000..."
Doesn't it matter if the tag is pre-filled with a code?
I am going to try...

Thx @Cableguy
the tag can hold an object, it can even hold an array or even a type
 
Upvote 0

Dadaista

Active Member
Licensed User
Longtime User
I pre-filled the tag property of all SwiftButtons with a code. I hope that does not matter... but I'm afraid I'm not going to know how to solve it
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
If you define a type and set it to the tag property, you can add as many fields as you want even with different primitives
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Like
Dim swiftbuttontag( code as int, Viewtype as string)
Dim siftbuttontag1 as swiftbuttontag
Swifbuttontag1.initialize(0,"swftbtn1")
Switftbutton1.tag = swiftbutyontag1

This is pseudoscience, not sure of correct syntax
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
But for what doing that?... must I do that to GetAllViewsRecursive?:rolleyes:
The same principle applies...
But "we" tend to use that tag property in a simplistic way, setting a single value to it... but since it can hold an object, it can do much more, even hold a reference to another view.
 
Last edited:
Upvote 0
Top