ListIcon Column Seperator Options

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

ListIcon Column Seperator Options

Post by IdeasVacuum »

Currently, if a ListIcon has more than one column, a whole Row can be added in one go with each Cell seperated with Chr(10) [=#LF$], like this:

Code: Select all

AddGadgetItem(iMyList, -1, "MyCol0" + #LF$ + "MyCol1" + #LF$ + "MyCol2")
However, when processing files, #LF$ is not a good choice - If, for example, I have a file whose Row Cells are seperated by commas, tabs or vertical bar chars, I'd like to 'tell' the ListIcon to accept the file's seperator instead of having to preprocess the file to change the seperator.

Edit: This would also enable the ability to extract (Get) a whole row instead of one-cell-at-a-time
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: ListIcon Column Seperator Options

Post by netmaestro »

Commas could be problematic as they might be found in data such as numbers that use the comma for a decimal point, name fields like "Smith, John" etc. and there are lots of other scenarios where a comma could appear. But the concept of being able to write SetGadgetAttribute(#listicon, #PB_Listicon_Separator, <some string>) would be attractive imho.
BERESHEIT
ebs
Enthusiast
Enthusiast
Posts: 557
Joined: Fri Apr 25, 2003 11:08 pm

Re: ListIcon Column Seperator Options

Post by ebs »

I'm probably stating the obvious, but a simple workaround that I use is:

Code: Select all

AddGadgetItem(iMyList, ReplaceString(RecordWithTabs, #TAB$, #LF$))
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: ListIcon Column Seperator Options

Post by IdeasVacuum »

That is what we have to do now ebs. We also have to do the reverse when saving ListIcon data to file.

The Utopian is for the file and the ListIcon to share the same seperator. Given that, we should be able to have a couple of much faster, simpler functions:

ListIconLoadFile(#PB_Seperator_xx)
ListIconSaveFile(#PB_Seperator_xx)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply