Get TreeGadget full path suggestion

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Get TreeGadget full path suggestion

Post 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?
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: Get TreeGadget full path suggestion

Post 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())
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Get TreeGadget full path suggestion

Post 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.
AZJIO
Addict
Addict
Posts: 2143
Joined: Sun May 14, 2017 1:48 am

Re: Get TreeGadget full path suggestion

Post 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.
Little John
Addict
Addict
Posts: 4778
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Get TreeGadget full path suggestion

Post by Little John »

+1 for this wish.
It would be a consistent and useful extension of PB's TreeGadget.
User avatar
mk-soft
Always Here
Always Here
Posts: 6208
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Get TreeGadget full path suggestion

Post by mk-soft »

-1
But they are still individual rows. So do it yourself.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Little John
Addict
Addict
Posts: 4778
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Get TreeGadget full path suggestion

Post 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()).
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Get TreeGadget full path suggestion

Post 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.
Little John
Addict
Addict
Posts: 4778
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Get TreeGadget full path suggestion

Post by Little John »

I am sorry!
Fips
User
User
Posts: 35
Joined: Sun Feb 20, 2022 1:03 pm

Re: Get TreeGadget full path suggestion

Post 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.
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Get TreeGadget full path suggestion

Post 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.
Little John
Addict
Addict
Posts: 4778
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Get TreeGadget full path suggestion

Post 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.
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Get TreeGadget full path suggestion

Post by BarryG »

Yep, that's precisely it, Little John.
Axolotl
Addict
Addict
Posts: 802
Joined: Wed Dec 31, 2008 3:36 pm

Re: Get TreeGadget full path suggestion

Post 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().
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Get TreeGadget full path suggestion

Post by Fred »

Which separator should be used in the sting ?
Post Reply