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