B4J Question Detect only Pane node in the form

Bossolo

Member
I need a metod to detect only the Pane node present in the in the form
Actually i use the following metod:
I have a form with 4 pane, all are not visible unless i select the one i want to use in the menubar.
Each Pane tag are set "pnl" + pane name, tha's the same item name use in the menubar

Basically i read every node in the MainForm and by the tag i can detect the pane i'm looking for to set it visibile and hide the others
There're better metods?


Find Pane:
Sub mnuMainBar_Action
    Dim mi As MenuItem = Sender
    Dim s As String

    Dim n As Node
   
    ' Disattivo tutti i pannelli tranne quello selezionato e pulisco la ricerca
    For Each n As Node In MainForm.RootPane.GetAllViewsRecursive
        s=n.Tag
        If s.Length>=3 Then
            If s="pnl"&sForm Then
                n.Visible=True
                n.Enabled=True
            Else
                If s.SubString2(0,3)="pnl" Then
                    n.Visible=False
                    n.Enabled=False
                End If
            End If
        End If
    Next
End Sub
 

klaus

Expert
Licensed User
Longtime User
How do you define the layout?
If you have on the Form only these for Panes you don't need to get all Nodes recursively, you will have only these four Nodes.
You could also define a Pane object as the current pane.
When you set a Pane visible, you set the CurrentPane to this Pane and when you want to change, you set CurrentPane.Visible to false, set the 'new' Pane to visible and set this one to CurrentPane.
CurrentPane holds a reference to the current visible Pane.

When you set Visible = False, you don't need to set Enabled = False !
 
Upvote 0

Bossolo

Member
How do you define the layout?
All by designer

If you have on the Form only these for Panes you don't need to get all Nodes recursively, you will have only these four Nodes.
Each pane has several node (textfield, label, checkbox) and in the mainform i have also a MenuBar and a CustomView

You could also define a Pane object as the current pane.
When you set a Pane visible, you set the CurrentPane to this Pane and when you want to change, you set CurrentPane.Visible to false, set the 'new' Pane to visible and set this one to CurrentPane.
CurrentPane holds a reference to the current visible Pane.

When you set Visible = False, you don't need to set Enabled = False !
Thanks, i will try this metod to manage the visible pane
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
... but my problem is to find which node is a pane without read every tag
How many Panes are visible at the same time?
If there is only one at the same time you know which one you set to visible, and when you set this one to CurrentPane you know it.
 
Upvote 0

Bossolo

Member
How many Panes are visible at the same time?
If there is only one at the same time you know which one you set to visible, and when you set this one to CurrentPane you know it.
Yeah just one at time, i just understand it after few minuti the reply (that's because i edited and delet that phrase ?)

Thanks a lot, tonight i will try to set it
 
Upvote 0
Top