LCL carbon: fixed bug #0010054: Carbon switching focus between non edit like controls goes wrong with help from Bent Normann Olsen

git-svn-id: trunk@17157 -
This commit is contained in:
tombo 2008-10-30 12:53:17 +00:00
parent 2e17592d31
commit ec55ecd863
3 changed files with 34 additions and 5 deletions

View File

@ -17,6 +17,7 @@ Antonio Galvao
Arnold Bosch
Bart Broersma
Benito van der Zander
Bent Normann Olsen
Bob Wingard
Boguslaw Brandys
Boris Arko

View File

@ -379,7 +379,6 @@ begin
{$IFDEF VerboseCommonEvent}
DebugLn('CarbonCommon_GetNextFocusCandidate: ', DbgSName(AWidget.LCLObject));
{$ENDIF}
//Result := CallNextEventHandler(ANextHandler, AEvent);
StartControl := nil;
if OSError(GetEventParameter(AEvent, kEventParamStartControl, typeControlRef,
@ -392,10 +391,15 @@ begin
NextControl := AWidget.GetNextFocus(GetCarbonWidget(StartControl), FocusPart = kControlFocusNextPart);
OSError(SetEventParameter(AEvent, kEventParamNextControl, typeControlRef,
SizeOf(ControlRef), @NextControl), SName, SSetEvent, 'kEventParamNextControl');
if NextControl = nil then
Result := CallNextEventHandler(ANextHandler, AEvent)
else
begin
OSError(SetEventParameter(AEvent, kEventParamNextControl, typeControlRef,
SizeOf(ControlRef), @NextControl), SName, SSetEvent, 'kEventParamNextControl');
Result := noErr;
Result := noErr;
end;
end;
{------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ uses
// widgetset
WSControls, WSLCLClasses, WSProc,
// LCL Carbon
CarbonDef, CarbonPrivate;
CarbonDef, CarbonPrivate, CarbonEdits, CarbonListViews;
type
@ -67,6 +67,8 @@ type
public
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
class function CanFocus(const AWincontrol: TWinControl): Boolean; override;
class procedure AddControl(const AControl: TControl); override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
class function GetClientBounds(const AWincontrol: TWinControl; var ARect: TRect): Boolean; override;
@ -312,6 +314,28 @@ begin
Result := TLCLIntfHandle(nil);
end;
class function TCarbonWSWinControl.CanFocus(const AWincontrol: TWinControl): Boolean;
var
Bit: CFIndex;
Valid: Boolean;
begin
Result := inherited;
if not CheckHandle(AWincontrol, Self, 'CanFocus') then Exit;
Bit := CFPreferencesGetAppIntegerValue(CFSTR('AppleKeyboardUIMode'),
kCFPreferencesCurrentApplication, Valid);
DebugLn(DbgS(Bit));
if Valid then
begin
if (Bit <> 0) then
Result := True
else
Result := (TCarbonWidget(AWincontrol.Handle) is TCarbonControlWithEdit) or
(TCarbonWidget(AWincontrol.Handle) is TCarbonDataBrowser);
end;
end;
{------------------------------------------------------------------------------
Method: TCarbonWSWinControl.AddControl
Params: AControl - LCL control to add