Jump to content

Recommended Posts

Posted

Yep :D LBS_MULTICOLUMN needs to be added to the documentation.

Global $LBS_MULTICOLUMN = 0x200;
Global $WS_VSCROLL = 0x00200000;
Global $WS_HSCROLL = 0x100000;

$listbox_style = $LBS_MULTICOLUMN + $WS_HSCROLL

GuiCreate("Multi-Col listbox")
$list_1 = GUISetControl("list", "List 1", 60, 80, 250, 90, $listbox_style )
GUISetControlData($list_1, "one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|13|14|15|16")

GuiShow()
GuiWaitClose()
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

Ahhh, I see what you've done there, but it wasn't exactly what I meant. was thinking where each selection in a combo or list box has two (or more) pieces of data for it.

Posted (edited)

:D

Could you use multiple listbox controls?

Or could you use data entries that have a lot of blank space padding between your "columns"?

Also--this might not help you--but it is possible to associate a number (I think the range is +/- a trillion or so) with each list box entry:

Global $LB_GETITEMDATA = 0x199;
Global $LB_SETITEMDATA = 0x19A
Opt("GUINotifyMode", 1)

GuiCreate("Listbox stuff")
$button_1 = GuiSetControl("button", "Selected Item Info", 0, 0, 100, 50)
$list_1 = GUISetControl("list", "List 1", 60, 80, 250, 90)
$data = "apple|banana|carrot|donut|egg"
GUISetControlData($list_1, $data)

GuiShow()
WinActivate("Listbox stuff")

_GuiLB_SetItemData($list_1, 0, 100)
_GuiLB_SetItemData($list_1, 1, 200)
_GuiLB_SetItemData($list_1, 2, 300)
_GuiLB_SetItemData($list_1, 3, 404)
_GuiLB_SetItemData($list_1, 4, 711)

While 1
   $msg = GuiMsg(0)
   sleep(50)
   If $msg = -3 Then Exit
   If $msg = $button_1 Then
      $currentSelection =GuiSendMsg($list_1, 0x188, 0, 0)
      $text = _GuiLB_GetItemData($list_1, $currentSelection)
      MsgBox(4096,"Info", $text)
   EndIf
WEnd
Exit

Func _GuiLB_SetItemData($ref, $index, $data)
   Return GuiSendMsg($ref, $LB_SETITEMDATA, $index, $data)
EndFunc
   
Func _GuiLB_GetItemData($ref, $index)
   Return GuiSendMsg($ref, $LB_GETITEMDATA, $index, 0)
EndFunc
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

I think I finally realized what you want:

Note: The default column width (tab) cannot be changed; so if you have really long entries, you might need to use multiple tabs between short entries.

; ListBox with tabbed-columns
Global $LBS_USETABSTOPS = 0x80;

GuiCreate("Multi-Col listbox")
$list_1 = GUISetControl("list", "List 1", 60, 80, 250, 90, $LBS_USETABSTOPS)

_GuiLB_AddString($list_1, StringReplace("Char,Decimal,Hex,Description", ",", @TAB))
_GuiLB_AddString($list_1, StringReplace("a,97,61,Lowercase A", ",", @TAB))
_GuiLB_AddString($list_1, StringReplace("b,98,62,Lowercase B", ",", @TAB))
_GuiLB_AddString($list_1, StringReplace("c,99,63,Lowercase C", ",", @TAB))
_GuiLB_AddString($list_1, StringReplace("d,100,64,Lowercase D", ",", @TAB))
_GuiLB_AddString($list_1, StringReplace("e,101,65,Lowercase E", ",", @TAB))

GuiShow()
GuiWaitClose()

Func _GuiLB_AddString($ref, $string)
  Return GuiSendMsg($ref, 0x0180, 0, $string)
EndFunc
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...