BRL.System: Functions Modinfo Source  

System

The system module's primary function is to provide synchronization with the operating system.

This achieved through the PollSystem and WaitSystem commands. However, you don't usually have to call these commands yourself as other BlitzMax commands will call them when necessary.

In addition, the system module also provides commands for checking the date and time, for moving the mouse pointer and for generating simple system requesters.

Functions

Function Confirm( text$,serious=False )
ReturnsTrue or False depending on the user's selection.
DescriptionRequest user confirmation.
InformationConfirm activates a simple user interface element requesting the user to select between YES and NO options. If the user selects YES, then Confirm returns True. Otherwise, False is returned.

Note that a user interface may not be available when in graphics mode on some platforms.
Example
' confirm.bmx

result=Confirm("Are you sure?")

print result

Function CurrentDate$()
ReturnsThe current date as a string.
DescriptionGet current date.
InformationReturns the current date in the format: DD MON YYYY (i.e. 10 DEC 2000).
Example
' currentdate.bmx

Print "The date is "+CurrentDate$()

Function CurrentTime$()
ReturnsThe current time as a string.
DescriptionGet current time.
InformationReturns the current time in the format: HH:MM:SS (i.e. 14:31:57).
Example
' currenttime.bmx

Print "The time is "+CurrentTime$()

Function HideMouse()
DescriptionMake the mouse pointer invisible.

Function MoveMouse( x,y )
DescriptionMove mouse pointer.
InformationMoveMouse positions the mouse cursor at a specific location within the current window or graphics display.

Function Notify( text$,serious=False )
DescriptionNotify user.
InformationNotify activates a simple user interface element informing the user of an event. The optional serious flag can be used to indicate a 'critical' event.

Note that a user interface may not be available when in graphics mode on some platforms.
Example
' notify.bmx

Notify "Hello World"

Function OpenURL( url$ )
DescriptionOpens a URL with the system's default web browser.
InformationNote that a user interface may not be available when in graphics mode on some platforms.

Function PollSystem()
DescriptionPoll operating system.
InformationPollSystem returns control back to the operating system, allowing such events as keystrokes and gadget actions to be processed. Control is then returned back to your program.

If PollSystem encounters a key, mouse or app suspend/resume/terminate event, and equivalent BlitzMax Event will be generated which may be examined using the SYSTEMEVENTHOOK hook.

Function Proceed( text$,serious=False )
Returns1, 0 or -1 depending on the user's selection.
DescriptionRequest user confirmation or cancellation.
InformationProceed activates a simple user interface element requesting the user to select between YES, NO and CANCEL options. If the user selects YES, then Proceed return 1. If the user selects NO, then Proceed returns 0. Otherwise, Proceed returns -1.

Note that a user interface may not be available when in graphics mode on some platforms.
Example
' proceed.bmx

result=Proceed("Are you sure you want to continue?")

print result

Function RequestDir$( text$,initial_path$="" )
ReturnsThe path of the selected folder or an empty string if the operation was cancelled.
DescriptionDisplay system folder requester.
Informationtext is used as the title of the file requester.
initial_path is the initial path for the folder requester.

Note that a user interface may not be available when in graphics mode on some platforms.
Example
' requestdir.bmx

path$=RequestDir("Select a Folder",CurrentDir())

Print "directory selected was "+path

Function RequestFile$( text$,extensions$="",save_flag=False,initial_path$="" )
ReturnsThe path of the selected file or an empty string if the operation was cancelled.
DescriptionDisplay system file requester.
Informationtext is used as the title of the file requester.
The optional extensions string can either be a comma separated list of file extensions or as in the following example groups of extensions that begin with a "group:" and separated by a semicolon. save_flag can be True to create a save-style requester, or False to create a load-style requester.
initial_path is the initial path for the file requester.

Note that a user interface may not be available when in graphics mode on some platforms.
Example
' requestfile.bmx

filter$="Image Files:png,jpg,bmp;Text Files:txt;All Files:*"
filename$=RequestFile( "Select graphic file to open",filter$ )

Print filename

Function ShowMouse()
DescriptionMake the mouse pointer visible.

Function WaitSystem()
DescriptionWait for operating system.
InformationWaitSystem returns control back to the operating system, waiting until an event such as a keystroke or gadget action occurs.

Note that WaitSystem may wait indefinitely if there is no possibility of any events occuring, so use with caution.

If WaitSystem encounters a key, mouse or app suspend/resume/terminate event, and equivalent BlitzMax Event will be generated which may be examined using the SYSTEMEVENTHOOK hook.

Module Information

Version1.17
AuthorMark Sibly, Simon Armstrong
LicenseBlitz Shared Source Code
CopyrightBlitz Research Ltd
ModserverBRL
History1.17 Release
HistoryOpenURL now attempts to fully qualify file / http url supplied
History1.16 Release
HistoryFixed MacOS RequestFile to respect wild card filter
History1.15 Release
HistoryFixed mouse hidden by default
History1.14 Release
HistoryFixed HideMouse causing mouse to disappear when in non-client areas
History1.13 Release
HistoryFixed Linux MoveMouse to be relative to the origin of the current Graphics window
History1.12 Release
HistoryAdded Linux X11 import to remove glgraphics.mod dependency
HistoryFixed linux middle button crash
History1.11 Release
HistoryFixed win32 clipboard glitches with QS_ALLINPUT bbSystemWait mod
History1.11 Release
HistoryCGSetLocalEventsSuppressionInterval fix for MacOS bbSystemMoveMouse
History1.10 Release
HistoryRipped out input stuff and added hook
History1.09 Release
HistoryTweaked MacOS GetChar()
History1.07 Release
HistoryAdded AppTitle support for requesters
History1.06 Release
HistoryFixed MacOS RequestDir ignoring initial path
History1.05 Release
HistoryAdded RequestDir support for MacOS
History1.04 Release
HistoryAdded mouse capture to Win32
HistoryFixed C Compiler warnings