[Home] [Downloads] [Search] [Help/forum]

SetWorldWindowStatus

Script function

world.SetWorldWindowStatus

Read about scripting

Type

Method

Summary

Sets the scroll bar position, and hides or shows it

Prototype

long SetScroll(long Position, BOOL Visible);

View list of data type meanings

Description

This lets you do two things:

* Hide the existing scroll bar if desired
* Set the "scroll position" in the output window

The first feature (hiding the scroll bar) lets you, well, hide it, so that you can draw your own wherever you want (eg. with a themed miniwindow somewhere near where the text appears).

The second feature lets your code scroll the text around (so you can still use the existing output buffer) in response to the player clicking and dragging on "your" thumb, or arrows.

A position of -1 means "the end of the window" (which is the number of lines multiplied by the height of the font, minus the size of the output window).

A position of -2 means "no change".

You can use GetInfo (296) to find the current scroll-bar position (and thus add or subtract from it, to scroll up or down small amounts (like a line or a page).

You can use GetInfo (120) to find if the scroll-bar is currently hidden or not.

The existing code adds the font height (GetInfo (212)) to the current scroll position to scroll downwards a line, and subtracts it to scroll up a line.

To scroll up or down pages you need to find the size of the output window text rectangle, and add or subtract that.


Available in MUSHclient version 4.60 onwards.



Lua example

SetScroll (0, false)  -- hide scroll bar, go to top of window
SetScroll (-1, false) -- hide scroll bar, go to end of window

SetScroll (-2, false) -- hide scroll bar, do not change position
SetScroll (-2, true)  -- show scroll bar, do not change position


Lua notes

The Visible flag is optional and defaults to true.


Return value

eOK - success

View list of return code meanings

See Also ...

Function

(GetInfo) Gets information about the current world

(Help topic: function=SetWorldWindowStatus)

Documentation contents page


Search ...

Enter a search string to find matching documentation.

Search for:   

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]