Difference between revisions of "CreateGridMenu"
From King Arthur's Gold Wiki
Shadlington (Talk | contribs) (Created page with "<onlyinclude> Creates a CGridMenu with the given position on-screen, a reference to the owner blob, the grid dimensions and a caption. Returns a reference to the created [[CG...") |
Shadlington (Talk | contribs) |
||
Line 3: | Line 3: | ||
Returns a reference to the created [[CGridMenu]]. | Returns a reference to the created [[CGridMenu]]. | ||
</onlyinclude> | </onlyinclude> | ||
+ | |||
You'll normally want to get use the current position of the mouse as the position, so something like 'getControls().getMouseScreenPos()' will often do for position argument. | You'll normally want to get use the current position of the mouse as the position, so something like 'getControls().getMouseScreenPos()' will often do for position argument. | ||
The ownerBlob is the blob that the grid relates to and that commands are sent back to. Usually this will be the same blob you're writing the grid for, so you'll just use a 'this' reference. | The ownerBlob is the blob that the grid relates to and that commands are sent back to. Usually this will be the same blob you're writing the grid for, so you'll just use a 'this' reference. |
Revision as of 15:03, 17 August 2012
Creates a CGridMenu with the given position on-screen, a reference to the owner blob, the grid dimensions and a caption. Returns a reference to the created CGridMenu.
You'll normally want to get use the current position of the mouse as the position, so something like 'getControls().getMouseScreenPos()' will often do for position argument.
The ownerBlob is the blob that the grid relates to and that commands are sent back to. Usually this will be the same blob you're writing the grid for, so you'll just use a 'this' reference.
CGridMenu@ CreateGridMenu( position2di pos2d, CBlob@ ownerBlob, dimension2di slots, const string &caption
Example from Entities/Workshops/Scripts/WorkshopEmpty.as:
CControls@ controls = caller.getControls(); CGridMenu@ menu = CreateGridMenu( controls.getMouseScreenPos(), this, dimension2di(4,3), "Convert to..." );