Carbon intf: fixed getting window part

git-svn-id: trunk@13103 -
This commit is contained in:
tombo 2007-12-01 15:06:29 +00:00
parent 11588a8f97
commit 7a6627d167
3 changed files with 27 additions and 3 deletions

View File

@ -156,9 +156,9 @@ const
SName = 'CarbonCommon_Track';
SControlAction = 'kEventParamControlAction';
begin
//{$IFDEF VerboseMouse}
{$IFDEF VerboseMouse}
DebugLn('CarbonCommon_Track ', DbgSName(AWidget.LCLObject));
//{$ENDIF}
{$ENDIF}
if OSError(
GetEventParameter(AEvent, kEventParamControlAction, typeControlActionUPP,
nil, SizeOf(ActionUPP), nil, @OldActionUPP), SName, SGetEvent,

View File

@ -256,10 +256,11 @@ begin
Result := EventNotHandledErr;
// check window part code
Part := inContent;
if not OSError(
GetEventParameter(AEvent, kEventParamWindowPartCode, typeWindowPartCode, nil,
SizeOf(WindowPartCode), nil, @Part),
SName, SGetEvent, 'kEventParamWindowPartCode') then
SName, SGetEvent, 'kEventParamWindowPartCode', eventParameterNotFoundErr) then
begin
if Part <> inContent then Exit;
end;

View File

@ -46,6 +46,8 @@ function OSError(AResult: OSStatus; const AClass: TClass; const AMethodName, ACa
const AText: String = ''): Boolean;
function OSError(AResult: OSStatus; const AObject: TObject; const AMethodName, ACallName: String;
const AText: String; AValidResult: OSStatus): Boolean;
function OSError(AResult: OSStatus; const AMethodName, ACallName: String;
const AText: String; AValidResult: OSStatus): Boolean;
var
DefaultTextStyle: ATSUStyle; // default Carbon text style
@ -211,6 +213,27 @@ begin
end;
end;
{------------------------------------------------------------------------------
Name: OSError
Params: AResult - Result of Carbon function call
AMethodName - Parent method name
ACallName - The Carbon function name
AText - Another text useful for debugging (param value, ...)
AValidResult - Another result code that is valid like noErr
Returns: If an error was the result of calling the specified Carbon function
------------------------------------------------------------------------------}
function OSError(AResult: OSStatus; const AMethodName, ACallName: String;
const AText: String; AValidResult: OSStatus): Boolean;
begin
if (AResult = noErr) or (AResult = AValidResult) then Result := False
else
begin
Result := True;
DebugLn(AMethodName + ' Error: ' + ACallName +
' ' + AText + ' failed with result ' + DbgS(AResult));
end;
end;
{------------------------------------------------------------------------------
Name: VirtualKeyCodeToMac
Returns: The Mac virtual key (MK_) code for the specified virtual