Skip to content
PRGfx edited this page Nov 13, 2014 · 2 revisions

This library contains tools for the sake of DOM-access in the manialink.

Requirements
These functions use the TextLib with exact this name.

File mQ.Script.txt

Functions

Text mQ_Typeof(CMlControl c)
Returns CMlQuad, CMlLabel, etc. matching the given CMlControl.

CMlFrame mQ_Parent(CMlControl control)
Returns the parent frame of the given CMlControl.

Boolean mQ_IsChildOf(CMlControl control, CMlFrame parent[, Boolean recursive=True])
Returns whether the given control is child of the CMlFrame parent. If recursive is set to False, control has to be a direct child of the given parent.

CMlControl[] mQ(Text selector[, CMlFrame root=Page.MainFrame])
Returns all elements matching the given selector below the given root element. See the description on selectors below for more information about them.

CMlControl[] mQAdd(CMlControl control, CMlControl[] elements)
Expands a given CMlControl array elements by control.
CMlControl[] mQAdd(CMlControl[] controls, CMlControl[] elements)
Expands a given CMlControl array elements by the elements in controls.
CMlControl[] mQAdd(Text selector[, CMlFrame root=Page.MainFrame], CMlControl[] elements)
Expands a given CMlControl array elements by the elements matching the given selector.

CMlControl[] mQNot(Text selector[, CMlFrame root=Page.MainFrame], CMlControl[] elements)
Removes all controls in elements that match the given selector.

CMlControl[] mQFilter(Text selector, CMlControl[] elements) Returns only the controls form elements that match the selector. This selector supports :first, :last, :odd, :even, [visible], [hidden], :eq(n), :lt(n), :gt(n).
For more information about these read the jQuery reference.

Attribute-Functions

You can use mQ_Hide(Void), mQ_Show(Void), mQ_PosnX(Real), mQ_PosnY(Real), mQ_PosnZ(Real), mQ_RelativePosition(Vec3), mQ_Scale(Real), mQ_Size(Vec2), mQ_SetText(Text) on sets of elements like below. They return the given set of elements so you can concatenate them:

mQ_PosnX(5., PosnZ(12., mQ(".myelements")));

Other

Boolean mQ_IsOver(CMlControl[] controls), Boolean mQ_IsOver(CMlControl control)
Returns whether the cursor is currently above the given elements. This can be used if you want to prevent a loss of focus, if the cursor focuses a button within a container. You may check on MouseOut events if the cursor is still above the element it just left.

Selectors

A selector can contain multiple elements, seperated by a ,. Each part will be treated equally. For the means of caching, the selectors get normalized which means ids > classnames > tagnames are sorted alphabetically.
A selector part may be of these three parts:

  • #ControlId
    Parts led by a # will be interpreted as ControlIds.
  • .ClassName
    Parts led by a . will be interpreted as class names.
  • TagName Elements with leading letters will be interpreted as tag name. These are lowecase and will be label, quad, frame, ....
You can’t perform that action at this time.