B4J Question CustomViews

Discussion in 'B4J Questions' started by moore_it, Apr 16, 2019.

  1. moore_it

    moore_it Active Member Licensed 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
     
  2. Cableguy

    Cableguy Expert Licensed 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
     
  3. moore_it

    moore_it Active Member Licensed User

    Tanks for reply,
    I need to get the customview object like an pane or label and so on it's possible ?
     
  4. Cableguy

    Cableguy Expert Licensed 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
     
  5. moore_it

    moore_it Active Member Licensed User

    oh thanks
    good idea !
    i try
     
  6. Cableguy

    Cableguy Expert Licensed 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.
     
  7. MarkusR

    MarkusR Well-Known Member Licensed User

    i believe the view are a basic class you need cycle through objects and check if object is your customview.
     
  8. moore_it

    moore_it Active Member Licensed User

    Thanks for reply again,
    but when i need to get the customview properties how i do ?
     
  9. moore_it

    moore_it Active Member Licensed User

    or customview methods ?
     
  10. Cableguy

    Cableguy Expert Licensed 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.
     
  11. MarkusR

    MarkusR Well-Known Member Licensed User

    hmm it appear as Pane not CustomView ...
    Code:
    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
     
  12. moore_it

    moore_it Active Member Licensed 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 ?
     
  13. Cableguy

    Cableguy Expert Licensed 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?
     
  14. moore_it

    moore_it Active Member Licensed User

    I need to get the object (class) not an node !
    The object have all my methods and my properties the node no !
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice