Added MultiSelect to TListView

Shane

git-svn-id: trunk@550 -
This commit is contained in:
lazarus 2001-12-19 21:36:05 +00:00
parent cd2e33e587
commit b2cd5c2501
4 changed files with 28 additions and 2 deletions

View File

@ -79,6 +79,7 @@ Begin
ViewStyle := vsReport;
Sorted := True;
OnKeyDown := @ListView1KeyDown;
MultiSelect := True;
end;
//ListView does not accpet keys unless the mouse is held down over it
//so temporarily I do this:

View File

@ -438,7 +438,6 @@ type
end;
TViewColumns = class(TPersistent)
private
FAlignment : TColumnAlignment;
FItems : TList;
FOnChange : TNotifyEvent;
Listview : TCustomListView;
@ -470,6 +469,8 @@ type
FViewStyle : TViewStyle;
FSorted : Boolean;
FSortColumn : Integer;
FMultiSelect: Boolean;
procedure SetMultiSElect(const AValue: Boolean);
procedure SetItems(Value : TListItems);
protected
ParentWindow : TScrolledWindow;
@ -490,6 +491,7 @@ type
property Items : TListItems read FListItems write SetItems;
property Sorted : Boolean read FSorted write SetSorted;
property SortColumn : Integer read FSortColumn write SetSortColumn;
property MultiSelect : Boolean read FMultiSelect write SetMultiSelect default False;
end;
TListView = class(TCustomListView)
@ -1011,6 +1013,10 @@ end.
{ =============================================================================
$Log$
Revision 1.10 2001/12/19 21:36:05 lazarus
Added MultiSelect to TListView
Shane
Revision 1.9 2001/12/19 20:28:51 lazarus
Enabled Alignment of columns in a TListView.
Shane

View File

@ -123,3 +123,13 @@ begin
Columns.Free;
inherited Destroy;
end;
procedure TCustomListView.SetMultiSelect(const AValue: Boolean);
begin
if FMultiSelect <> AValue then
Begin
FMultiSelect := AValue;
CNSendMessage(LM_SETPROPERTIES,self,nil);
end;
end;

View File

@ -381,7 +381,6 @@ var
MsgPtr : PMsg; // currently only used by LM_DESTROY
Count : Integer; //Used in TListView LM_LV_CHANGEITEM
Titles : Array [0..255] of PChar;
TempColor : TgdkColor;
begin
Result := 0; //default value just in case nothing sets it
@ -2997,6 +2996,7 @@ end;
function TgtkObject.SetProperties (Sender : TObject) : integer;
const
aGTKJustification: array[TColumnAlignment] of TGTKJustification = (GTK_JUSTIFY_LEFT,GTK_JUSTIFY_RIGHT,GTK_JUSTIFY_CENTER);
aGTkSelectionMode: Array[Boolean] of TGtkSelectionMode = (GTK_SELECTION_SINGLE,GTk_SELECTION_EXTENDED);
var
Handle : Pointer;
Widget : PGtkWidget;
@ -3132,12 +3132,17 @@ begin
gtk_clist_set_column_justification(PgtkCList(Handle),I,aGTKJUSTIFICATION[Columns.Item[i].Alignment]);
end;
//sorting
if (TCustomListView(sender).ViewStyle = vsReport) then
gtk_clist_column_titles_show(PgtkCList(Handle))
else
gtk_clist_column_titles_Hide(PgtkCList(Handle));
gtk_clist_set_sort_column(PgtkCList(Handle),TCustomListView(sender).SortColumn);
//multiselect
gtk_clist_set_selection_mode(PgtkCList(Handle),aGTkSelectionMode[TCustomListView(sender).MultiSelect]);
//TODO:This doesn't work right now
// gtk_clist_set_auto_sort(PgtkCList(handle),TCustomListView(sender).Sorted);
//
@ -3625,6 +3630,10 @@ end;
{ =============================================================================
$Log$
Revision 1.93 2001/12/19 21:36:05 lazarus
Added MultiSelect to TListView
Shane
Revision 1.92 2001/12/19 20:28:51 lazarus
Enabled Alignment of columns in a TListView.
Shane