sd_window Reference
Contents
- Library
- Updates
- Version 2
- sd_window datum
- sd_window vars
- sd_window procs
- New proc (sd_window)
- AddResource proc (sd_window)
- Close proc (sd_window)
- Closed proc (sd_window)
- Display proc (sd_window)
- NoViewers proc (sd_window)
- SendResources proc (sd_window)
- detect_navigator datum
- Client Extensions
- sd_windows var (client)
- sd_enhanced_windows var (client)
- sd_OS var (client)
- sd_browser_name var (client)
- sd_browser_version var (client)
- sd_browser_minor_version var (client)
sd_window provides special popup dialog windows with several controls that normal BYOND
browse() windows lack. sd_window lets you control the position of the window on screen and
triggers a proc when the window is closed.
The windows are controlled by the /sd_window datum. In its simplest form, you can display a
window with a single line of code just by creating the window with the content and target
arguments.
See the sd_window Guide for instructions on how to use the sd_window library.
First public release of sd_window.
The sd_window datum is the heart of the sd_window library. It tracks the specialized windows and handles
communications between the client and the server.
- x
- Horizontal position of the left side of window in pixels. Negative values center the window horizontally.
Values larger than (screen width - window width) butt the window against the right side of the screen.
This variable only works with enhanced windows.
DEFAULT: -1
- y
- Vertical position of the left side of window in pixels. Negative values center the window vertically.
Values larger than (screen height - window height) butt the window against the bottom of the screen.
This variable only works with enhanced windows.
DEFAULT: -1
- width
- The width of the window.
DEFAULT: 300
- height
- The height of the window.
DEFAULT: 300
- content
- The HTML content for the window to display.
- timer
- Optional close timer. If set, the window will automatically close timer ticks after it opens.
DEFAULT: 0 (do not close automatically)
- flags
- Display flags for the window. These may be combined with the bitwise or operator (|) for
multiple effects. Possible values include: Values in italics on apply to
enhanced windows.
- SDW_FOCUS
- If not set, window restores focus to Dream Seeker after the window is opened
- SDW_RESIZE
- If set, the window may be resized
- SDW_STATUS
- Display the status bar
- SDW_SCROLL
- Display scroll bars
- SDW_SUNKEN
- Show a sunken window edge
- SDW_HELP
- Display context sensitive help icon. Note: This feature has been removed
from Internet Explorer 7. It wasn't that great anyway. :p
Default value: SDW_RESIZE|SDW_SCROLL (allow resizing and scroll bars)
- resources
- Resource files that the window display depends on. Each resource will be sent to any client when they
view the window. If any resources are used, this will be an associated list:
- resources[filename] = BYOND_resource
.
Use the AddResource sd_window proc to add resources.
- viewers
- List of clients viewing this dialog.
- Format:
- New(content, target, timer, x, y, width, height, flags)
- Args:
- All arguments are optional.
content - initializes the sd_window's content var
target - If set, the window will automatically display to target. See the sd_window
Display proc for more information.
timer - initializes the sd_window's timer var
x - initializes the sd_window's x var
y - initializes the sd_window's y var
width - initializes the sd_window's width var
height - initializes the sd_window's height var
flags - initializes the sd_window's flags var
- Returns:
- A reference to the created window
Create an sd_window, initialize its vars, and optionally display it.
- Format:
- AddResource(resource, filename)
- Args:
-
resource - the BYOND resource
filename - the filename used to store the resource in the client's cache
Adds resource to the window resources list. Use this proc to add resources that should be sent to the
client before the window is displayed.
- Format:
- Close(target, report = 1, remove = 1)
- Args:
-
target - mob, client, or a list of mobs and or clients
report - if set, call the window's Closed proc. Default
value: 1 (call Closed proc)
remove - if set, remove target from the window's viewers list. Default value: 1 (remove target)
Closes the window for all clients in target.
- Format:
- Closed(target)
- Args:
- target - a mob, client, or list of mobs and/or clients that closed the window
- When:
- Called when the sd_window is closed.
This function is a prototype function. It provides a hook so that your code can react when the window is closed.
- Format:
- Display(target)
- Args:
- target - a mob, client, or list of mobs and/or clients to display the window to
Display the window to target.
This proc is called automatically from New() if target is specified.
This proc automatically calls the SendResources proc.
- Format:
- NoViewers()
- When:
- Called when there are no clients left in the
viewers list
This function is a prototype function. It provides a hook so that your code can react when no clients are viewing
this window.
By default, this deletes the window to free system resources.
- Format:
- SendResources(target)
- Args:
- target - a mob, client, or list of mobs and/or clients
Send content and all associated resources to target. This is called automatically by Display(). You only need to
call it if you want to send the resources in advance.
The detect_navigator datum opens an invisible browser window on a client's computer and reports back to the server
to populate the sd_OS,
sd_browser_name, sd_browser_version, and
sd_browser_minor_version client vars.
A detect_navigator automatically deletes itself when finished. (Usually within a couple of ticks of creation.)
To use a detect_navigator datum, just create a new one with a client as the argument of the new() call.
Example:
client
New()
..()
// detect navigator settings as soon as the client connects
new/sd_window/detect_navigator(src)
The sd_window library adds several vars to the client datum.
- sd_windows
- A list of all the sd_windows the client is viewing.
- sd_enhanced_windows
- If set, the client will attempt to use the the enhanced window features (position control and the
SDW_STATUS, SDW_SUNKEN, and SDW_HELP settings.) The control that makes these features happen has proven
unstable on some clients.
Default value: null
- sd_OS
- The platform the client uses, reported by from the client's browser through an
detect_navigator datum.
Default value: null
- sd_browser_name
- The name of the browser the client uses through Dream Seeker, reported by from the browser through an
detect_navigator datum.
Default value: null
- sd_browser_version
- The version of the browser the client uses through Dream Seeker, reported by from the browser through an
detect_navigator datum.
Default value: null
- sd_browser_minor_version
- The minor version of the browser the client uses through Dream Seeker, reported by from the browser
through an detect_navigator datum.
Default value:
null