Jump to content
  • entries
    74
  • comments
    426
  • views
    1446519

UIObject


Rob McGinnis

3114 views

UIObject is the 'base' GUI object. You can't actually define it in XML, but it contains attributes that are common to many different UI Objects, so I'm starting here.

 

The following are the attributes that will be loaded for every UI Object in the XML file except for the attributes.

 

Some attributes will be ignored or overridden depending on the situation. Note that attributes are case sensitive.

 

name

String value for the name of the UI Object. This is used internally and will be necessary for scripting to interact with this object in the future.

 

scalewithscene

If this is set to true, then this UI Object will have its dimensions scaled to match its parent's dimensions if the parent object gets resized. Handy for things like background images.

 

usescaler

This tells the code to try and use some logic when this object gets resized in determining where its new X,Y origin should be. For example, if there is a lot of space to the right of the object, it will assume this object was left-anchored and keep the object to the left side with its new position. It's kind of a confusing attribute, all I can say is try it out and see if it does what you want, and don't use it if it doesn't. :)

 

width

The width of the UI Object. Many things override this, for example if the object will be a box in a grid, the grid will control the width, or if the box is in a list box, the list box may override it, depending on the list box attributes, etc. This attribute can take pixel count arguments, or the following strings:

SCREEN_WIDTH - This object's width will be full screen no matter what the resolution is.

PARENT_WIDTH - This object's width will be the full width of its parent object, no matter what the size of the parent object is.

 

height

Same as the width attribute, except substitute height for width in all cases. Note that if no height or width attributes are set, the object will take on the height and width of its parent object.

 

x

The x origin of the object with respect to its parent UI object. This can take a pixel count, or the following strings as arguments:

ALIGN_CENTER - Center this Object to the screen

ALIGN_PARENT - Center this object within its parent UI Object.

ALIGN_LEFT - Keep this object oriented to the left of its parent (x = 0).

ALIGN_RIGHT - Push this object against the right side of the parent object.

 

y

The y origin of the object with respect to its parent UI object. This can take a pixel count, or the following strings as arguments:

ALIGN_CENTER - Center this object to the screen

ALIGN_PARENT - Center this object within its parent UI Object.

ALIGN_TOP - Keep this object at the top of its parent object (y=0)

ALIGN_BOTTOM - Push this object against the bottom of the parent object.

 

focusable

In general, this means that the object can't be clicked on. For example, if it is an object in a UIGrid, it means that object in the grid can't be clicked on. This will keep the object of being the target of an actiontarget as well (When the mouse cursor changes to indicate the user can click somewhere to perform an action). Default value is true.

 

ignoreevents

This is somewhat identical to setting focusable=false, but it also means that the UI Object will ignore objects being dragged on it, among some other UI events besides just mouse clicking. It defaults to false.

 

handleactiontarget

Setting this to true means that action targets can be used on this GUI object. Action targets actions that need to be targeted on something, indicated by the mouse cursor changing appearance. For example, clicking on a spell button, then having the cursor change to indicate you need to click on what target you want the spell cast. If this attribute is true, then the GUI object will be treated as a valid target for actions to be performed on. It defaults to false.

 

draggable

This indicates that the UI Object can be dragged and dropped, such as hotbar buttons. Defaults to false.

 

OnMouseDropReceived

This is the UI Callback to execute when a draggable UI object gets dropped on this UI object. This is not executed by the object being dropped, but rather the object that got something dropped ON it.

 

OnMouseDrop

This callback is executed on a UI Object when it gets dragged and then dropped. Upon being dropped, this callback will be executed.

 

OnMouseDropFailed

This callback is executed if a UI Object is dragged and then dropped but not dropped over another UI Object.

 

OnMouseEnter

This callback is executed when the mouse cursor is moved over this object.

OnMouseLeave

This callback is executed when the mouse cursor is moved off of the object after having been moved onto it.

 

OnResize

This callback is executed any time the UI Object gets resized for any reason.

 

OnTooltip

This callback gets executed if the mouse hovers over this object long enough based on the user's preference for the tooltip delay.

 

OnRadialRequest

This is the callback that gets executed if the user brings up the context sensitive menu on this UI object.

 

DefaultTooltip

This is a default tooltip STRREF that is used in case a custom tooltip callback is not really necessary.

 

hidden

Whether or not this object is visible. Defaults to true..

 

disabled

Whether or not this object is enabled. Applies mostly to buttons, but for the most part, no UI Object that is disabled will accept user input. Defaults to false.

 

capturemouseclicks

If set to false, then mouse clicks should pass right through this object. Useful for semi-transparent overlays and other situations where it is expected that the user be able to click through the UI Object. This also applies to MouseEnter and MouseLeave. If an object is set to not capture mouse clicks, then objects underneath of it cannot be moused over.

 

OnGainedFocus

This callback is executed when an object gains focus. This applies mostly to buttons that got clicked on or editable text fields that got clicked in.

 

OnLostFocus

This callback is executed when an object loses focus. This applies mostly to buttons that had been previously clicked on or editable text fields that had been previously clicked in.

 

update

This determines if this UI object receives calls to an OnUpdate callback. Defaults to false. If set to true, then this UIObject will have its OnUpdate callback called on every frame, or slower if an updaterate is defined.

 

OnUpdate

The callback to be executed when this object receives its update.

 

UpdateRate

This attribute can be used to tune the update rate of a UI Object. If a particular object doesn't need to be updated every frame, then set an update rate here to slow it down. The number value is in seconds and floating points are okay (0.5 for half second, for example).

 

hotbartype

This is an advanced attribute that is used for determining how the hotbar should treat another UI Object being dragged onto it. The currently valid values for this attribute are:

HOTBAR_NONE - The hotbar should ignore this.

HOTBAR_ITEM - This is an item icon being dragged, such as from inventory.

HOTBAR_KNOWNSPELL - This item being dragged is something from the spellbook.

HOTBAR_SPELL - This item is a spell from somewhere else, such as another hotbar slot.

HOTBAR_FEAT - This item is a feat from somewhere, such as the feat listing or another hotbar slot.

HOTBAR_BUTTON - This is an empty hotbar button.

HOTBAR_SKILL - This is an activateable skill, such as from the skills pane or another hotbar slot.

HOTBAR_TOGGLEMODE_BUTTON - This is a button used to toggle some kind of mode.

HOTBAR_BARTER - This is used to flag barter grid items as not being able to be dragged to the hotbar.

HOTBAR_DM_COMMAND - The item being dragged is a DM Client command.

HOTBAR_VM_COMMAND - The item being dragged is an emote command.

HOTBAR_DM_CREATOR - The item being dragged is an entry from the DM Client Creator.

 

Scale*ToParent

This was a set of attributes that was going to allow more control over how an object behaved when its parent got scaled. But in looking at the code, it looks like they've been gutted and no longer do anything.

 

MouseOverSFX

The sound effect to play when this UI Object gets moused over.

 

alpha

How transparent this object should be by default.

 

dontrendermousegrab

'Mouse Grab' means item being currently dragged. Normally the mouse grab is rendered last of all in order to keep it on top. There are situations where this behavior wasn't desired, though I can't remember what. When set to true, it means that this object needs to not get rendered last like normal dragged objects, but rather is rendered when it would normally be.

 

SetDataInt

This stores an 'int' value in the UI Object's data element at int index 0. More on data elements another time.

 

SetDataFloat

This stores a 'float' value in the UI Object's data element at float index 0. More on data elements another time.

 

SetDataString

This stores a 'string' value in the UI Object's data element at string index 0. More on data elements another time.

0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...