Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
8
Erster Beitrag:
vor 4 Jahren, 10 Monaten
Letzter Beitrag:
vor 4 Jahren, 10 Monaten
Beteiligte Autoren:
Allard, Jose Antonio Garrido, Piet van Zanten, DerekT, Igor Pobi

treeview() wd18

Startbeitrag von Allard am 24.09.2013 09:20

Hi,
I have looked at the help for some time now and I cannot find what I want.

I have a treeview control . I want to know what level of the treeview is selected. So I can make a button that opens a screen, based on the level selected,so i can edit the file of that level.

thanks

allard

Antworten:

Hello !

In order to get the current level, you use the following recursive procedure :

PROCEDURE TableLevel(table_name, table_line, table_level)
My_level is int
My_Parent is int = TableGiveParent(table_name,table_line)
IF My_Parent = 0 THEN
RESULT table_level
ELSE
RESULT TableLevel(table_name,My_Parent, table_level + 1)
END


It will return 0 for the root, 1 for the first level, and so on.

An example of call is :

Trace(TableLevel("TVT_Tabela",TVT_Tabela,0))



Quote
Allard
Hi,
I have looked at the help for some time now and I cannot find what I want.

I have a treeview control . I want to know what level of the treeview is selected. So I can make a button that opens a screen, based on the level selected,so i can edit the file of that level.

thanks

allard


von Igor Pobi - am 24.09.2013 12:29
Hi I mean a treeview control not a treeview table.

Maybe it goes for treeview as well? I'll take a look at it. Thanks

Allard

von Allard - am 24.09.2013 14:43
Allard

No it does not - for a treeview you need to store the complete path of the node and leaves to get back to were you where/are.

Much much easier to use a treeview table as illustrated by Igor.
5 minutes and you can make it look like a standard treeview if that is what you need and from then on plain sailing.

von DerekT - am 24.09.2013 15:10
Hi Allard,

You can simply count the number of TABs (+1) in the path returned by TreeSelect using StringCount.

Regards,
Piet

von Piet van Zanten - am 24.09.2013 15:15
Thanks Piet,

I have looked at treeviewtable as well. But your tip worked for me. I used a treeview

Odd
There is almoast no documentetion on the treeview when you want to add nodes leafs etc in the control itself ( filling it with real data) saving the tree was a bit of a hassel as well! again no documentation.

In my app I need onley 4 levels so I made a file for every level. In theorie unlimited levels would be nicer but not really nessisary so I used 4 files. How do you cope with this?

If anyone would like to see the code I produced to make it work I can post it. Its quite a work arround

regards

allard

von Allard - am 26.09.2013 10:27
Hi Allard.
Quote
There is almoast no documentetion on the treeview when you want to add nodes leafs etc in the control itself ( filling it with real data) saving the tree was a bit of a hassel as well! again no documentation.


Well, to add nodes you have the function TreeAdd. http://doc.pcsoft.fr/en-US/?1013126

And to save the treeview, if it is linked to a file or query, the modifications to the treeview are carried to the file automatically. http://doc.pcsoft.fr/en-US/?1013126

Quote
In my app I need onley 4 levels so I made a file for every level. In theorie unlimited levels would be nicer but not really nessisary so I used 4 files. How do you cope with this?


You dont have to add a file to the analysis for each level of the treeview. The files are not in relation to do type of control that will be used to show the information. With queries you can show one file with unlimited levels. (or multiple files all in the same level)

Regards,
José Antonio.

von Jose Antonio Garrido - am 26.09.2013 12:49
The saving feature doesnot work. Tried that. I know it shows in the help but I couldnot get it to work, seems to be a bug?

So I did it by programming. It now works exactly like I want

Thanks

Allard

von Allard - am 26.09.2013 14:53
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.