User32Addition

Adds extended image and color handling features to Xojo controls. Currently PushButton, RadioButton, PopupMenu, Window, MenuItem and SegmentedControl.

Module

Windows only! Some features are available for macOS too in AppKitAddition.

Overview

Methods

Overview

BringToFront

IdealHeight

IdealWidth

Image

Images

MakeComposited

MakeLayered

MakeTransparent

SizeToFit

Template

Documentation

Methods

BringToFront (expands w As Window) [mac + win]

Brings the window to the front of the z oder.

IdealHeight(expands p As PushButton) As Integer

Returns the ideal height of a pushbutton, or -1 if it cannot be calculated.

IdealWidth(expands p As PushButton) As Integer

Returns the ideal width of a pushbutton, or -1 if it cannot be calculated.

Image(extends s As PushButton / RadioButton, scaling As NSImageScaling = NSImageScaling.None, position As NSCellImageposition = NSCellImageposition.imageleft, assigns pic As Picture) [mac + win]

Sets the image that appears on the button when it’s in an off state, or nil if there is no such image.

This currently crashes the project under Windows silently when an image or template is assigned second time to a button – because of getting its handle, not because of the declare.

Scaling and Position are ignored on Windows.

Images(extends parent As Menuitem, s As Menuitem, assigns pics() As Picture) [mac + win]

Sets the offstate and onstate images for a menuitem. Example: If you have a menuitem mi with a child miChild and want to set off- and onstateimage for miChild: mi.Images(miChild) = Array(onStateImage, offStateImage)

MakeComposited(extends w as Window / RectControl)

Makes the window or control a composited (buffered) window to avoid flicker in a non-transparent environment.

You should make a window either compositied or layered, not both.

MakeLayered(extends w as Window / RectControl, Redraw As Boolean = True)

Makes a window a layered window, redrawing it optionally. Use Layered Windows to avoid flicker in situations where transparencies are rendered.

MakeTransparent(extends w As RectControl / Window, TransparencyColor as Color = &cffffffff, Alpha As Byte = 0)

Makes a rectcontrol or a window transparent by turning every appearance of transparencyColor into transparency with an alpha value between 0 (fully) and 255 (opaque). Sets the window to PopupStyle to allow a fully transparent window without title bar. Makes the Window or control layered too.

Works for windows on macOS too. Use Alpha for controls under macOS.

SizeToFit(extends p as Pushbutton / RadioButton)

Resizes a button to the optimum space to show all content if possible.

Template(extends s As PushButton, scaling As NSImageScaling = NSImageScaling.ProportionallyUpOrDown, position As NSCellImageposition = NSCellImageposition.imageleft, assigns pic As Picture) [mac + win]

Identical to Image, only that here the template representation of the image is being used.

This currently crashes the project under Windows silently when an image or template is assigned second time to a button – because of getting its handle, not because of the declare.