Re: ListBox : Alignment of Columns & DataPosted by creeek on December 14, 2004 at 11:30:25: In Reply to: ListBox : Alignment of Columns & Data posted by Lionel P12219 on December 13, 2004 at 19:05:02: I was going to cut/ paste direct from my code, but here is a tip that I found at swissdelphicenter.ch procedure TForm1.Button1Click(Sender: TObject);
const
MAX_TABS = 4; // The maximum number of Tabs
Tab = #9; // ASCII code for TAB
var
Tabulators: array[0..MAX_TABS] of Integer;
begin
// Set the Tabulator Widths
Tabulators[0] := 70;
Tabulators[1] := 120;
Tabulators[2] := 100;
Tabulators[3] := 80;
Listbox1.TabWidth := 1;
// Set the Tabulators
SendMessage(ListBox1.Handle, LB_SETTABSTOPS, MAX_TABS, Longint(@Tabulators));
// Add some items
Listbox1.Items.Add('Peter' + Tab + Smith' + Tab + '1234-56' + Tab + 'London');
Listbox1.Items.Add('Johan' + Tab + 'Jones' + Tab + '123-45' + Tab + 'York');
end;
it works great!! (I would never have guessed!!) Related Articles and Replies
|