cocoa: Implements spinedit.OnChange

git-svn-id: trunk@49588 -
This commit is contained in:
sekelsenmat 2015-08-03 06:17:42 +00:00
parent df9663860c
commit 29edd0c013
2 changed files with 16 additions and 5 deletions

View File

@ -62,6 +62,7 @@ type
procedure DidBecomeKeyNotification;
procedure DidResignKeyNotification;
procedure SendOnChange;
procedure SendOnTextChanged;
// non event methods
function DeliverMessage(Msg: Cardinal; WParam: WParam; LParam: LParam): LResult;
function GetPropStorage: TStringList;
@ -3640,6 +3641,8 @@ begin
lNSStr := CocoaUtils.NSStringUtf8(lStr);
Edit.setStringValue(lNSStr);
lNSStr.release;
// This implements OnChange for both user and code changes
if callback <> nil then callback.SendOnTextChanged();
end;
function TCocoaSpinEdit.acceptsFirstResponder: Boolean;
@ -3786,6 +3789,8 @@ begin
lNSStr := CocoaUtils.NSStringUtf8(lStr);
setStringValue(lNSStr);
lNSStr.release;
// This implements OnChange for both user and code changes
if callback <> nil then callback.SendOnTextChanged();
end;
function TCocoaSpinEdit.GetFieldEditor: TCocoaFieldEditor;

View File

@ -62,6 +62,7 @@ type
procedure DidBecomeKeyNotification; virtual;
procedure DidResignKeyNotification; virtual;
procedure SendOnChange; virtual;
procedure SendOnTextChanged; virtual; // text controls (like spin) respond to OnChange for this event, but not for SendOnChange
function DeliverMessage(var Msg): LRESULT; virtual; overload;
function DeliverMessage(Msg: Cardinal; WParam: WParam; LParam: LParam): LResult; virtual; overload;
@ -981,19 +982,24 @@ end;
procedure TLCLCommonCallback.DidBecomeKeyNotification;
begin
LCLSendActivateMsg(Target, WA_ACTIVE, false);
LCLSendSetFocusMsg(Target);
LCLSendActivateMsg(Target, WA_ACTIVE, false);
LCLSendSetFocusMsg(Target);
end;
procedure TLCLCommonCallback.DidResignKeyNotification;
begin
LCLSendActivateMsg(Target, WA_INACTIVE, false);
LCLSendKillFocusMsg(Target);
LCLSendActivateMsg(Target, WA_INACTIVE, false);
LCLSendKillFocusMsg(Target);
end;
procedure TLCLCommonCallback.SendOnChange;
begin
SendSimpleMessage(Target, LM_CHANGED);
SendSimpleMessage(Target, LM_CHANGED);
end;
procedure TLCLCommonCallback.SendOnTextChanged;
begin
SendSimpleMessage(Target, CM_TEXTCHANGED);
end;
function TLCLCommonCallback.DeliverMessage(var Msg): LRESULT;