Button

From TrillWiki

Jump to: navigation, search

Contents

[edit] Basic Button Control

<control name="<name of control>" type="button">
<background name="<state>">
<source name="<bitmap name>" left="0" right="0" top="0" bottom="0"/>
<rect>
<left num="0" width="0"/>
<right num="0" width="1"/>
<top num="0" height="0"/>
<bottom num="0" height="1"/>
</rect>
</background>
<action name="<action type>" value="<value>"/>
</control>

The source name is the name you gave the bitmap, like the background code, you then put the pixel refs for the source in

Rect is usually left as is shown

state is the state of the button:

State Description
flat Normal state
over Mouse is over the button
push When the button is being clicked on
disabled If the button is not available it will use this state. Used for Pending events when there are no events or toolbar options which aren't availble for a specific medium


[edit] Actions

The action type is something that is performed when clicked, alongside with the action that is specified in its sourcing icontrol.

Action Type Value Action
playSound name of the sound Plays a sound.
setPhase [phase name] Sets the window phase to the one with the specified name.
toggleDrawer name of drawer Opens or closes a drawer.
toggleMaximize yes/no Toggles a window into a maximized or restored state.
close yes/no Closes the window.

The following actions were created / revamped for the introduction of panels in Trillian 3.0

Action Type Value Action
setPhase [phase name] For panels this has a slightly different meaning than one would expect. It sets the panel phase, not the window phase.
setWindowPhase [phase name] Set the window phase from inside of a panel
setVisible 0/1 Set the panel visible
close yes (not implemented yet)
toggleMaximize yes Maximize the panel

[edit] Tooltips

Another option you can set, is the text for a tooltip, for when you hover over your button. These are added in the following format:

<tooltip text="text goes here" />


[edit] Resizable Buttons

resizeable-buttons (note the mispelling of 'resizeable') follow the same basic principles, except that the button can vary in sizes, using basic <background> and <color> code, as you would a component. Also, they usually contain an <icontrol> named "text", which points to a topic control, so that Trillian can set the button label. The "type" for a resizeable button is "resizeable-button".

Remember that the <background> tags have an attribute: type="<state>", which defines the graphics for the flat|over|push states, as with normal buttons.

You can set the disabled forecolour of the topic control by using the line

<color name="disabled-fore" red="" green="" blue=""/>

Using the standard <color> tags for areas of colour in the middle, you can set a different color for each state. In the opening <color> tag, include name="" as below:

<color name="flat" red="" green="" blue="">
<rect>
<left num="0" width="0"/>
<right num="0" width="1"/>
<top num="0" height="0"/>
<bottom num="0" height="1"/>
</rect>
</color>

Where the names can be flat / over / push.


[edit] Irregularly Shaped Buttons

You can create non-rectangular buttons using the mainregion code. By doing so, a button will not be clicked unless the cursor clicks it within the specified region.

[edit] Menu-direction Setting (3.0)

Trillian 3.0 includes a new setting for buttons called menu-direction. This setting allows you to choose which direction a menu pops-up from the button.

<settings name="menu-direction" value="up|down"/>

[edit] Double Click (2.0+)

  • Compatibility: Trillian 2.x+

Buttons also have an extra <settings> tag that can be used:

<settings name="doubleClick" value="yes"/>

This means that the action activates on a double click, rather than a single click. It is commonly used at the window title area to roll up or maximize a window.

If a double-click button overlaps a single-click button that opens a menu, a bug occurs where user will need to triple-click to trigger the double-click action.

[edit] Text Transparency Setting (Legacy)

  • Compatibility: Trillian 1.x
<settings name="transparent" value="yes" />

Function: The values are yes / no, and it is believed to make the background of the text transparent. But since text are all updated to be transparent since then, this feature is now unnecessary.


[edit] Cursors (Legacy)

Some skins have the following line:

<cursor name="main" type="<type>"/>

the cursor <type> can be: minimize, close, maximize, arrow, add and others which i dont know, it is irrelevent, as it doesn't do anything, and never will - it was there as a planned addition that never got added.

Personal tools