I am using following code to add a native NSTextField into a Delphi FMX form in OSX. The textfield has been added and works very well, except the system default focus ring effection (the blue border outside the textfield when user select it) is missing.
(tested with XE8, and OSX10.9, 10.10).
I guess this is caused by how Delphi/FMX implemented the TForm under OSX, because this system focus ring effects seems draw outside the control self. The Delphi form may have some special settings to “prevent” system drawing this effects on it by mistake, and I tried all the related settings of NSTextField without success.
uses MacApi.AppKit;
procedure TForm1.AddNSTextField;
var
tf: NSTextField;
vw: NSView;
r: NSRect;
begin
vw := (WindowHandleToPlatform(Form1.Handle)).View;
if Assigned(vw) then
begin
r.origin.x := 10;
r.origin.y := 30;
r.size.width := 300;
r.size.height := 22;
tf := TNSTextField.Wrap(TNSTextField.Wrap(TNSTextField.OCClass.alloc).initWithFrame(r));
vi.addSubview(tf);
//tf.setFocusRingType(0); //Also tried to manually set but no use.
tf.setStringValue(NSStr(‘Untitled’));
end;
end;
Anyone could help? Thanks.