Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make NSToolbar wrapper compile on XE7 #2

Open
GoogleCodeExporter opened this issue Mar 17, 2015 · 0 comments
Open

Make NSToolbar wrapper compile on XE7 #2

GoogleCodeExporter opened this issue Mar 17, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Hi Chris,

Make CCR.CocoaToolbar.pas compile on XE7 with the following change:

function NSWindowOfForm(Form: TCommonCustomForm): NSWindow;
{$if CompilerVersion > 26.0}
var
  Obj: TOCLocal;
{$ifend}
begin
  {$if CompilerVersion > 26.0}
  Result:= TMacWindowHandle(Form.Handle).Wnd;
  {$else}
  Obj := (FmxHandleToObjC(Form.Handle) as TOCLocal);
  Result := NSWindow(TOCLocalAccess(Obj).Super);
  {$ifend}
end;

I don't know when TMacWindowHandle was introduced so $CompilerVersion may be 
wrong. But after this change the demo works fine on XE7.

In the demo the Enabled property of toolbar item has to be initialized, 
otherwise there are sometimes disabled. So in Main.pas add handler for all 
items:

  Item := FHelper.AddItem('FileOpen');
  Item.OnUpdate :=
    procedure (Sender: TNSToolbarHelperItem; var EnableItem: Boolean)
    begin
      EnableItem:= True; // add this
    end;

Best regards
Dirk Carstensen

Original issue reported on code.google.com by dirk.car...@gmail.com on 16 Jan 2015 at 1:25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant