mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 07:16:49 +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
|
Arnold Bosch
|
||||||
Bart Broersma
|
Bart Broersma
|
||||||
Benito van der Zander
|
Benito van der Zander
|
||||||
|
Bent Normann Olsen
|
||||||
Bob Wingard
|
Bob Wingard
|
||||||
Boguslaw Brandys
|
Boguslaw Brandys
|
||||||
Boris Arko
|
Boris Arko
|
||||||
|
@ -379,7 +379,6 @@ begin
|
|||||||
{$IFDEF VerboseCommonEvent}
|
{$IFDEF VerboseCommonEvent}
|
||||||
DebugLn('CarbonCommon_GetNextFocusCandidate: ', DbgSName(AWidget.LCLObject));
|
DebugLn('CarbonCommon_GetNextFocusCandidate: ', DbgSName(AWidget.LCLObject));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
//Result := CallNextEventHandler(ANextHandler, AEvent);
|
|
||||||
|
|
||||||
StartControl := nil;
|
StartControl := nil;
|
||||||
if OSError(GetEventParameter(AEvent, kEventParamStartControl, typeControlRef,
|
if OSError(GetEventParameter(AEvent, kEventParamStartControl, typeControlRef,
|
||||||
@ -392,10 +391,15 @@ begin
|
|||||||
|
|
||||||
NextControl := AWidget.GetNextFocus(GetCarbonWidget(StartControl), FocusPart = kControlFocusNextPart);
|
NextControl := AWidget.GetNextFocus(GetCarbonWidget(StartControl), FocusPart = kControlFocusNextPart);
|
||||||
|
|
||||||
OSError(SetEventParameter(AEvent, kEventParamNextControl, typeControlRef,
|
if NextControl = nil then
|
||||||
SizeOf(ControlRef), @NextControl), SName, SSetEvent, 'kEventParamNextControl');
|
Result := CallNextEventHandler(ANextHandler, AEvent)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
OSError(SetEventParameter(AEvent, kEventParamNextControl, typeControlRef,
|
||||||
|
SizeOf(ControlRef), @NextControl), SName, SSetEvent, 'kEventParamNextControl');
|
||||||
|
|
||||||
Result := noErr;
|
Result := noErr;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -38,7 +38,7 @@ uses
|
|||||||
// widgetset
|
// widgetset
|
||||||
WSControls, WSLCLClasses, WSProc,
|
WSControls, WSLCLClasses, WSProc,
|
||||||
// LCL Carbon
|
// LCL Carbon
|
||||||
CarbonDef, CarbonPrivate;
|
CarbonDef, CarbonPrivate, CarbonEdits, CarbonListViews;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -67,6 +67,8 @@ type
|
|||||||
public
|
public
|
||||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
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 AddControl(const AControl: TControl); override;
|
||||||
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
||||||
class function GetClientBounds(const AWincontrol: TWinControl; var ARect: TRect): Boolean; override;
|
class function GetClientBounds(const AWincontrol: TWinControl; var ARect: TRect): Boolean; override;
|
||||||
@ -312,6 +314,28 @@ begin
|
|||||||
Result := TLCLIntfHandle(nil);
|
Result := TLCLIntfHandle(nil);
|
||||||
end;
|
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
|
Method: TCarbonWSWinControl.AddControl
|
||||||
Params: AControl - LCL control to add
|
Params: AControl - LCL control to add
|
||||||
|
Loading…
Reference in New Issue
Block a user