Reference Manual - Table of Contents
The commands and functions in this section are used to create and manipulate Macintosh windows. Visual MacStandardBasic automatically handles the operation of a window such as moving, resizing, and updating.
The terms Form and Window can be used interchangeably. A Form is just a Window that was created in the Visual Development Environment. You can use the Window command to create a Window (during runtime)without creating interactively in Visual MacStandardBasic's Visual Development Environment (design time).
When you see the parameter windowID in this manual you can give the FormName or the variable( var parameter) you used in the Window command.
Command Summary:
Form formName
Window var, left, top, width, height, title$, windowType, Sub
WinSize windowID, width, height
WinMove windowID, left, top
WinTitle windowID, title$
WinClose windowID
WinHide windowID
WinShow windowID
WinRedraw windowID
WinOrigin windowID, left, top
WinClip windowID, left, top, width, height
LoadPalette palette#, resourceID
WinPalette windowID, palette#
ClearWindow windowID
ClearControls windowID
ClearGraphics windowID
AlertBox resourceIDFunction Summary:
var = WinBorder ( windowID, dimension )
var = WinHandle ( windowID )
var = WinExist ( windowID )
var$ = WinTitle ( windowID )
var$ = FrontWindow ( )
var = WinNum ( windowID )
var = MsgBox( message$, buttontypes )
Form formName
This command load and displays, if the visible property is enabled, the specified form. A form is the term used for a window, possibly containing controls, that was created in the visual development environment of Visual MacStandardBasic.
formName - This should be the text that is the name of the form. (ie. Form1 )
Example: Form Form1
Window var, left, top, width, height, windowType, title$, Sub
This command creates a window with the location and size specified.
var - This should be a numeric variable that will contain a value the should be used to reference the window being created. This variable will equal a -1 if an error occurs.
left - This is a numeric expression designating the left x screen coordinate for this window.
top - This is a numeric expression designating the top y screen coordinate for this window.
width - This is a numeric expression designating the width for this window.
height - This is a numeric expression designating the height for this window.
windowType - This is a numeric expression designating the window type:
Window Types
0 = Standard Document Window [Title bar & Sizebox]
1 = Alert/Modal Box
2 = Plain Box
3 = Plain Box with shadow
4 = Document Window without Sizebox [Title bar]
8 = Standard Document Window with Zoombox [Title bar, Sizebox, & Zoombox]
12 = Standard Document Window with Zoombox without Sizebox [Title bar &
Zoombox]
16 thru 23 = Round Rectangle Windows with various curved corners.
1000 = Standard Document Window with Closebox [Title bar, Sizebox, &
Closebox]
1004 = Document Window without Sizebox with Closebox [Title bar & Closebox]
1008 = Standard Document Window with Zoombox & Closebox [Title bar,
Sizebox, Zoombox, & Closebox]
1012 = Standard Document Window with Zoombox & Closebox without Sizebox
[Title bar, Zoombox, & Closebox]
Add 2000 = Create window but do not make it visible yet
Add 4000 = Ignore left and top parameters and center window horizontally
and vertically on the screen.
Add 8000 = Do not set clip area inside GrowBox lines in window types 0
and 8
title$ - This is a string expression designating the the title that should appear at the top of this window.
Sub - This is a reference to the a SUB procedure that will be called the window receives an event. If there is no Sub procedure to be assigned use NONE.
Example: Dim WinNum Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None
WinSize windowID, width, height
This command resizes an existing window with a new width and height. Changes in width and height will only affect the right and bottom borders of the window.
windowID -This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
width - This is a numeric expression designating the new width for this window.
height - This is a numeric expression designating the new height for this window.
Examples: Dim WinNum Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None WinSize WinNum, 200, 100 'Set for 200 pixels wide & 100 high Form Form1 WinSize Form1, 200, 100
WinMove windowID, left, top
This command moves the window to a new location while maintaining its current width and height.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
left - This is a numeric expression designating the left x screen coordinate for this window.
top - This is a numeric expression designating the top y screen coordinate for this window.
Examples: Dim WinNum Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None WinMove WinNum, 200, 100 Form Form1 WinMove Form1, 200, 100
WinTitle windowID, title$
This command sets or changes the title of the specified window.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
title$ - This is a string expression designating the new title that should appear at the top of this window.
Examples: Dim WinNum, A$ A$ = "New Window Title" Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None WinTitle WinNum, "New Window Title" Form Form1 WinTitle Form1, A$
WinClose windowID
This command closes the specified window.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
Examples: Dim WinNum Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None WinClose WinNum Form Form1 WinClose Form1
WinHide windowID
This command hides the specified window from view.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
Examples: Dim WinNum Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None WinHide WinNum Form Form1 WinHide Form1
WinShow windowID
This command selects and shows the specified window.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
Examples: Dim WinNum Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None WinShow WinNum Form Form1 WinShow Form1
WinRedraw windowID
This command redraws the specified window.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
Examples: Dim WinNum Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None WinRedraw WinNum Form Form1 WinRedraw Form1
WinOrigin windowID, left, top
This command sets the content coordinates of an existing window. This allows for easy scrolling of the windows contents. This is normally set at 0,0.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
left - This is a numeric expression designating the left x screen coordinate for the top left corner of the window's content area.
top - This is a numeric expression designating the top y screen coordinate for the top left corner of the window's content area.
Examples: Dim WinNum Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None WinOrigin WinNum, -10, -10 Form Form1 WinOrigin Form1, -10, -10
WinClip windowID, left, top, width, height
This command sets the clip area of an existing window.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
left - This is a numeric expression designating the left x screen coordinate for the new clip area.
top - This is a numeric expression designating the top y screen coordinate for the new clip area.
width - This is a numeric expression designating the new width for the new clip area.
height - This is a numeric expression designating the new height ffor the new clip area.
Examples: Dim WinNum Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None ' Clip inside window content area by 10 pixels on all 4 sides WinClip WinNum, 10, 10, 390, 290 Form Form1 WinClip Form1, 10, 10, 390, 290
LoadPalette palette#, resourceID
This command loads one of the 10 palettes with a Color LookUp Table resource ('clut').
palette# - This should be a numeric expression that contains a value that is used to reference the one of the ten palettes (1-10).
WinPalette windowID, palette#
This command activates a pallete for a specified on the window.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
palette# - This should be a numeric expression that contains a value that is used to reference the one of the ten palettes (1-10).
ClearWindow windowID
This command removes all controls and graphics previously created.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
ClearControls windowID
This command removes all controls previously created.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
ClearGraphics windowID
This command clears all graphics created by previous graphic commands.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
AlertBox resourceID
This command will load and us an alert dialog from a resource 'ALRT'. The dialog will pop up and notify the user. Custom alert dialogs can be created with ResEdit.
resourceID - This should be a numeric expression that contains a value that is used to reference the resource ID of an Alert resource.
Examples: AlertBox 128
var = WinBorder( windowID , dimension )
This function returns a numeric value that represents a dimension of the specified window.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
dimension - This should be a numeric expression that contains a value that is used to designate which Window dimension to return:
Values for dimension
1 = Return the left x screen coordinate for this window.
2 = Return the top y screen coordinate for this window.
3 = Return the width in pixels of this window.
4 = Return the height in pixels of this window.
var = WinHandle( windowID )
This function returns a long value that is the actual MacOS handle to a form/window. This function is normally used to get the MacOS window handle to pass to a Code Resource Module. (See Code Resource Modules section for more information )
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
var = WinExist( windowID )
This function returns a true(1) / false(0) value that is indicates that a window with the windowID has already been created.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
var$ = WinTitle( windowID )
This function a string value that is the window title of the specified window.
windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.
var$ = FrontWindow( )
This function a string value that is the window title of the frontmost window in the application. This will be a empty string if there no window in front or the front window has no title.
var = WinNum( windowID )
This function returns a long value that is the reference number to a window that can be passed to Sub and Function procedures in long varaiables.
windowID - This should be a Form name.
var = MsgBox( message$, buttontypes )
This command creates a message box window centered on the desktop. It will not relinquish control until a command button option is selected by the user. Message boxes are normally used to notify the user of important information or to confirm an action that is about to take place.
var - This should be a numeric variable that will contain a value that will receive the results of the users interaction with the message box:
MessageBox Results
1 = The OK, Yes, Save, Retry, or Continue button was selected.
0 = The No, Dont Save, or Dont Quit button was selected.
-1 = The Cancel button was selected.
message$ - This is a string expression designating the message that should appear inside this window.
buttons - This is a numeric expression designating the number and type of buttons that will be in the message box:
MessageBox Button Types
0 = OK button only.
1 = OK and Cancel buttons.
2 = Yes and No buttons
3 = Yes, No, and Cancel buttons
4 = Save, Dont Save, Cancel, buttons
5 = Quit and Dont Quit buttons.Examples: Dim a a = MsgBox( "Choose OK or Cancel", 1 ) If a = 1 then ? "OK was pressed" Else ? "Cancel was pressed" Endif