Skip to content

[guide] Widget Docs

justus-hildebrand edited this page Apr 3, 2017 · 1 revision

Events

To use events as per the observer pattern, use triggerEvent:/ triggerEvent:with:/ triggerEvent:withArguments:. Don't emit these directly, but always place them in a dedicated triggerMyEvent:arg2: method. All of these methods, and only those, should be found in an events category of your class.

Example for a clicked event:

MyClass>>triggerClicked: anEvent
  self triggerEvent: #clicked with: anEvent

Label

Styling

A number of default styles exist on the label's class side. Run BTExamples text openInWorld to see a demo of all available defaults. If you need to do more complex styling, you can use the styleAttributes: dictionary, e.g.

BTLabel new styleAttributes: ({
  'size' -> 'smaller'.
  'weight' -> '700' } as: Dictionary)

If you need to only have a portion of the text to be stylized, you may use tags directly, e.g. 'This is <span style="italic">italic</span> text'.

All available attributes can be seen here: https://developer.gnome.org/pango/stable/PangoMarkupFormat.html

Clone this wiki locally