Register forum user name Search FAQ

MUSHclient scripting

Description of MUSHclient world function: world.WindowRectOp


Name WindowRectOp
Type Method
Summary Draws a rectangle in a miniwindow
Prototype long WindowRectOp(BSTR WindowName, short Action, long Left, long Top, long Right, long Bottom, long Colour1, long Colour2);
Description

This draws a rectangle in various styles, controlled by the Action parameter.

Note that changes to miniwindows will not become visible until the output window is redrawn. This happens when new (visible) lines arrive from the MUD, or if you call WindowShow, or Redraw.

Parameters:

WindowName - the name of an existing miniwindow.

Action - what sort of rectangle to draw, as follows:

1 = Frame by a single pixel wide line in Colour1
2 = Fill the entire rectangle by Colour1
3 = InvertRect - the colour on the miniwindow inside that rectangle is inverted
4 = Draw a "3D-style" rectangle in two colours, a single pixel wide (Colour1 is top and left edge colour, Colour2 is bottom and right edge colour)
5 = Draw Edge (draws a 3d-style edge with optional fill)
6 = Flood Fill Border (fills to border specified by Colour1) - the filling commences at the pixel designated by Left, Top and continues until it runs out of pixels that colour. The fill colour is specified by Colour2.
7 = Flood Fill Surface (fills while on surface specified by Colour1) - the filling commences at the pixel designated by Left, Top and continues until it is on pixels that colour. The fill colour is specified by Colour2.

Left, Top, Right, Bottom - describes the rectangle to be drawn.

Colour1 - the colour to draw the rectangle in (or fill it). For Action 5, this must be one of:

5 : Raised
6 : Etched
9 : Bump
10 : Sunken

Colour2 - the colour used by Action 4 for the bottom and right edge. Also it is the colour used for flood filling (Actions 6 and 7). For Action 5, this is:

0x03 (3) top left
0x06 (6) top right
0x09 (9) bottom left
0x0c (12) bottom right
0x0f (15) rect

Diagonal lines:

0x13 (19) diagonal - end top left
0x16 (22) diagonal - end top right
0x19 (25) diagonal - end bottom left
0x1c (28) diagonal - end bottom right

For Action 5 you can also add in the following values to modify the behaviour of the drawn rectangle:

0x0800 - Fill in the middle
0x1000 - For softer buttons
0x4000 - For flat rather than 3D borders
0x8000 - For monochrome borders


For more information, see:

http://www.gammon.com.au/mushclient/mw_shapes.htm


Note: Available in version 4.34 onwards.


Lua example
WindowRectOp (win, 1, 20, 20, 70, 70, ColourNameToRGB("blue"))  -- outline

WindowRectOp (win, 2, 50, 20, 80, 80, ColourNameToRGB("green"))  -- filled

WindowRectOp (win, 3, 5, 5, 90, 90, 0)   -- invert 

WindowRectOp (win, 4, 50, 30, 70, 70, ColourNameToRGB("springgreen"), ColourNameToRGB("green"))

WindowRectOp (win, 5, 30, 30, 70, 70, 5, 15)  -- raised, not filled

WindowRectOp (win, 5, 30, 30, 70, 70, 5, 15 + 0x800)  -- raised, filled

WindowRectOp (win, 5, 30, 30, 70, 70, 5, 15 + 0x800 + 0x1000)  -- raised, filled, softer

WindowRectOp (win, 5, 30, 30, 70, 70, 5, 15 + 0x800 + 0x1000 + 0x4000)  -- raised, filled, softer, flat

WindowRectOp (win, 5, 30, 30, 70, 70, 6, 15 + 0x800)  -- etched, filled
Lua notes
You can use the following constants for the action:

miniwin.rect_frame = 1
miniwin.rect_fill = 2
miniwin.rect_invert = 3
miniwin.rect_3d_rect = 4
miniwin.rect_draw_edge = 5
miniwin.rect_flood_fill_border = 6
miniwin.rect_flood_fill_surface = 7

You can use the following constants for the Colour1 parameter (argument 7) for action 5 (rect_draw_edge):

miniwin.rect_edge_raised = 5
miniwin.rect_edge_etched = 6
miniwin.rect_edge_bump = 9
miniwin.rect_edge_sunken = 10

You can use the following constants for the Colour2 parameter (argument 8) for action 5 (rect_draw_edge):

miniwin.rect_edge_at_top_left = 3
miniwin.rect_edge_at_top_right = 6
miniwin.rect_edge_at_bottom_left = 9
miniwin.rect_edge_at_bottom_right = 12
miniwin.rect_edge_at_all = 15
miniwin.rect_diagonal_end_top_left = 19
miniwin.rect_diagonal_end_top_right = 22
miniwin.rect_diagonal_end_bottom_left = 25
miniwin.rect_diagonal_end_bottom_right = 28

You can add in these additional constants to the Colour2 parameter (argument 8) for action 5 (rect_draw_edge):

miniwin.rect_option_fill_middle = 2048
miniwin.rect_option_softer_buttons = 4096
miniwin.rect_option_flat_borders = 16384
miniwin.rect_option_monochrom_borders = 32768
Returns eNoSuchWindow - no such miniwindow

eUnknownOption - Action not in list above

eBadParameter - edge parameter invalid

eOK - completed OK
Introduced in version 4.34

See also ...

Function Description
WindowArc Draws an arc in a miniwindow
WindowBezier Draws a Bézier curve in a miniwindow
WindowCircleOp Draws ellipses, filled rectangles, round rectangles, chords, pies in a miniwindow
WindowCreate Creates a miniwindow
WindowDrawImage Draws an image into a miniwindow
WindowLine Draws a line in a miniwindow
WindowPolygon Draws a polygon in a miniwindow

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.


Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes


Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes


View all functions

[Back]

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.