Jump to content


Photo

Listbox Columns >_<


  • Please log in to reply
12 replies to this topic

#1 jonny

jonny
  • Members
  • 2951 posts

Posted 09 December 2004 - 04:16 PM

OK, so what I'm trying to do is probably beyond the reach of AutoHotkey, but I'm going to work it out if I can. My goal here is to make a config window for shortcuts and their attributes. (For my command-line doodad) I'm pretty sure I can work out all the nitty-gritty in the background (I hope :)), but how to present it is what I'm working on right now. The current method I'm trying is a listbox, as that seems clean and organized, and it makes it much easier to see and compare many different shortcuts all at once. But reading the documentation, I can't find any way to show different types of information in one listbox. Is there any way to have different "fields" in a listbox? I.e., having both columns and rows instead of just rows?

#2 Chris

Chris
  • Administrators
  • 10727 posts

Posted 09 December 2004 - 05:25 PM

Is there any way to have different "fields" in a listbox? I.e., having both columns and rows instead of just rows?

You could add tabstops to the control via 0x80, which is LBS_USETABSTOPS:

gui, add, ListBox, 0x80 vMyListBox, Item1|Item2|Item3

If you have a need for custom tabstops, I can add that quickly since it's basically the same thing as tabstops in edit controls, which were just added to v1.0.24.

#3 beardboy

beardboy
  • Members
  • 443 posts

Posted 09 December 2004 - 06:47 PM

gui, add, ListBox, vMyListBox, Item1|Item2|Item3
gui, add, ListBox, 0x80 vMyListBox2, Item1|Item2|Item3
gui, show
Chris I'm not sure I notice the differences between these two listboxes.

Jonny are you looking for something like this?
Posted Image
I would be interested in being able to do something like this. For now I have just added whitespace between text to make my own columns. If something like the above can be added the ability to center/left/right justify the text in the columns would be nice. The headers might not be an option, but can be just a text control or buttons above the listbox.

thanks,
beardboy

#4 jonny

jonny
  • Members
  • 2951 posts

Posted 09 December 2004 - 07:50 PM

Yes, beardboy's screenshot looks almost exactly like what I want. I.E., the first column is the shortcut's name, the second column is the target, third is working dir, and so on.

#5 Chris

Chris
  • Administrators
  • 10727 posts

Posted 09 December 2004 - 11:04 PM

Chris I'm not sure I notice the differences between these two listboxes.

The difference is that tabs inside each item work like real tabs. The example I gave didn't properly show that. It should have been:
Gui, add, ListBox, 0x80 vMyListBox2, Row1Col1`tR1C2|Item2|Item3

You can also use literal tab characters in the script in place of `t.

If custom tabstops were added, you could do this:
Gui, add, ListBox, 0x80 vMyListBox2 t32 t80 t150, ...

Yes, beardboy's screenshot looks almost exactly like what I want.

I think that's a SysListView32, which is on the to-do list.

#6 Atomhrt

Atomhrt
  • Members
  • 124 posts

Posted 10 December 2004 - 12:11 AM

Yes, beardboy's screenshot looks almost exactly like what I want.

I think that's a SysListView32, which is on the to-do list.


It looks like a grid component that I've used with Borland's CBuilder.

#7 Payam

Payam
  • Members
  • 62 posts

Posted 13 December 2004 - 11:56 AM

I second the request on SysListView32 :)

by the way, when I update the listbox using GuiControl,
instead of a tab I get a square box (I use `t). However, this is not the case when I run your example (Gui, add, ListBox, 0x80 vMyListBox2, Row1Col1`tR1C2|Item2|Item3) which defines the listbox contents when creating the control :)
Is this is a bug or is there something I need to do different?
Thanks

Chris I'm not sure I notice the differences between these two listboxes.

The difference is that tabs inside each item work like real tabs. The example I gave didn't properly show that. It should have been:
Gui, add, ListBox, 0x80 vMyListBox2, Row1Col1`tR1C2|Item2|Item3

You can also use literal tab characters in the script in place of `t.

If custom tabstops were added, you could do this:
Gui, add, ListBox, 0x80 vMyListBox2 t32 t80 t150, ...

Yes, beardboy's screenshot looks almost exactly like what I want.

I think that's a SysListView32, which is on the to-do list.



#8 Chris

Chris
  • Administrators
  • 10727 posts

Posted 13 December 2004 - 01:20 PM

I second the request on SysListView32 :)

Thanks.

by the way, when I update the listbox using GuiControl,
instead of a tab I get a square box (I use `t). However, this is not the case when I run your example (Gui, add, ListBox, 0x80 vMyListBox2, Row1Col1`tR1C2|Item2|Item3) which defines the listbox contents when creating the control :)

You need the 0x80 in the control's options when it is created, otherwise tabs are never expanded into true tab characters when more items are added to its list later.

Edit: In the latest version, ListBoxes can be given custom tabstops. I guess it could even be used as a poor man's SysListView32.

#9 Kiber

Kiber
  • Members
  • 16 posts

Posted 19 December 2006 - 04:32 PM

hello all.
Anybody know - can we deal columns in listbox in last versions?

#10 PhiLho

PhiLho
  • Fellows
  • 6850 posts

Posted 19 December 2006 - 04:53 PM

You are reviving a 2 year old topic... Searching SysListView32 in the forum instead of ListBox (or after reading this topic) would have shown that the former is available in AutoHotkey now...

#11 Kiber

Kiber
  • Members
  • 16 posts

Posted 19 December 2006 - 06:54 PM

SysListView32 - afaik is msdn command control, but i still dont understand how i can create something like in post #3 by means of AHK.
Please, if you have some examples, show theirs here.

#12 SKAN

SKAN
  • Administrators
  • 9062 posts

Posted 19 December 2006 - 07:03 PM

Taken from AHK Help file:

; Create the ListView with two columns, Name and Size:
Gui, Add, ListView, r20 w700 gMyListView, Name|Size (KB)

; Gather a list of file names from a folder and put them into the ListView:
Loop, %A_MyDocuments%\*.*
    LV_Add("", A_LoopFileName, A_LoopFileSizeKB)

LV_ModifyCol()  ; Auto-size each column to fit its contents.
LV_ModifyCol(2, "Integer")  ; For sorting purposes, indicate that column 2 is an integer.

; Display the window and return. The script will be notified whenever the user double clicks a row.
Gui, Show
return

MyListView:
if A_GuiEvent = DoubleClick
{
    LV_GetText(RowText, A_EventInfo)  ; Get the text from the row's first field.
    ToolTip You double-clicked row number %A_EventInfo%. Text: "%RowText%"
}
return

GuiClose:  ; Indicate that the script should exit automatically when the window is closed.
ExitApp

:)

#13 Kiber

Kiber
  • Members
  • 16 posts

Posted 19 December 2006 - 07:37 PM

very usefull, thanks alot)) (rtfm power^^)