Tab stops in ListBox gadget

BlitzMax Forums/MaxGUI Module/Tab stops in ListBox gadget

TomToad(Posted 2013) [#1]
Is there a way to set tab stops with a list box the same way you can with a text area? It seems that any list box item I add ignores the "~t" character.


Brucey(Posted 2013) [#2]
Probably not. You could always replace tabs with a set number of spaces to give the idea of indentation (which I presume you are after?).

Tree views are good at showing sub-items too ;-)


TomToad(Posted 2013) [#3]
You could always replace tabs with a set number of spaces to give the idea of indentation (which I presume you are after?).

No, that is not what I am after. I am trying to format items in a list. I can't just use a set number of spaces because of the variable width characters, and I really don't want to switch to a fixed width font.

Here's a sample of what I'm talking about.
SuperStrict
Import maxgui.drivers

Global MainWindow:TGadget = CreateWindow("Hello",0,0,800,600,Null,WINDOW_TITLEBAR|WINDOW_CENTER)
Global TextList:TGadget = CreateTextArea(0,0,ClientWidth(MainWindow),ClientHeight(MainWindow),MainWindow) 'Create a text area
'Global TextList:TGadget = CreateListBox(0,0,ClientWidth(MainWindow),ClientHeight(MainWindow),MainWindow) 'create a list box

Global ID:Int[] = [101,215,351,412,508]
Global Name:String[] = ["frank","Mary","Judy","Mike","Sam"]

For Local i:Int = 0 To 4
	AddTextAreaText(TextList,ID[i]+"~t"+Name[i]+"~n") 'Add An Item to the text area
	'AddGadgetItem(TextList,ID[i]+"~t"+Name[i]) 'Add an item to the list box
Next

Repeat
	WaitEvent()
	If EventID() = EVENT_WINDOWCLOSE Or EventID() = EVENT_APPTERMINATE Then End
Forever



Brucey(Posted 2013) [#4]
Ah, I get you.
So what you really want is a multi-column listbox, which still isn't available in your bog-standard MaxGUI, as far as I am aware.

Your best bet (whilst sticking with MaxGUI), would be to forge your own "proxy" gadget which takes on the appearance of a listbox with multiple columns. Probably a load of work though.

Your next-best bet would be to enquire (again) about multi-column listbox support in MaxGUI.

Your next-next-best bet would be some kind of third-party replacement GUI. But they are usually more OOP-based than MaxGUI's BlitzBasic procedural approach.

:o)


Henri(Posted 2013) [#5]
Hello,

there are 2 different listviews in this site, one by Ziltch and one by Ghostdancer. Search "listview". There is a poor man's option to use LSet() or RSet() to pad a string to certain length, but it's a bit problematic, as you said, fonts usually have different length characters.

-Henri


PS. ListViews are Windows only


skidracer(Posted 2013) [#6]
I would try a readonly textarea and add some code to manage / set active / select entire lines.


Grisu(Posted 2013) [#7]
You might want to give this a try.

Quite a few users here would gladly pay for a cross-platform multi-column listbox support. - Don't expect miracles as Seb is gone.


TomToad(Posted 2013) [#8]
Thanks for the help. Looks like I might have to kludge something together since I do want to eventually compile for Mac and Linux.


jsp(Posted 2013) [#9]
While I do have a multi column listbox coming with Logic Gui it is unfortunately windows only:
http://jsp.logiczone.de/downloads/ListViewDemo.zip

For a simple cross platform multi column listbox I actually used also a fixed font. Did the task for what I needed.