mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-23 20:50:40 +02:00
cocoa: restoring editting functionality
git-svn-id: trunk@58676 -
This commit is contained in:
parent
b21be64d42
commit
f8eb20ee4a
@ -49,6 +49,7 @@ type
|
|||||||
|
|
||||||
function ItemsCount: Integer;
|
function ItemsCount: Integer;
|
||||||
function GetItemTextAt(ARow, ACol: Integer; var Text: String): Boolean;
|
function GetItemTextAt(ARow, ACol: Integer; var Text: String): Boolean;
|
||||||
|
procedure SetItemTextAt(ARow, ACol: Integer; const Text: String);
|
||||||
procedure tableSelectionChange(ARow: Integer);
|
procedure tableSelectionChange(ARow: Integer);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -822,11 +823,11 @@ begin
|
|||||||
if ReadOnly then Exit;
|
if ReadOnly then Exit;
|
||||||
|
|
||||||
lColumnIndex := getIndexOfColumn(tableColumn);
|
lColumnIndex := getIndexOfColumn(tableColumn);
|
||||||
{
|
if Assigned(callback) then
|
||||||
setListViewStringValue_forCol_row(lNewValue, lColumnIndex, row);
|
begin
|
||||||
//setStringValue_forCol_row(lNewValue, lColumnIndex, row);
|
callback.SetItemTextAt(row, lColumnIndex, lNewValue.UTF8String);
|
||||||
}
|
reloadDataForRow_column(lColumnIndex, row);
|
||||||
reloadDataForRow_column(lColumnIndex, row);
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCocoaTableListView.tableView_shouldEditTableColumn_row(tableView: NSTableView; tableColumn: NSTableColumn; row: NSInteger): Boolean;
|
function TCocoaTableListView.tableView_shouldEditTableColumn_row(tableView: NSTableView; tableColumn: NSTableColumn; row: NSInteger): Boolean;
|
||||||
|
@ -226,10 +226,14 @@ type
|
|||||||
public
|
public
|
||||||
listView: TCustomListView;
|
listView: TCustomListView;
|
||||||
tempItemsCountDelta : Integer;
|
tempItemsCountDelta : Integer;
|
||||||
|
|
||||||
|
isSetTextFromWS: Integer; // allows to suppress the notifation about text change
|
||||||
|
// when initiated by Cocoa itself.
|
||||||
procedure delayedSelectionDidChange_OnTimer(ASender: TObject);
|
procedure delayedSelectionDidChange_OnTimer(ASender: TObject);
|
||||||
|
|
||||||
function ItemsCount: Integer;
|
function ItemsCount: Integer;
|
||||||
function GetItemTextAt(ARow, ACol: Integer; var Text: String): Boolean;
|
function GetItemTextAt(ARow, ACol: Integer; var Text: String): Boolean;
|
||||||
|
procedure SetItemTextAt(ARow, ACol: Integer; const Text: String);
|
||||||
procedure tableSelectionChange(NewSel: Integer);
|
procedure tableSelectionChange(NewSel: Integer);
|
||||||
end;
|
end;
|
||||||
TLCLListViewCallBackClass = class of TLCLListViewCallback;
|
TLCLListViewCallBackClass = class of TLCLListViewCallback;
|
||||||
@ -1263,6 +1267,8 @@ end; *)
|
|||||||
|
|
||||||
{ TLCLListViewCallback }
|
{ TLCLListViewCallback }
|
||||||
|
|
||||||
|
type
|
||||||
|
TProtCustomListView = class(TCustomListView);
|
||||||
|
|
||||||
procedure TLCLListViewCallback.delayedSelectionDidChange_OnTimer(
|
procedure TLCLListViewCallback.delayedSelectionDidChange_OnTimer(
|
||||||
ASender: TObject);
|
ASender: TObject);
|
||||||
@ -1292,6 +1298,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLCLListViewCallback.SetItemTextAt(ARow, ACol: Integer;
|
||||||
|
const Text: String);
|
||||||
|
begin
|
||||||
|
// there's no notifcaiton to be sent to the TCustomListView;
|
||||||
|
if (ACol<>0) then Exit;
|
||||||
|
|
||||||
|
inc(isSetTextFromWS);
|
||||||
|
try
|
||||||
|
if (ACol=0) then
|
||||||
|
if (ARow>=0) and (ARow<listView.Items.Count) then
|
||||||
|
TProtCustomListView(listView).DoEndEdit(listView.Items[ARow], Text);
|
||||||
|
finally
|
||||||
|
dec(isSetTextFromWS);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLCLListViewCallback.tableSelectionChange(NewSel: Integer);
|
procedure TLCLListViewCallback.tableSelectionChange(NewSel: Integer);
|
||||||
var
|
var
|
||||||
Msg: TLMNotify;
|
Msg: TLMNotify;
|
||||||
|
Loading…
Reference in New Issue
Block a user