Hello,
I have a TREE and after filling it up I want to show it in full. Now I have to click on every 'plus' sign in order to expand. Some branches are opened at start but most of them I have to click on.
Thanks, Serge
How to EXPAND TREE with single command
Moderator: Rathinagiri
- serge_girard
- Posts: 3420
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
How to EXPAND TREE with single command
There's nothing you can do that can't be done...
Re: How to EXPAND TREE with single command
Maybe...
Code: Select all
IF Form_1.Tree_1.IsExpand( Form_1.Tree_1.Value )
Form_1.Tree_1.Collapse( Form_1.Tree_1.Value )
ELSE
Form_1.Tree_1.Expand( Form_1.Tree_1.Value )
ENDIF
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
- serge_girard
- Posts: 3420
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: How to EXPAND TREE with single command
Andres,
And in a loop?
Serge
And in a loop?
Serge
There's nothing you can do that can't be done...
Re: How to EXPAND TREE with single command
Yeap, in a loop:
Code: Select all
Function ExpandAll ()
Local nValue
FOR EACH nValue IN Form_1.Tree_1.AllValue
IF Form_1.Tree_1.IsTrueNode ( nValue ) .AND. Empty ( Form_1.Tree_1.ParentValue ( nValue ) )
Form_1.Tree_1.Expand ( nValue /* main nodes */ , .T. /* recursive */ )
ENDIF
NEXT
RETURN
**********************************************************
Function CollapseAll ()
Local nValue
FOR EACH nValue IN Form_1.Tree_1.AllValue
IF Form_1.Tree_1.IsTrueNode ( nValue ) .AND. Empty ( Form_1.Tree_1.ParentValue ( nValue ) )
Form_1.Tree_1.Collapse ( nValue /* main nodes */ , .T. /* recursive */ )
ENDIF
NEXT
RETURN
Re: How to EXPAND TREE with single command
Hi Serge,
Please take a look the updated sample below which was posted by our late friend Bicahi Esgici in 2008:
Code: Select all
/*
MINIGUI - Harbour Win32 GUI library Demo/Sample
Copyright 2002-08 Roberto Lopez <harbourminigui@gmail.com>
TreeMenu is Freeware HMG TREE sample.
Author : Bicahi Esgici
Not really an alternative "menu", simply denote to evaluate
ON DBLCLICK event in TREE.
Since NODE and TREEITEM statements does not have any event
definition, event management in TREE require a little
different way.
All bug reports and suggestions are welcome.
Developed under Harbour Compiler and
MINIGUI - Harbour Win32 GUI library (HMG).
Thanks to "Le Roy" Roberto Lopez.
*/
#include "minigui.ch"
PROCEDURE Main()
DEFINE WINDOW frmTreeMenu ;
AT 0,0 ;
WIDTH 640 ;
HEIGHT 480 ;
TITLE 'Tree Menu Sample' ;
MAIN ;
ON INIT ExpandAll()
ON KEY ESCAPE ACTION frmTreeMenu.Release
DEFINE TREE treMenu AT 0,0 WIDTH 100 HEIGHT 160 ;
ON DBLCLICK { || RunAction( this.Value ) }
NODE 'New' // 1
TREEITEM 'Table' // 2
TREEITEM 'Text' // 3
TREEITEM 'Project' // 4
END NODE
NODE 'Open' // 5
TREEITEM 'Table' // 6
TREEITEM 'Text' // 7
TREEITEM 'Project' // 8
END NODE
END TREE
END WINDOW
CENTER WINDOW frmTreeMenu
ACTIVATE WINDOW frmTreeMenu
RETURN // Main()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
PROCEDURE ExpandAll()
LOCAL i
FOR i := 1 TO frmTreeMenu.treMenu.ItemCount
IF TreeItemIsTrueNode( 'treMenu', 'frmTreeMenu', i )
frmTreeMenu.treMenu.Expand( i, .T. )
ENDIF
NEXT
RETURN // ExpandAll()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
PROCEDURE RunAction( ;
nTreeItemNo )
SWITCH nTreeItemNo
CASE 2 // New Table
NewTable()
EXIT
CASE 3 // New Text
NewText()
EXIT
CASE 4 // New Project
NewProject()
EXIT
CASE 6 // Open Table
OpenTable()
EXIT
CASE 7 // Open Text
OpenText()
EXIT
CASE 8 // Open Project
OpenProject()
ENDSWITCH
RETURN // RunAction()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
PROCEDURE NewTable()
MsgBox( "New Table procedure will run." )
RETURN // NewTable()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
PROCEDURE NewText()
MsgBox( "New Text procedure will run." )
RETURN // NewText()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
PROCEDURE NewProject()
MsgBox( "New Project procedure will run." )
RETURN // NewProject()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
PROCEDURE OpenTable()
MsgBox( "Open Table procedure will run." )
RETURN // OpenTable()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
PROCEDURE OpenText()
MsgBox( "Open Text procedure will run." )
RETURN // OpenText()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
PROCEDURE OpenProject()
MsgBox( "Open Project procedure will run." )
RETURN // OpenProject()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
Last edited by gfilatov on Mon Nov 28, 2022 10:05 am, edited 1 time in total.
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- serge_girard
- Posts: 3420
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: How to EXPAND TREE with single command
Thanks Grigory & Edward (+ the laste Esgici RIP)
I wil give it try!
Serge
I wil give it try!
Serge
There's nothing you can do that can't be done...
Re: How to EXPAND TREE with single command
Hi Serge
<ParentWindowName>.<TreeControlName>.Expand ( nValue , lRecursive )
<ParentWindowName>.<TreeControlName>.Collapse ( nValue , lRecursive )
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.