Page 1 of 2

Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 1:55 am
by BarryG
I'd like to request a command that gets the full path of a selected TreeGadget item, as per this -> viewtopic.php?t=81858

In that example, the full path is separated by #PS$, but a new command could use #LF$ to be consistent with other commands.

For this request, I suggest that the command could be like this:

Code: Select all

Result$ = GetGadgetItemText(#Gadget, Item [, Column])
But the "Column" flag, which is currently ignored by TreeGadgets, could be set as #PB_All to get the full path instead. Please?

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 4:28 am
by AZJIO
You need to create a virtual structure of the file tree and add a link-pointer to the parent in it for each item in order to get the whole path along the chain. And in TreeGadget, for items, you need to use SetGadgetItemData() to specify a link to the parent in the virtual list.
http://purebasic.mybb.ru/viewtopic.php?id=810#p8227
viewtopic.php?t=77012 (See GetPath(), GetPathRecur())

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 6:20 am
by BarryG
Thanks, but I already linked to the answer. I just hoped it could become native, because it's something that would be very common to do.

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 6:36 am
by AZJIO
I didn't pay attention to the section where the question is. I agree it would be useful to have a function for all OS.

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 7:49 am
by Little John
+1 for this wish.
It would be a consistent and useful extension of PB's TreeGadget.

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 8:14 am
by mk-soft
-1
But they are still individual rows. So do it yourself.

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 8:27 am
by Little John
Ooops!
I overlooked that BarryG suggested to change the behaviour of GetGadgetItemText(). This is not good, backwards compatibility should be maintained. To get the complete path, a new function should be introduced (or a new optional parameter for GetGadgetItemText()).

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 8:36 am
by BarryG
Little John wrote: Sun Jun 18, 2023 8:27 amThis is not good, backwards compatibility should be maintained
I said this: the "Column" flag, which is currently ignored by TreeGadgets, could be set as #PB_All to get the full path instead.

So it wouldn't break anything because no TreeGadgets are using this flag at the moment. No backwards compatibility issue at all.

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 8:49 am
by Little John
I am sorry!

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 10:13 am
by Fips
-1

After all TreeGadget is not ExplorerTreeGadget (which can get the full path of the selected item by GetGadgetText() )

You can display all sorts of Information in Treegadget for instance a hierarchical structure of the employees of a company. I think in that case this would not be usefull.

I'd rather like to be able to get the linenumber of the parent entry with one command.

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 10:19 am
by BarryG
This is not about getting file paths. It's about getting the full tree path to the final child item, taking into account any parent nodes.

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 10:30 am
by Little John
mk-soft wrote: Sun Jun 18, 2023 8:14 am -1
But they are still individual rows.
And what is the problem?
Fips wrote: Sun Jun 18, 2023 10:13 am You can display all sorts of Information in Treegadget for instance a hierarchical structure of the employees of a company. I think in that case this would not be usefull.
In any tree – regardless of its content – there is a path from the root to each leaf. So this feature would be useful for all kinds of trees. Actually, asking for the full path of a leaf is a natural question for a tree.

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 11:36 am
by BarryG
Yep, that's precisely it, Little John.

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 1:56 pm
by Axolotl
BarryG wrote: Sun Jun 18, 2023 1:55 am I'd like to request a command that gets the full path of a selected TreeGadget item, as per this -> viewtopic.php?t=81858

In that example, the full path is separated by #PS$, but a new command could use #LF$ to be consistent with other commands.

For this request, I suggest that the command could be like this:

Code: Select all

Result$ = GetGadgetItemText(#Gadget, Item [, Column])
But the "Column" flag, which is currently ignored by TreeGadgets, could be set as #PB_All to get the full path instead. Please?
Hi BarryG,
I made a small improvement to my suggestion (see link).
And I would support the wish for built-in functions for TreeGadget().

Re: Get TreeGadget full path suggestion

Posted: Sun Jun 18, 2023 7:12 pm
by Fred
Which separator should be used in the sting ?