mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 02:55:55 +02:00
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:
parent
2e17592d31
commit
ec55ecd863
@ -17,6 +17,7 @@ Antonio Galvao
|
||||
Arnold Bosch
|
||||
Bart Broersma
|
||||
Benito van der Zander
|
||||
Bent Normann Olsen
|
||||
Bob Wingard
|
||||
Boguslaw Brandys
|
||||
Boris Arko
|
||||
|
@ -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;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user