B4J Question CustomViews

moore_it

Well-Known Member
Licensed User
Longtime User
Hi all,
it's possible to get an customview in an pane.getallviewrecursive ?
The customview isn't a node how i do for get it?

Thanks in advice
 

Cableguy

Expert
Licensed User
Longtime User
The custom view has a Pane as its Base, so it should be possible to trap it. If not, add a reference to it with an array or map
 
Upvote 0

moore_it

Well-Known Member
Licensed User
Longtime User
Tanks for reply,
I need to get the customview object like an pane or label and so on it's possible ?
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Once you get a reference to the custom view you can do whatever you want/need

I woul suggest adding the custom views to a map, and set their TAG property, this way you only need to go through the map and "find" the right tag
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Actually it's simpler with a Map, as you set a key for each value, you don't need to set the Custom view's Tag property.
Just be sure to give a meaningful name to each key.
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
i believe the view are a basic class you need cycle through objects and check if object is your customview.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
What are you exactly trying to do?
A custom view is first declared like a normal view is, and you access it's properties like any other view... BUT you may need to expose some of those in the Custom view itself (Class) in order to access it in your code.
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
hmm it appear as Pane not CustomView ...
B4X:
    MainForm.RootPane.LoadLayout("Layout1")
    
    For Each o As Object In Form1.RootPane
        Log(o)
        'PaneWrapper$ConcretePaneWrapper$NonResizePane@3ce13c27
        If o Is Pane Then
            Dim c1 As Pane
            c1 = o
            Log("Here1")
        End If
        If o Is MyCustomView Then
            Dim c2 As MyCustomView
            c2 = o
            Log("Here2")
        End If
    Next
        
End Sub
 
Upvote 0

moore_it

Well-Known Member
Licensed User
Longtime User
When i get the node type an textfield i have the possibility to set the text but if i use an customview and create a new method that set the format of the text of the textfield in it, the method is not accesible becouse i see the textfield and only it's methods not the customview class methods ...

it's right ?
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I still don't understand what you are trying to do...
You must think of a custom view as a blank piece of paper, where you "Draw" whatever you need. The IDE only references the Base (the piece of paper), everything else that you need visible and accessible to the IDE, like props and methods, need to be explicitly set in the Custom View code...
Have you read Klaus chapter about Custom views?
 
Upvote 0

moore_it

Well-Known Member
Licensed User
Longtime User
I need to get the object (class) not an node !
The object have all my methods and my properties the node no !
 
Upvote 0
Top