![]() Admittedly, I’m not quite sure how this explains iTunes’ behaviour, but hey, Apple can do what it likes with its own stuff I guess… Setting a form’s minimum sizeĭoing the converse of setContentMaxSize and setMaxSize are setContentMinSize and setMinSize. This allows you to achieve one of the key components of a Proper Mac App: driving Windows users insane by having the maximise button not actually maximise the window! More seriously, the Mac principle is for maximising a window to maximise to the document, not to the screen. Setting the maximum size of a window on OS X actually does two things – aside from preventing the user from resizing the form beyond a certain point, it also determines how big the form gets when the green traffic light (‘maximise button’ in Windows terms) is clicked. SetFormMaxClientSize(Self, + Image1.Width, NSWindowOfForm(AForm).setContentMaxSize(MaxClientSize) MaxClientSize.height := AMaxClientHeight ![]() ![]() Procedure SetFormMaxClientSize(AForm: TCommonCustomForm ĪMaxClientWidth, AMaxClientHeight: Single) Normally you would want to use setContentMaxSize: To prevent the user from making the form any bigger than a certain size, call either setContentMaxSize or setMaxSize the former determines the maximum size of the client area, and the latter the maximum frame size. Result := NSWindow(TOCLocalAccess(Obj).Super) Obj := (FmxHandleToObjC(Form.Handle) as TOCLocal) Macapi.ObjectiveC, Macapi.CocoaTypes, Macapi.Foundation, Macapi.AppKit,įunction NSWindowOfForm(Form: TCommonCustomForm): NSWindow I think this a mistake, but regardless, the NSWindow case is fortunately an exception to the general rule. As a point of principle, FMX is almost the complete opposite of the VCL when it comes to exposing native API hooks. The first problem is how to convert a TForm reference to a NSWindow one in the first place (in Delphi, NSWindow is an interface type declared in Macapi.AppKit). Nonetheless, NSWindow methods can be called easily enough via XE2’s Delphi to Objective-C bridge. ![]() While FMX exposes some functionality of the underlying Objective-C class (NSWindow), there’s still quite a bit it doesn’t. ![]() When targeting OS X, a FireMonkey form is a native Cocoa window, albeit with a custom-drawn and custom-managed client area. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |