[Solved] How to obtain Listview column index ? lazarus / 8-Other ---------------------------------------------------------------------- Batuhan · 2009-07-26 16:13 Hello! Anybody knows how to obtain "new/updated" listview column index after some re-ordering events (with fulldrag property set to True) ? sendmessage(...) + LVM_GETCOLUMNORDERARRAY doesn't work too or i'm doing something wrong... I'm using WinXP ---------------------------------------------------------------------- Batuhan · 2009-07-28 15:25 HA HA !! SOLVED !!  1: add "LCLIntf" (without quotes) to "uses" section, 2: after "uses" add public const "LVM_GETCOLUMNORDERARRAY = 4155;", 3: and send message sample code: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var   lv_col_array : array of Integer; {array for listview1 columns indexes}   i : integer;   msg : string; begin {set array length}  SetLength(lv_col_array, ListView1.Columns.Count); {send message - get lv col indexes!} SendMessage(ListView1.Handle, LVM_GETCOLUMNORDERARRAY, ListView1.Columns.Count,Integer(lv_col_array)); {display lv columns indexes}  for i:=0 to High(lv_col_array) do   begin     msg :=msg+IntToStr(lv_col_array[i])+#13;   end;  ShowMessage(msg); end; This code works under Win XP! (95/98/2K not tested) ---------------------------------------------------------------------- Batuhan · 2009-07-28 15:27 full sample unit: Code: [Select]unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,   LCLIntf, ComCtrls, StdCtrls; const   LVM_GETCOLUMNORDERARRAY = 4155; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    ListView1: TListView;    procedure Button1Click(Sender: TObject);    procedure FormCreate(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; var   Form1: TForm1; implementation { TForm1 } procedure TForm1.Button1Click(Sender: TObject); var   lv_col_array : array of Integer;   i : integer;   msg : string; begin  SetLength(lv_col_array, ListView1.Columns.Count);  SendMessage(ListView1.Handle, LVM_GETCOLUMNORDERARRAY, ListView1.Columns.Count,Integer(lv_col_array));  for i:=0 to High(lv_col_array) do   begin     msg :=msg+IntToStr(lv_col_array[i])+#13;   end;  ShowMessage(msg); end; procedure TForm1.FormCreate(Sender: TObject); begin  ListView1.FullDrag:=True; end; initialization   {$I unit1.lrs} end.