Add code to allow TOpenDialog to do multiple line selects. MAH

git-svn-id: trunk@510 -
This commit is contained in:
lazarus 2001-12-12 08:29:21 +00:00
parent c1f7c4e0f7
commit 6566f466f4
2 changed files with 46 additions and 3 deletions

View File

@ -631,6 +631,10 @@ var
colorsel : GTK_COLOR_SELECTION;
newColor : TGdkColor;
FontName : String;
cListRow : PGList;
rowNum : gint;
fileInfo : PGChar;
fileList : PGTKCList;
begin
Result := True;
theDialog := TCommonDialog(data);
@ -638,7 +642,40 @@ begin
// gtk_grab_remove(PgtkWidget(TCommonDialog(data).Handle));
if theDialog is TFileDialog then
begin
TFileDialog(data).FileName := gtk_file_selection_get_filename(PGtkFileSelection(FPointer));
if theDialog is TOpenDialog then
begin
// check extra options
if ofAllowMultiSelect in TOpenDialog(theDialog).Options then
begin
TFileDialog(data).FileName := '';
TStringList(TFileDialog(theDialog).Files).Clear;
fileList := PGtkCList(PGtkFileSelection(FPointer)^.file_list);
rowNum := 0;
cListRow := fileList^.row_list;
while cListRow <> nil do
begin
if PGtkCListRow(cListRow^.data)^.state = GTK_STATE_SELECTED then
begin
if gtk_clist_get_cell_type(fileList, rowNum, 0) = GTK_CELL_TEXT then
begin
gtk_clist_get_text(fileList, rowNum, 0, @fileInfo);
TStringList(TFileDialog(theDialog).Files).Add(fileInfo);
end;
end;
// get next row from list
rowNum := rowNum + 1;
cListRow := g_list_next(cListRow);
end;
end
else
begin
TFileDialog(data).FileName := gtk_file_selection_get_filename(PGtkFileSelection(FPointer));
end;
end
else
begin
TFileDialog(data).FileName := gtk_file_selection_get_filename(PGtkFileSelection(FPointer));
end;
end
else if theDialog is TColorDialog then
begin
@ -1499,6 +1536,9 @@ end;
{ =============================================================================
$Log$
Revision 1.52 2001/12/12 08:29:21 lazarus
Add code to allow TOpenDialog to do multiple line selects. MAH
Revision 1.51 2001/12/07 20:12:15 lazarus
Added a watch dialog.
Shane

View File

@ -2091,8 +2091,8 @@ begin
if Sender is TOpenDialog then begin
// set extra options
if ofAllowMultiSelect in TOpenDialog(Sender).Options then begin
{gtk_clist_set_selection_mode(
PGtkCList(PGtkFileSelection(P)^.file_list),GTK_SELECTION_BROWSE);}
gtk_clist_set_selection_mode(
PGtkCList(PGtkFileSelection(P)^.file_list),GTK_SELECTION_MULTIPLE);
end;
end;
end;
@ -3479,6 +3479,9 @@ end;
{ =============================================================================
$Log$
Revision 1.85 2001/12/12 08:29:21 lazarus
Add code to allow TOpenDialog to do multiple line selects. MAH
Revision 1.84 2001/12/11 16:51:37 lazarus
Modified the Watches dialog
Shane