Back to Blog
Xojo focus set control6/12/2023 ![]() ![]() NSBezierPathFill( NSBezierPathBezierPathWithRoundedRectxRadiusyRadius( NSBezierPathClass, _ You must use the OS drawing functions for this to work. For Iconographer Mini, I use the following code to draw a rounded rect. In the "drawFocusRingMask" method of the delegate, this is where you "draw" the focus ring.XojoCanvasDelegates.registerDelegateForCanvas( me, makeIconWell ) As my delegate is the window, in window open I use. In the open event of the canvas subclass or window, register the canvas with the delegate.For Iconographer I choose to use the window. This can be either a Canvas subclass or a window. You need to make something conform to the XojoCanvasDelegates.XojoCanvasDelegate proocol (interface in Xojo terms).In the open event of your application and before any windows are shown, initilize the XojoCanvasDelegates module.Which is where the XojoCanvasDelegates class of the Ohanaware App Kit comes in. It turns out that Apple already has a way of handling this, it is just not exposed to Xojo developers. Or simply figuring out how to do it properly. However the ring would Inside of the control, not on the outside, so it means redesigning the control to simulate the ring being outside. This could be done by watching the focus state of the control, grabbing the highlight color from the OS and drawing it myself. This one is a bit tricky, as this custom control has rounded corners (to fit in with the Big Sur style) I wanted to make it show a rounded focus ring too. ![]() NSImageWithSymbolNameAndFallBack( ".square.dashed", _ NSSegmentedControlSetImageForSegment( me.handle, _ For this example, I'm applying it to a Segmented Control in the open event of the control. Once you have the NSImage, you can use the various functions in the Ohanaware App Kit to apply it to your controls.With App Wrapper 4, you can rasterize SF Symbols and include them in the resources for older OS versions. The first function is part of the Ohanaware App Kit 1.2, it will fall back to using an icon from the system or your resources if running on macOS 10.15 or lower. NSImageWithSymbolName( NSImageClass,, ).NSImageWithSymbolNameAndFallBack(, , ).Now to get the SF Symbol as an image, to which we can use on controls, there's two ways.Use the SFSymbols application to find the symbol you want to use, once you've found it, command-shift-c to copy the name (not the symbol).NSToolbarSetDisplayMode( Toolie ) = NSToolbarDisplayModeValue.iconOnly SF Symbols in the controls Hiding the button labels is done by using the following code, place it under where you add the controls to the toolbar. Run your project and the controls should now appear in the toolbar/titlebar.In the open event of the toolbar add code to inject your control into the toolbar item.ĭim toolie as integer = NSWindowToolbar( me.handle ).When designing your Toolbar make sure the locations where you want to use controls are regular "PushButton" style toolbar items.Native Xojo doesn't support placing controls in the toolbar, but the App Kit has you covered there. Run the project and enjoy the BS style.See the App Wrapper help on how to integrate with Xojo. If you don't already have the scripting set-up, now's a good time to do that.Save the settings and save the document.Enable "Executable minimum macOS & SDK", then set the "SDK" to "11.0.0".Select "Advanced Options" from the "Edit" menu.Open the App Wrapper document for your application.Make sure you have a Toolbar configured on the window.If you don't have an active license plan for App Wrapper, you can always take advanatge of the 14-Day trial by downloading it from /appwrapper/aw4.html These steps are only required for Intel apps. Now that Xojo 2020r2 is out Xojo's ARM Mac apps do NOT need to be modified to enable the full Big Sur GUI features. AW4 can modify the application, telling the macOS that this application is compatible with BS. Getting the unified titlebar with Xojo 2020r1.2 isn't possible, until I added functionality to App Wrapper. In order to be able to continue this series, I needed to get App Wrapper 4 much closer to release and I wanted to make a little sample application to demo some of cool functionality that you can get. Preparing your Xojo made Mac App for macOS Big Sur Part 4 - OAK & App Wrapper combined Wednesday, NovemSam RowlandsĬontinuing on the preparing your Xojo made Mac app for macOS Big Sur, this article covers using Ohanaware App Kit & App Wrapper 4 to get that GUI goodness. Preparing your Xojo made Mac App for macOS Big Sur Wednesday, November 25, 2020 ![]()
0 Comments
Read More
Leave a Reply. |