Hi,
Can anyone please suggest me approach how to use LB_SETTABSTOPS message to set the tab-stop positions in a ListViewGadget in your application?
Thanks.
ListViewGadget and LB_SETTABSTOPS
First off, Welcome to PB zpenava 
This is my first attempt at using LB_SETTABSTOPS, so this is just a first look. Optimizing the code is up to you.
Tested and working on WinXPhome with PB 3.91.

This is my first attempt at using LB_SETTABSTOPS, so this is just a first look. Optimizing the code is up to you.

Tested and working on WinXPhome with PB 3.91.
Code: Select all
; --> array for 2 tabstops
Dim tStop(1)
If OpenWindow(0, 0, 0, 370, 180, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "ListViewGadget and TabStops") And CreateGadgetList(WindowID(0))
; --> We add the #LBS_USETABSTOPS flag to our ListViewGadget
ListViewGadget(0, 10, 10, 350, 120, #LBS_USETABSTOPS)
ButtonGadget(1, 10, 150, 100, 20, "Use Tabstops")
AddGadgetItem (0,-1,"Mr. John Q. Public" + Chr(9) + "12345 His Street" + Chr(9) + "New York") ; define listview content
AddGadgetItem (0,-1,"Mr. & Mrs. John Q. Public" + Chr(9) + "9876 Any Road" + Chr(9) + "Paris") ; define listview content
AddGadgetItem (0,-1,"John & Mary Public" + Chr(9) + "258 Their St." + Chr(9) + "Sydney") ; define listview content
; --> Set our tabstops
; --> 1st tabstop is length of longest line in column 1 times 4
tStop(0) = 25*4
; --> 2nd tabstop is (length of longest line in column 2 times 4) added To tStop(0)
tStop(1) = tStop(0)+(16*4)
Repeat
event = WaitWindowEvent()
Select event
Case #PB_EventGadget
Select EventGadgetID()
Case 1
; --> use tabstops
If GetGadgetText(1) = "Use Tabstops"
SendMessage_(GadgetID(0), #LB_SETTABSTOPS, 2, @tStop(0))
InvalidateRect_(GadgetID(0), 0, 1)
SetGadgetText(1, "No Tabstops")
; --> don't use tabstops
Else
SendMessage_(GadgetID(0), #LB_SETTABSTOPS, 0, 0)
InvalidateRect_(GadgetID(0), 0, 1)
SetGadgetText(1, "Use Tabstops")
EndIf
EndSelect
EndSelect
Until event = #PB_Event_CloseWindow
EndIf
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
Thanks Sparkie for this information. I was struggling with the layout of ListViewGadget myself and your example did it.
I wonder why something like this isn't mentioned in the Helpfile of PB. Even the option to add flags is not mentioned. Your example made me look in the Win32 helpfile to discover the possibilities.

I wonder why something like this isn't mentioned in the Helpfile of PB. Even the option to add flags is not mentioned. Your example made me look in the Win32 helpfile to discover the possibilities.