These are routines that let you inspect and alter attributes of controls. For more specialized routines, see:
Controls are the basic elements of Windows programs. You can create them, query and change Attributes, and respond to Events.
See Also: Attributes, Control, Edit Control, List Control, Scroll Control
These are functions the bring up common dialogs.
These are routines that let you inspect and alter attributes of the text edit controls, EditText and MleText.
Events are routines that are triggered in response to actions taken by the user of the application - mouse clicks, key presses, resizing windows, and so on.
These routines allow you to work with text graphics: displaying text, changing the font, and so on.
These are routines that allow you to draw on controls, typically a Window, Pixmap or Printer.
The predefined colors are:
Black, Blue, Green, Cyan, Red, Magenta, Brown White, Gray, BrightBlue, BrightGreen, BrightCyan, BrightRed, BrightMagenta, Yellow and BrightWhite
These are routines that let you inspect and alter attributes of controls with lists: Combo, DropDownList, List, SimpleCombo, SortedCombo, SortedList.
The first item in a list is 1, not 0. This makes it consistant with Euphoria's indexing method, but can be a bit confusing if you are used to working with zero-based arrays.
These routines give you access to C data structures, the device context, and other Win32 API goodies.
These are routines that deal with the mouse and mouse pointer.
These are routines that allow you to interact with the Printer.
These routines let you inspect and alter attributes of the scroll bar controls HScroll and VScroll and track bar controls HTrackBar and VTrackBar.
These are data types defined by Win32Lib.
These are routines that didn't seem to fit in any other category.
These routines deal with a portable graphics file format called XPM - "X Pixmap". XPM graphics can be embedded in programs as text data.
Example:
abortErr( "Fatal error. Bummer, dude." )
See Also: abs, findKey, playSound, setWarning, shellExecute, warnErr
See Also: abortErr, findKey, playSound, setWarning, shellExecute, warnErr
Example:
-- add "Apples" to TheList addItem( TheList, "Apples" )
See Also: deleteItem, eraseItems, getCount, getIndex, getItem, insertItem, setIndex
This is typically used if the structure contains an array of topic Low Level Routines.
In this snippet, the memBitmapInfo structure contains an array of RGBQUAD colors. The array is populated with the values in the pal:
-- get the start of the rgbQuad array rgbQuad = address( memBitmapInfo, bmiColors )-- copy the pal to memory for i = 1 to colors do
-- store values store( rgbQuad, rgbRed, pal[i][1] ) store( rgbQuad, rgbGreen, pal[i][2] ) store( rgbQuad, rgbBlue, pal[i][3] ) store( rgbQuad, rgbReserved, 0 )
-- move to next quad rgbQuad += SIZEOF_RGBQUAD
end for
See Also: allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
Example:
atom pt-- allocate a point structure pt = allocate_struct( SIZEOF_POINT )
See Also: address, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
Allowable types are:
Example:
global constant rectLeft = allot( Long ), rectTop = allot( Long ), rectRight = allot( Long ), rectBottom = allot( Long ), SIZEOF_RECT = allotted_size()
See Also: address, allocate_struct, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
Example:
global constant rectLeft = allot( Long ), rectTop = allot( Long ), rectRight = allot( Long ), rectBottom = allot( Long ), SIZEOF_RECT = allotted_size()
See Also: address, allocate_struct, allot, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
The bitBlt function can be used to rapidly copy images, or portions of images.
If you want to copy the entire source image with the SRCCOPY ROP code, copyBlt does the same thing, but requires less arguments.
To copy images with transparency, use transBlt.
The arguments are:
The ROP (raster operation) specifies how to combine the source with the destination. The codes are:
Note: At the moment, the coordinates are zero relative; this may be changed in later releases. Example:
-- draw a bitmap in a window atom hDIB-- load the bitmap hDib = loadBitmapFromFile( "lizard.bmp" )
-- copy 40x40 portion of source image to destination bitBlt( TheWindow, -- copy to TheWindow 10, 10, -- put at {10,10} in TheWindow Pixmap1, -- copy from Pixmap1 0, 0 -- upper left hand corner is {0,0} 40, 40, -- copy a 40x40 pixel portion SRCCOPY ) -- replace destination with image
See Also: copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
A Bitmap does not respond to events.
A Bitmap has the following attributes:
See Also: CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
To release the mouse, use releaseMouse.
Example:
-- grab the mouse for TheWindow captureMouse( TheWindow )
See Also: createMousePointer, releaseMouse, setMousePointer
A CheckBox is a button that can be toggled on or off. It appears as a box with a label to the side. Clicking the checkbox causes an 'X' to be toggled in the box.
A CheckBox has the following attributes:
See Also: Bitmap, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Example:
-- clear selected text in TheTextEdit clear( TheTextEdit )
See Also: copy, cut, paste, undo
If window is not a main window, window will be hidden and the onClose event will be triggered.
If window is the main window (see WinMain), then the application will be shut down and the onDestroy event will
Example:
-- close TheDialog closeWindow( TheDialog )
See Also: create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
A Combo is a combination of an edit control and a list. If you need the items in the combo to be sorted, use a SortedCombo instead. In addition to being able to select a value from the combo's list, the user can enter their own value as well.
A Combo has the following attributes:
See Also: Bitmap, CheckBox, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Example:
-- copy text from TheTextEdit into the clipboard copy( TheTextEdit )
See Also: clear, cut, paste, undo
If you only want to copy a portion of the source or need to combine the source and destination, use bitBlt.
To copy images with transparency, use transBlt.
The arguments are:
Note: At the moment, the coordinates are zero relative; this will be changed in later releases. Example:
-- draw a bitmap in a window atom hDIB-- load the bitmap hDib = loadBitmapFromFile( "shuttle.bmp" )
-- copy the entire image to TheWindow copyBlt( TheWindow, 10, 10, hDib )
See Also: bitBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
There are a number of caveats:
Example:
-- save {0,0} {100,100} on the screen to a file copyToBitmapFile( Screen, "screen.bmp", 0, 0, 100, 100 )
See Also: bitBlt, copyBlt, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
The title is the text that will appear in the object's caption. x and y specify the position of the object, and cx and cy specify the width and height.
You can specify additional attributes by passing them in the flags parameter.
Returns: The value returned is the id of the control. This is typically the first parameter expected in Win32Lib functions.
The parent of the main window is 0.
If you don't care about the positioning of a window, you can use the parameter Default, and Windows will automatically position the window.
Note that, for windows, the size specified by cx, cy is the total size of the window, not the size of the client area.
The following will create a Window called MyWindow:
-- create a window constant MyWindow = create( Window, -- the class "My Window", -- the caption 0, -- the parent Default, Default, -- x and y position 60, 40, -- height and width 0 ) -- no special flags
The following will create a PushButton in MyWindow:
-- create a pushbutton constant MyButton = create( PushButton, -- the class "Push Me!", -- the caption MyWindow, -- the parent 10, 10, -- x and y position 60, 40, -- height and width 0 ) -- no special flags
The different classes of objects are:
See Also: closeWindow, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
The data is in the form { pal, data }.
The name createDIB ("Device Independant Bitmap") was intended to distinguish this function from the obsolete createBitmap, which created only monochrome bitmaps.
You only need to supply as many palette entries that are actually used by the image. Pixel indexes into the palette start at 0 (to be compatible with how Euphoria uses bitmaps)
Palette entries are color tuples in the form { r, g, b }, with each color value ranging from 0 to 255.
Example:
-- create a bitmap, and display it atom hBitmap sequence pixels, pal-- the pixels data pixels = { { 0,0,0,0 }, -- scan line 1 { 0,1,1,0 }, -- scan line 2 { 0,1,1,0 }, -- scan line 3 { 0,0,0,0 } } -- scan line 4
-- the pal data (color tuples) pal = { { 255, 0, 0 }, -- color 0 is bright red { 0, 0, 255 } } -- color 1 is bright blue
-- create the DIB hBitmap = createDIB( {Pal, Pixels} )
-- display the bitmap in TheWindow at {1,1} drawBitmap( theWindow, hBitmap, 1, 1 )
See Also: bitBlt, copyBlt, copyToBitmapFile, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
The x and y values are the "hotspot". The image is a 2x2 text sequence of the pointer. Bytes are interpreted as follows:
' ' = transparent '.' = solid white 'x' = solid black
Example:
constant PlusPointer = createMousePointer( 8, 8, { " xxxxxx ", " x....xx ", " x....xx ", " x....xx ", " x....xx ", "xxxxxx....xxxxxx ", "x..............xx", "x..............xx", "x..............xx", "x..............xx", "xxxxxx....xxxxxxx", " xxxxx....xxxxxxx", " x....xx ", " x....xx ", " x....xx ", " xxxxxxx ", " xxxxxx "} )-- set as pointer for MyWindow setMousePointer( MyWindow, PlusPointer )
See Also: captureMouse, releaseMouse, setMousePointer
Status codes:
See Also: createXpmFromBmpFile, setTransparentColor, xpmToEuBmp, xpmToPixmap
Status codes:
See Also: createXpm, setTransparentColor, xpmToEuBmp, xpmToPixmap
A CText control does not respond to events.
A CText has the following attributes:
See Also: Bitmap, CheckBox, Combo, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Example:
-- cut text from TheTextEdit cut( TheTextEdit )
See Also: clear, copy, paste, undo
A DefPushButton is a PushButton, but is displayed with an extra border indicating that this button will automatically be selected if the user presses the Return button on the keyboard.
Unfortunately, this behavior is not currently implemented, so it simply behaves the same as a normal PushButton.
A DefPushButton has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
The position starts at 1.
Example:
-- delete item 2 from the list deleteItem( TheList, 2 )
See Also: addItem, eraseItems, getCount, getIndex, getItem, insertItem, setIndex
Draws the arc in the current pen color. The arc's bounding rectangle is defined as { x1, y1 } to { x2, y2 }. If filled is true, the ellipse is filled in the current pen color.
The arc is defined by the intersection between the radial start point and radial end point. The radial start point is a line running from the center of the bounding rectangle to { xStart, yStart }, and radial end point by a line running from the center of the bounding rectangle to { xEnd, yEnd }.
If filled is true, the arc will be filled.
Example:
-- draw a bright cyan filled arc in TheWindow setPenColor( TheWindow, BrightCyan ) drawArc( TheWindow, True, -- filled 1, 1, -- upper left boundary 100, 100, -- lower right boundary 49, 1, -- top center of rectangle 100, 49 ) -- right center of rectangle
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
Note: The term bitmap is inconsistant; I expect to be renaming these routines in the future.
Example:
-- load a bitmap, and display in window atom hBitmap-- load the bitmap hBitmap = loadBitmapFromFile( "graphic.bmp" )
-- display the bitmap in TheWindow at {1,1} drawBitmap( theWindow, hBitmap, 1, 1 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
Draws the chord in the current pen color.
A chord is a region bounded by the intersection of an ellipse and a line segment. The ellipse is bounding rectangle is defined { x1, y1 } to { x2, y2 }. If filled is true, the chord is filled in the current pen color.
The chord is defined by the intersection between the radial start point and radial end point. The radial start point is a line running from the center of the bounding rectangle to { xStart, yStart }, and radial end point by a line running from the center of the bounding rectangle to { xEnd, yEnd }.
If filled is true, the chord will be filled.
Example:
-- draw a yellow chord in TheWindow setPenColor( TheWindow, Yellow ) drawChord( TheWindow, True, -- filled 1, 1, -- upper left boundary 100, 100, -- lower right boundary 49, 1, -- top center of rectangle 100, 49 ) -- right center of rectangle
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
Draws the ellipse in the current pen color within the rectangle bounded by { x1, y1 } and { x2, y2 }. If filled is true, the ellipse is filled in the current pen color.
Example:
-- draw a black ellipse in TheWindow setPenColor( TheWindow, Black ) drawEllipse( TheWindow, True, 10, 10, 100, 100 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
The line is drawn in the current pen color between { x1, y1 } and { x2, y2 }.
Example:
-- draw a line in TheWindow from {10,10} to {100,100} drawLine( TheWindow, 10, 10, 100, 100 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
Draws the pie slice in the current pen color. The bounding rectangle is defined as { x1, y1 } to { x2, y2 }. If filled is true, the slice is filled in the current pen color.
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
Draws the polygon in window in the current pen color using points. If i/ filled is true, the polygon will be filled.
Example:
-- draw a blue filled triangle in TheWindow sequence points-- define the points points = { { 10, 10 }, { 80, 40 }, { 40, 80 } }
-- set pen color setPenColor( TheWindow, Blue )
-- draw a filled polygon using the points drawPolygon( TheWindow, True, points )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
Draws the rectangle in the current pen color from { x1, y1 } to { x2, y2 }. If filled is true, the rectangle is filled in the current pen color.
Example:
-- draw a filled green rectangle in TheWindow setPenColor( TheWindow, Green ) drawRectangle( TheWindow, True, 10, 10, 100, 100 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
Draws the rounde rectangle in the current pen color from { x1, y1 } to { x2, y2 }. The ellipse corner width and height are specified in xc and yc. If filled is true, the rectangle is filled in the current pen color.
Example:
-- draw a filled blue round rectangle in TheWindow setPenColor( TheWindow, Green ) drawRoundRectangle( TheWindow, True, 10, 10, 100, 100, 5, 5 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
A DropDownList is like a Combo, but the user can only select items on the list, and not enter their own value into the edit box.
A DropDownList has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
An EditText allows the user to enter text values into the control.
A EditText has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Applications should call endDoc when finished printing.
Refer to Printer for details.
See Also: endPage, getPrinter, releasePrinter, startDoc, startPage
Refer to Printer for details.
See Also: endDoc, getPrinter, releasePrinter, startDoc, startPage
Example:
-- erase items from TheList eraseItems( TheList )
See Also: addItem, deleteItem, getCount, getIndex, getItem, insertItem, setIndex
Data conversion is automatic. For example, if the field is an Lpsz, a sequence containing the string will automatically be returned.
Example:
-- fetch the average character width from the text metrics structure width = fetch( tm, tmAveCharWidth )
See Also: address, allocate_struct, allot, allotted_size, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
Example:
-- find a value from a list integer at at = findKey( name, nameList )
See Also: abortErr, abs, playSound, setWarning, shellExecute, warnErr
Free any strings that have been allocated to the structure. If the structure uses any Lpsz data types, you should call free_strings when you free the structure.
Example:
-- call Win32 StartDoc routine atom di, result-- allocate the structure di = allocate_struct( SIZEOF_DOCINFO )
-- store the values store( di, DOCINFO_cbSize, SIZEOF_DOCINFO ) store( di, DOCINFO_lpszDocName, job )
result = c_func( xStartDoc, { printerDC, di } )
-- free the structure free( di ) free_strings()
See Also: address, allocate_struct, allot, allotted_size, fetch, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
Example:
-- where does {10, 10} in MyWindow appear on the screen? sequence point-- get the screen position point = getClientPoint( MyWindow, 10, 10 )
-- display the size wPrintf( MyWindow, "The point {10,10} maps to {%d, %d on the screen"}, point )
See Also: closeWindow, create, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
Unlike the menu, toolbar and statusbar both occupy space in the window. To determine what part of the window's client area is not covered, use this function. This function can be used even if there is no toobar or statusbar in the window.
For example, the generic demo has a MleEdit that needs to be resized every time the window is resized. It uses getClientRect to determine the metrics of the MleEdit.
-- color the unoccupied portion of the window red sequence rect-- find out what portion of the window is free rect = getClientRect( TheWindow )
-- draw a filled rectangle setPenColor( TheWindow, Red ) drawRectangle( TheWindow, rect[1], rect[2], rect[3], rect[4] )
See Also: closeWindow, create, getClientPoint, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
Calling this function brings up the modal "Select Color" dialog, allowing the user to select a color from the default color list, or add a color to the custom color list.
The parameter passed in default color is an atom representing the default color to select, in #RRGGBB format. Passing -1 specifies that the color black (#000000) is the default color.
NOTE: For some reason, the parameter seems to be in the #BBGGRR format instead of the #RRGGBB form. If someone could figure out what's happening here, I'd appreciate it.
Example:
-- get a color; red ( #FF0000 ) is the default atom color color = getColorDialog( Window, #FF0000 )
See Also: getFontDialog, getOpenFileName, getSaveFileName
Example:
-- count size of TheList integer countcount = getCount( TheList )
See Also: addItem, deleteItem, eraseItems, getIndex, getItem, insertItem, setIndex
If the DC is already grabbed, the value is simply returned without grabbing it again.
There are four special cases that are handled:
When you are done with the DC, it should be released with releaseDC unless the DC was obtained during an onPaint event, since the DC will be released automatically.
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
Example:
-- how large is TheButton? sequence extent-- get the size of TheButton extent = getExtent( TheButton )
-- display the size wPrintf( MyWindow, "TheButton is %d by %d}, extent )
See Also: closeWindow, create, getClientPoint, getClientRect, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
Calling this function brings up the modal "Select Font" dialog, allowing the user to select a font from the list of available fonts.
Example:
integer flags, points atom color sequence font object result-- get a font choice from the user result = getFontDialog( MyWindow ) if sequence( result ) then -- get the values font = result[1] points = result[2] flags = result[3] color = result[4] end if
See Also: getColorDialog, getOpenFileName, getSaveFileName
Example:
-- get the descent for the default font integer descentsetDefaultFont( MyWindow ) descent = getFontMetric( MyWindow, tmDescent ) wPrintf( MyWindow, "The default font's descent is %", descent )
See Also: getFontSize, getTextExtent, setDefaultFont, setFont, setHintFont, setPosition, setTextAlign, setTextColor, wPrint, wPrintf, wPuts
Example:
-- show the metrics of the default font sequence sizesetDefaultFont( MyWindow ) size = getFontSize( MyWindow ) wPrintf( MyWindow, "The default font is %d by %d", size )
See Also: getFontMetric, getTextExtent, setDefaultFont, setFont, setHintFont, setPosition, setTextAlign, setTextColor, wPrint, wPrintf, wPuts
Example:
-- get index of selected item in TheList integer indexindex = getIndex( TheList )
See Also: addItem, deleteItem, eraseItems, getCount, getItem, insertItem, setIndex
Example:
-- get the text of the third item in TheList sequence text-- get the text text = getItem( TheList, 3 )
See Also: addItem, deleteItem, eraseItems, getCount, getIndex, insertItem, setIndex
Example:
sequence pospos = getMousePos() if pos[1] > 200 then -- code goes here... end if
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
This is basically a combination of Euphoria's value() function and getText().
Example:
-- get the numeric value from TheTextEdit atom numbernumber = getNumber( TheTextEdit )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
Calling this function brings up the modal "Open File" dialog, allowing the user to select a file name. file is a sequence holding the default file name. filters is a list of patterns to limit displayed files to, in the format:
{ "text", pattern, "text", pattern ... }
For example:
constant FileTypes = { "Text File", "*.TXT", "Euphoria Program", "*.EX;*.EXW;*.E;*.EW", "All Files", "*.*" }
Note that a pattern can contain several different values.
Example:
-- get file name to open sequence filenamefilename = getOpenFileName( TheWindow, -- parent window "", -- no default name { "Text File", "*.TXT", -- text files "All Files", "*.*" } ) -- everything else
See Also: getColorDialog, getFontDialog, getSaveFileName
Example:
-- get a pixel color from {10,10} in TheWindow atom rgb rgb = getPixel( TheWindow, 10, 10 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
This pops up the "Select Printer" dialog for the user to select a printer from.
Refer to Printer for details.
See Also: endDoc, endPage, releasePrinter, startDoc, startPage
Calling this function brings up the modal "Save File" dialog, allowing the user to select a file name. file is a sequence holding the default file name. filters is a list of patterns to limit displayed files to, in the format:
{ "text", pattern, "text", pattern ... }
For example:
constant FileTypes = { "Text File", "*.TXT", "Euphoria Program", "*.EX;*.EXW;*.E;*.EW", "All Files", "*.*" }
Note that a pattern can contain several different values.
Example:
-- get file name to save filename = getOpenFileName( TheWindow, -- parent window "MyFile.txt", -- default name { "Text File", "*.TXT", -- text files "All Files", "*.*" } ) -- everything else
See Also: getColorDialog, getFontDialog, getOpenFileName
This value is set by setScrollChange. The default value is {1,10}, indicating the small change and large change amounts.
Example:
-- get change amount for TheScroll sequence change change = getScrollChange( TheScroll )
See Also: getScrollPos, getScrollRange, setScrollChange, setScrollPos, setScrollRange
Example:
-- get value of TheScroll integer pos pos = getScrollPos( TheScroll )
See Also: getScrollChange, getScrollRange, setScrollChange, setScrollPos, setScrollRange
This value is set by setScrollRange. The default value is {0,100}.
Example:
-- get range of TheScroll sequence range range = getScrollRange( TheScroll )
See Also: getScrollChange, getScrollPos, setScrollChange, setScrollPos, setScrollRange
Example:
-- where is the window located? sequence size-- get the size of the window size = getSize( MyWindow )
-- display the position wPrintf( MyWindow, "MyWindow is located at %d,%d}, size[1..2] )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
The system colors in Windows are:
Example:
-- Set the window to the button color setWindowBackColor( MyWindow, getSysColor( COLOR_BTNFACE ) )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
If the control is editable, it returns the data in the control. Otherwise, it returns the caption text of the control.
Example:
-- get the text from TheTextEdit sequence texttext = getText( TheTextEdit )
Note: This should probably be divided into two seperate functions, getCaption and getData.
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
short Gets the metrics of the text string, using object's current font.
Example:
-- show the metrics of the string sequence text, extent-- the string to measure text = "Hi, there!"
-- measure the string extent = getTextExtent( MyWindow, text )
-- show results wPrintf( MyWindow, "The string %s is %d by %d", {string, extent[1], extent[2]} )
See Also: getFontMetric, getFontSize, setDefaultFont, setFont, setHintFont, setPosition, setTextAlign, setTextColor, wPrint, wPrintf, wPuts
A Group is a static control, and recieves no events. It's main function is to seperate other controls into groups.
In addition to providing a visual cue, the group alters the behavior of the Radio control; all the radio buttons within a single group are considered to belong to the same group.
When placing controls in groups, it's a good idea to make them children of the Group, instead of children of the Window. If you don't, the Group may end up routing events meant for the control to itself. For example, onDragAndDrop events will be routed to the Group instead of the child.
A Group has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Typically used to decode Win32 message values when several values are packed into a single number.
Example:
-- extract the high portion from lParam integer y y = hi_word( lParam )
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
An HScroll has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
An HTrackBar has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
A VTrackBar has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Icon control. An Icon is a static small graphic. As a static control, it does not respond to events.
An Icon has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
The position starts at 1.
Example:
-- insert "Bannanas" at position 2 in TheList insertItem( TheList, "Bannanas", 2 )
See Also: addItem, deleteItem, eraseItems, getCount, getIndex, getItem, setIndex
See Also: seq
Example:
-- is TheRadio1 checked? integer flagflag = isChecked( TheRadio1 )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
Example:
-- is TheButton enabled? integer flagflag = isEnabled( TheButton )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
This is used for hit testing, to determine if a point lies on a control.
Example:
-- check if screen point {10,10} lies in MyWindow if isScreenPointIn( MyWindow, 10, 10 ) then -- point is in MyWindow end if
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
Example:
-- is TheButton visible? integer flagflag = isVisible( TheButton )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
This deactivates timer that was set with setTimer.
Example:
-- deactivate timer #12 killTimer( MyWindow, 12 )
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
Essentially the same as define_c_func, but generates an error message and aborts if the routine can't be linked to.
Example:
constant xLoadIcon = linkFunc(user32, "LoadIconA", {C_POINTER, C_POINTER}, C_POINTER)
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
Essentially the same as define_c_proc, but generates an error message and aborts if the routine can't be linked to.
Example:
constant xKillTimer = linkProc(user32, "KillTimer", {C_POINTER, C_UINT})
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
A List contains a list of items, arranged in the order that they were placed into the list. To have a sorted list, either sort the items before placing them into the list, or use the SortedList control.
A List has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Note: The name bitmap is a bit confusing; it should be more properly called loadDIBFromFile. At some point, the graphic routines need to be renamed in a more consistant manner.
Example:
-- load a bitmap, and display in window atom hBitmap-- load the bitmap hBitmap = loadBitmapFromFile( "graphic.bmp" )
-- display the bitmap in TheWindow at {1,1} drawBitmap( theWindow, hBitmap, 1, 1 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
Typically used to decode Win32 message values when several values are packed into a single number.
Example:
-- extract the low portion from lParam integer x x = lo_word( lParam )
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
An LText control does not respond to events.
An LText has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
A Menu is an item in a window's menubar. There is no need to declare a menubar for a window; if a Menu is created, the menubar will automatically be created for it.
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
A MenuItem is an item in a window's Menu. Menu items are placed sequentially into menus.
There is currently no way to remove menu items.
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
An MleEdit (multi-line edit) control is like a mini-text editor. The user can enter in multiple lines of text.
Since the Tab key is accepted as input into the MLE, the user has to press Control+Tab to move to the next control, instead of the standard Tab key.
A MleEdit has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
The name is a bit misleading, since this applies to controls as well as to windows. The name setPosition is already taken, although this may be changed to movePen in the future.
control is moved to x, y, and sized to cx, cy. If the repaint flag is set, the window is repainted.
To find the current size and position of control, use getSize.
Example:
-- move Button1 to 20x20 sequence size-- get the current size size = getSize( Button1 )
-- change the size and repaint moveWindow( Button1, 20, 20, size[3], size[4], True )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
To determine the new value of the control, use the appropriate function - getText, isChecked, etc.
See Also: onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
It is issued along with and onMouse event.
This event is typically used when a control such as a PushButton or CheckBox is clicked.
See Also: onChange, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
This typically occurs via closeWindow, although the user can select the close control on the window as well.
Closing a window does not actually destroy it (unless it is the main window; the window is merely hidden. Refer to closeWindow for more details.
This event is only triggered for a Window.
See Also: onChange, onClick, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
This is triggered when a the main window is closed.
This event is only triggered for the main window.
See Also: onChange, onClick, onClose, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
This is triggered by the user dragging and dropping a file onto a control or window. If more than one file is dropped, each file name triggers a seperate onDragAndDrop event. The following controls respond to onDragAndDrop:
For example, the following code adds the name of the file to TheList when a file is dragged and dropped on it:
procedure dropped( fileName ) -- add the file name to the list addItem( TheList, fileName ) end procedure onDragAndDrop[ TheList ] = routine_id("dropped")
See Also: onChange, onClick, onClose, onDestroy, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
Before the events are processed by any of the trap routines or default Windows routines, the onEvent trap is processed.
If you want to skip the default Windows processing of the event, pass a non-zero value to the returnValue routine.
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
Focus means that keyboard events are directed to that control. Static controls (such as LText) cannot get focus.
When a Win32Lib window gets focus, it will give focus back to the last control in the window that had focus. If there are no controls in the window that can recieve focus, the focus will remain with the window.
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
The scanCode is "raw" value of the key. The primary purpose of onKeyDown is to trap "special" keys not reported by onKeyPress.
The shift parameter has bits set indicating the if the shift, control, and alt keys are pressed. The masks for each key are:
For example, to see if the Shift+Backspace key was pressed, you could write:
-- shift+backspace? if and_bits( shift, ControlMask ) and scanCode = VK_BACK then -- shift+backspace held end if
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
The keyCode is ANSII value of the key. Only "visible" keys are reported with this function. To trap "special" keys (such as the cursor keys), use onKeyDown. For example:
-- is it the letter 'a'? if keyCode = 'a' then -- it's the letter a end if
The shift parameter has bits set indicating the if the shift, control, and alt keys are pressed. The masks for each key are:
For example, to see if the control key is held down, you could write:
-- control key held down? if and_bits( shift, ControlMask ) then -- control key is held down end if
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
The scanCode is the raw scan code value of the key. Use the VK_ constants to determine the value of the key.
The shift parameter has bits set indicating the if the shift, control, and alt keys are pressed.
See onKeyDown for details.
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
Focus means that keyboard events are directed to that control. See onGotFocus.
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onMouse, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
The event parameter will be one of the following values:
The x and y parameters specify where the mouse is located. If the mouse has been grabbed (see captureMouse), the values of x and y can be negative if the mouse is outside the client area.
The shift parameter has bits set indicating the if the shift, control, and alt keys are pressed. The masks for each key are:
For example, to see if the shift key is held down, you could write:
if and_bits( shift, ShiftMask ) then -- shift is held down end if
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onOpen, onPaint, onResize, onScroll, onTimer, returnValue
This is typically triggered by WinMain, or openWindow, before the window is visible by the user.
Typically, code that is run at this point does some sort of initialization.
This event is only triggered for a Window.
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onPaint, onResize, onScroll, onTimer, returnValue
The parameters indicate the portion of the window that needs to be updated.
Not only does {x1,y1,x2,y2} define the area that needs to be redrawn, Windows restricts your application to only being able to draw in those areas! If your application tries to write outside this rectangle on an onPaint event, nothing will be drawn there.
Since Windows expects you application to be able to redraw any part of the application's window when responding to an onPaint event, this means that the onPaint routine must know how to render any part of the window.
For programs without any graphics and text drawn on the window, there is no problem - since there are no graphics, there is nothing to update.
If the application is fairly lightweight (such as a tic-tac-toe game), you simply choose to ignore the parameters passed to onPaint, and redraw the entire window with each onPaint event.
If there is sufficient graphics to make the task of repainting the window complex, the best approach is probably to do double-buffering with a Pixmap.
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onResize, onScroll, onTimer, returnValue
The style is one of the following:
Expect the style parameters to change to system-independant constants at some point in time.
The x and y parameters are the size of the client area.
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onScroll, onTimer, returnValue
The position parameter indicates the new value of a scrollbar or trackbar.
This event is only triggered for HScroll and VScroll controls.
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onTimer, returnValue
Timers are clocks that are maintained by Windows, and trigger onTimer events at a user-specified interval, measured in milliseconds.
They are created and removed with the calls:
A timer is not treated as an actual control. Rather, the event is sent to the window that the timer is associated with.
---------------------------------------------------------------------------
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, returnValue
The style flag is one of the following:
The openWindow function will trigger an onOpen event.
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
Typically used to combine a series of attribute flags together.
Example:
-- combine flags integer flags flags = or_all( { WS_CHILD, WS_VISIBLE, BS_PUSHBUTTON, WS_TABSTOP} )
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, pack_word, peek_string, releaseDC, sendMessage, setTimer, store
Typically used to encode a message parameter into a 32 bit word.
Example:
-- pack min and max into parameter integer y lParam = pack_word( min, max )
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, peek_string, releaseDC, sendMessage, setTimer, store
Example:
-- paste text from clipboard to TheTextEdit paste( TheTextEdit )
See Also: clear, copy, cut, undo
This is typically done automatically by the fetch function.
Example:
-- get a C-string from address sequence ss = peek_string( address )
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, releaseDC, sendMessage, setTimer, store
A PictureButton is a PushButton with a graphic instead of text. The graphic can be specified by passing the name or address of a bitmap control in the flags parameter, or with setBitmap, setIcon or setPixmap.
A PictureButton is typically used in a ToolBar.
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
A Pixmap is an off-screen color bitmap. It can be displayed in a window by using one of the bitblt functions (see Graphics for details).
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
This is a wrapper around the Win32 PlaySound command.
See Also: abortErr, abs, findKey, setWarning, shellExecute, warnErr
A Popup is a menu not attached to a window. To display a popup, use popup().
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Example:
-- create a popup for MyWindow constant MyPopup = create( Popup, "", MyWindow, 0, 0, 0, 0, 0 )
-- add four items into it constant Item1 = create( MenuItem, "Item 1", MyPopup, 0, 0, 0, 0, 0 ), Item2 = create( MenuItem, "Item 2", MyPopup, 0, 0, 0, 0, 0 ), Item3 = create( MenuItem, "Item 3", MyPopup, 0, 0, 0, 0, 0 ), Item4 = create( MenuItem, "Item 4", MyPopup, 0, 0, 0, 0, 0 )
-- popup the menu at {10,10} in MyWindow popup( MyPopup, 10, 10 )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
The Printer refers to the selected printer. Before it can be used, you must first select a printer using getPrinter. After you are done printing, you should release the Printer with releasePrinter.
Each document should be begin and end with a startDoc and endDoc pair. Likewise, each page should begin and end with a startPage and endPage pair.
For the sake of space, the example doesn't use the values returned by getPrinter.
Example:
-- example of using printer sequence result atom ok-- select the printer result = getPrinter()
-- did the user select a printer? if length( result ) then
-- start a new document if not startDoc( sprintf( "My Job, Copy %s", {i} ) ) then exit end if
-- start a new page if not startPage() then exit end if
-- print on the page wPuts( Printer, "Hello, Printer!" )
-- close the page if not endPage() then exit end if
-- close the document if not endDoc() then exit end if
-- release the printer releasePrinter()
end if
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
A PushButton is a normal push button (sometimes called command button). A PushButton has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
A Radio is similar to a CheckBox, in functionality. Like a checkbox, it can be toggled on and off. However, radio buttons are grouped controls - if one is toggled on, the rest in the group are toggled off.
Win32Lib considers a radio button in a group if they are contained by the same Group control. If there is no Group control, then all the radio buttons are considered to belong to the same group.
A Radio has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
The DC should have been obtained with getDC.
If the control is not a Pixmap or DIB, and the DC was obtained during an onPaint event, there is no need to release the DC. Win32Lib will automatically release all DCs obtained during an onPaint there is no need to release the DC, since Win32Lib will release all the DCs at the end of supposed to have the DC, there is no need to release it.
If the control is the Printer, there is no need to release the DC using releaseDC. Instead, use releasePrinter
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, sendMessage, setTimer, store
This is called after captureMouse to put control of the mouse back to normal.
Example:
-- release the mouse. releaseMouse()
See Also: captureMouse, createMousePointer, setMousePointer
The Printer must first be grabbed with getPrinter.
Refer to Printer for details.
See Also: endDoc, endPage, getPrinter, startDoc, startPage
This sends repaints a the specified portion of the window with the background color, erasing that portion of it. It then triggers an onPaint event for that window, passing the erased area as parameters.
Example:
-- repaint only a portion of MyWindow repaintRect( myWindow, 1, 1, 10, 10 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
This repaints the entire window in it's background color, effectively erasing everything in it. It then triggers an onPaint event for that window, requesting that the entire window be repainted.
Example:
-- force MyWindow to be repainted repaintWindow( myWindow )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
This allows you to override the value an event handler returns to Win32. By default, when an event is processed, it goes through these steps:
Setting returnValue causes processing to stop at the step that the value was set in, and return that value to Windows.
Example: (not tested yet!)
-- prevent Button1 from seeing any space bar keys procedure Button1_KeyDown( int keycode, int shift ) if keycode = VK_SPACE then -- set return value returnValue( True ) end if end procedure onKeyDown[ Button1 ] = routine_id("Button1_KeyDown")
See Also: onChange, onClick, onClose, onDestroy, onDragAndDrop, onEvent, onGotFocus, onKeyDown, onKeyPress, onKeyUp, onLostFocus, onMouse, onOpen, onPaint, onResize, onScroll, onTimer
Converts the red, green and blue values (ranging from 0-255) into an atom representing that color tuple. Each value represents the relative brightness of each primary color element.
Example:
-- set the pen color to a random green setPenColor( MyControl, rgb( 0, 0, rand( 255 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
An RText control does not respond to events.
An RText has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
The Screen refers to the computer screen. It is automatically created, and it most graphic methods that work in Windows will also work with the screen.
Example:
-- Draw an 'x' across the screen sequence extent-- get the screen extent extent = getExtent( Screen )
-- set the pen color to red setPenColor( Screen, Red )
-- draw the lines drawLine( Screen, 0, 0, extent[1], extent[2] ) drawLine( Screen, extent[1], 0, extent[2], 0 )
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
This just converts the control id into a handle and calls SendMessage.
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, setTimer, store
See Also: int
Note: At best, this function is a misnamed, and it's probably no event longer in use. When the pen mode is set to OPAQUE, this specifies the color used to fill the 'gaps'.
However, Win32Lib doesn't directly support these pen modes, so it's not clear that this function even needs to exist. Further, it's often confused with setWindowBackColor.
Example:
-- set pen opaque color setTextColor( TheWindow, Red ) wPuts( TheWindow, "This text is in red" )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
Object can be one of the following:
If bitmap is a sequence, it will be assumed to be the name of an bitmap file, and Win32Lib will attempt to load the bitmap.
Otherwise, bitmap is assumed to be the handle of a bitmap.
Example:
-- assign a bitmap to the picture button setIcon( PictureButton1, "close.bmp" )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
This works for Menus and MenuItems as well as toggle controls such as Radio, CheckBox and ToggleButton.
Example:
-- set a check on the SyntaxColoring option setCheck( SyntaxColoring, True )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
Example:
-- restore MyWindow to the default font setDefaultFont( MyWindow )
See Also: getFontMetric, getFontSize, getTextExtent, setFont, setHintFont, setPosition, setTextAlign, setTextColor, wPrint, wPrintf, wPuts
Example:
-- disable TheButton setEnable( TheButton, False )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
This will cause the window or control that currently has focus to lose it.
The window or control losing focus will get an onLostFocus event, and the window or control that is getting focus will get an onGotFocus event.
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
The attributes flag can be a combination of the following:
For example:
-- change the font in MyWindow setFont( MyWindow, "Arial", 10, Bold+Italic ) wPuts( MyWindow, "This is Arial 10 point bold italic." )
See Also: getFontMetric, getFontSize, getTextExtent, setDefaultFont, setHintFont, setPosition, setTextAlign, setTextColor, wPrint, wPrintf, wPuts
If the mouse stays still over a control that has tooltip text associated with it, a small window displaying the tooltip text will appear.
Any control that can get mouse events can have tooltips associated with it, although it tends to work best with PictureButtons, typically in the ToolBar.
Setting the text to "" effectively removes the tooltip.
Example:
-- set hint for CloseButton setHint( CloseButton, "Closes the window" )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setIcon, setPixmap, setText, setVisible, setWindowBackColor, WinMain
Default values are { "MS Sans Serif", 8 points, Normal }.
Example:
setHintFont( "Times New Roman", 10, Bold)
See Also: getFontMetric, getFontSize, getTextExtent, setDefaultFont, setFont, setPosition, setTextAlign, setTextColor, wPrint, wPrintf, wPuts
Object can be one of the following:
If icon is a sequence, it will be assumed to be the name of an icon file, and Win32Lib will attempt to load the icon.
Otherwise, icon is assumed to be the handle of an icon.
Example:
-- assign an icon to the window setIcon( TheWindow, "euphoria.ico" )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setPixmap, setText, setVisible, setWindowBackColor, WinMain
Use 0 to set the index to 'unselected.'
Example:
-- select the first item on the list integer resultresult = setIndex( TheList, 1 )
See Also: addItem, deleteItem, eraseItems, getCount, getIndex, getItem, insertItem
The default mouse pointer displayed is the ArrowPointer, except for TextEdit and MleEdit controls, which use the IBeamPointer.
The pointer can either be a system pointer, or one created with the createMousePointer function.
System mouse pointers are:
Example:
-- Change mouse pointer in MyWindow to CrossPointer setMousePointer( MyWindow, CrossPointer )
See Also: captureMouse, createMousePointer, releaseMouse
Modes are:
If mode is OPAQUE, the color set in setBackColor is used. The default mode is TRANSPARENT.
Example:
-- draw an XOR line in TheWindow setPenROP2( TheWindow, R2_XORPEN ) drawLine( TheWindow, 10, 10, 100, 100 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
This is the color that is used by other graphics routines.
To set the color of text, use setTextColor.
Example:
-- set pen color to red setPenColor( TheWindow, Red ) -- draw a red line drawLine( TheWindow, 10, 10, 40, 40 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
The default value is R2_COPYPEN. The ROP2 codes are:
Example:
-- draw an XOR line in TheWindow setPenROP2( TheWindow, R2_XORPEN ) drawLine( TheWindow, 10, 10, 100, 100 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenStyle, setPenWidth, setPixel, textToBitmap, transBlt
This allows the creation of various dotted line styles. Use setBackColor to define the background fill used on the line.
The following styles are defined:
Note: This routine will probably be dropped in later releases.
Example:
-- set pen style setPenStyle( TheWindow, Dot )-- draw a line using that pen style drawLine( TheWindow, 10, 10, 100, 100 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenWidth, setPixel, textToBitmap, transBlt
The default thickness of the pen is 1 pixel.
Example:
-- set pen thickness of 3 setPenWidth( TheWindow, 3 ) -- draw a thick line drawLine( TheWindow, 10, 10, 40, 40 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPixel, textToBitmap, transBlt
Example:
-- set pixel at {10,10} to Red setPixel( TheWindow, 10, 10, Red )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, textToBitmap, transBlt
If bitmap is a sequence, it will be assumed to be the name of an bitmap file, and Win32Lib will attempt to load the bitmap.
Otherwise, bitmap is assumed to be the handle of a bitmap.
Example:
-- assign a bitmap to the picture button setPixmap( Pixmap1, "spaceship.bmp" )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setText, setVisible, setWindowBackColor, WinMain
Example:
-- move the pen setPosition( MyWindow, 10, 10 )-- display message wPuts( MyWindow, "This is at {10,10}" )
Note: There's a good chance this routine name will be changed in a future release to moveTo().
See Also: getFontMetric, getFontSize, getTextExtent, setDefaultFont, setFont, setHintFont, setTextAlign, setTextColor, wPrint, wPrintf, wPuts
The line size is the amount that the scroll will adjust when the up/down arrow is selected, and the page size is used when the page up/page down is selected.
For trackbars, the page size is used to determine the distance between the tick marks.
The default values are {1,10}.
Example:
-- set change amount for TheScroll setScrollChange( TheScroll, 1, 10 )
See Also: getScrollChange, getScrollPos, getScrollRange, setScrollPos, setScrollRange
The value must be greater than zero. This will trigger an onScroll event.
Example:
-- set value of the TheScroll setScrollPos( TheScroll, 20 )
See Also: getScrollChange, getScrollPos, getScrollRange, setScrollChange, setScrollRange
The low value must be greater than zero.
The default values are {0,100}.
Example:
-- set range for TheScroll setScrollRange( TheScroll, 1, 100 )
See Also: getScrollChange, getScrollPos, getScrollRange, setScrollChange, setScrollPos
Example:
-- size Button1 to 60x32 setSize( Button1, 60, 32 )
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
If the control is editable, it updated the data in the control. Otherwise, it updates the caption text of the control.
Example:
-- change the caption of status bar setText( TheStatusBar, "Ready" )
Note: This should probably be divided into two seperate functions, setCaption and setData.
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setVisible, setWindowBackColor, WinMain
The default option is AlignTop. Options include:
Example:
-- draw a line drawLine( Win, 10, 100, 100, 100 )-- top alignment (default) setTextAlign( Win, AlignTop ) setPosition( Win, 10, 100 ) wPuts( Win, "AlignTop" )
-- bottom alignment setTextAlign( Win, AlignBottom ) setPosition( Win, 10, 100 ) wPuts( Win, "AlignBottom" )
See Also: getFontMetric, getFontSize, getTextExtent, setDefaultFont, setFont, setHintFont, setPosition, setTextColor, wPrint, wPrintf, wPuts
To set the color of the graphics pen, use setPenColor.
Example:
-- draw text in red in TheWindow setTextColor( TheWindow, Red ) wPuts( TheWindow, "This text is in red" )
See Also: getFontMetric, getFontSize, getTextExtent, setDefaultFont, setFont, setHintFont, setPosition, setTextAlign, wPrint, wPrintf, wPuts
Timers are clocks that are maintained by Windows, and trigger events at a user-specified interval, measured in milliseconds.
The arguments are:
To respond to timer events, use onTime. You can have more than one timer per window. If your window is too busy to receive the timer messages, they will be discarded.
Example:
-- start a timer with id #12 in MyWindow -- it will trigger every 3 seconds. setTimer( MyWindow, 12, 3000 )
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, store
be an rgb atom, or a sequence in the form {r,g,b}.
The default color is {255,0,255} (a light pink).
For routines that create XPMs, this means that the color specified in the XPM as None are rendered using this color.
The transBlt routine uses this value to determine what color not to render on the destination.
This routine can also be used to make the transparent color of XPMs match the system color of buttons. This is useful for PictureButtons.
-- set transparent colors to match button face color setTransparentColor( getSysColor( COLOR_BTNFACE ) )
See Also: createXpm, createXpmFromBmpFile, xpmToEuBmp, xpmToPixmap
Example:
-- make TheButton invisible setVisible( TheButton, False )
Note: If object is a Window being made visible, it will trigger an onOpen event. However, if it is a Window being made invisible, it will not trigger any event. This should probably be corrected.
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setWindowBackColor, WinMain
Since 'warning' messages (triggered by warnErr) are only warnings and not fatal, it may be advantageous to suppress them in an application.
Example:
-- suppress warning messages setWarning( False )
See Also: abortErr, abs, findKey, playSound, shellExecute, warnErr
This is typically used to change the default color of a window. You can use getSysColor to get a default system color. This will trigger an onPaint event.
Example:
-- Set the window background color to bright white setWindowBackColor( MyWindow, BrightWhite )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, WinMain
This is a wrapper around the Win32 ShellExecute command.
See Also: abortErr, abs, findKey, playSound, setWarning, warnErr
A SimpleCombo is a combo box with no dropdown. The user can select from various values by using the cursor keys.
A SimpleCombo has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
A SortedCombo is a combination of an edit control and a list.
A SortedCombo has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
A SortedList contains a list of items, arranged in alphabetical order. To have an unsorted list, use the List control instead.
A SortedList has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Start a new document on the Printer. The job name is the name of the job as seen by the system.
Refer to Printer for details.
See Also: endDoc, endPage, getPrinter, releasePrinter, startPage
Refer to Printer for details.
See Also: endDoc, endPage, getPrinter, releasePrinter, startDoc
A StatusBar is a control placed at the bottom of the window that status messages can be written into. The status bar is implemented using the Win32 common control toolbar.
When the parent window is resized, Win32Lib automatically repositions the StatusBar.
Note that the status bar occupies space like any other control. To determine what portion of the window's client area is not occupied by the statusbar (and toolbar), use the getClientRect function.
A StatusBar has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Type conversion is automatic. For example, if an Lpsz field is used, the value is automatically converted from a sequence to a C-style string, and the address of that string is stored in the structure.
Note: Strings are allotted using allot_string(), and must be freed using free_string.
Example:
-- allocate RECT structure, and populate it atom rect-- allocate the structure rect = allocate_struct( SIZEOF_RECT )
-- store values into the structure store( rect, rectLeft, x1 ) store( rect, rectTop, y1 ) store( rect, rectRight, x2 ) store( rect, rectBottom, y2 )
See Also: address, allocate_struct, allot, allotted_size, fetch, free_strings, getDC, hi_word, killTimer, linkFunc, linkProc, lo_word, or_all, pack_word, peek_string, releaseDC, sendMessage, setTimer
A TabControl is a container control. It can have one or more TabItems. Selecting a TabItem in a TabControl activates it, and displays any controls that are associated with it.
Since the TabControl is a container, controls can be placed into it, just like placing them into a window. However, it becomes the coder's responsibility to show and hide various controls as different TabItems are selected. It is easier to associate controls with TabItems, since Win32Lib will automatically take care of those details.
The TabControl has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
A TabItem is a tab attached to the top of a TabControl. TabItems respond to being selected by triggering an onClick event.
Items can be automatically displayed in a TabControl by setting their owner to the TabItem instead of the TabControl. Win32Lib will automatically reparent controls with TabItems to the TabControl, and maintain a logical association between them. For example:
constant Win = create( Window, "Testing", 0, Default, Default, 100, 100, 0 ), Tabs = create( TabControl, "", Win, 10, 10, 80, 80, 0 ), Tab1 = create( TabItem, "Tab Number &1", Tabs, 0, 0, 0, 0, 0 ), Tab2 = create( TabItem, "Tab Number &2", Tabs, 0, 0, 0, 0, 0 ), Button1 = create( PushButton, "Button 1", Tab2, 10, 60, 80, 40, 0 )
In the example above, Button1 is created in Tabs (the parent of Tab2). When Tab2 is clicked, it will appear in Tabs at {10,60}. When Tab1 is clicked, it will disappear from Tabs.
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
Spaces are converted to White pixels; all other characters are converted to Black pixels.
Note: This routine should probably be deprecated, or at least renames.
Example:
-- create a bitmap, and display it atom hBitmap sequence image-- the image image = { " xxxxxx ", "x x", "x x x x", "x x", "x x x x", "x x x x", "x xxxx x", " xxxxxx ",
-- create the bitmap hBitmap = textToBitmap( image )
-- display the bitmap in TheWindow at {1,1} drawBitmap( theWindow, hBitmap, 1, 1 )
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, transBlt
A ToggleButton is a PushButton that behaves like a CheckBox - clicking it toggles it down, clicking again toggles it back up. It is typically used in a ToolBar.
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, TogglePicture, ToolBar, TriCheckBox, VScroll, Window
A TogglePicture is a combination of a ToggleButton and a PictureButton. The graphic can be specified by passing the name or address of a bitmap in the flags parameter, or with setBitmap, setIcon or setPixmap.
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, ToolBar, TriCheckBox, VScroll, Window
A ToolBar is a container at the top of a window that can hold other controls - typically PushButtons or ToggleButtons. Toolbars are implemented using the Win32 common control toolbar.
When the parent window is resized, Win32Lib automatically repositions the ToolBar.
Note that the toolbar occupies space like any other control. To determine what portion of the window's client area is not occupied by the toolbar (and statusbar), use the getClientRect function.
A ToolBar has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, TriCheckBox, VScroll, Window
TransBlt is typically used for displaying non-rectangular bitmaps - sprites. It is a computationally expensive operation; if there is no transparency in your image, you should use copyBlt or bitBlt instead.
By default, transBlt assumes that the color {255,0,255} is to be treated as transparent. To change the transparent color, use setTransparentColor.
The arguments are:
Note: At the moment, the coordinates are zero relative; this will be changed in later releases. Example:
-- draw a bitmap using transparency atom hDIB sequence extent-- get the size of TheWindow extent = getExtent( TheWindow )
-- load the bitmap hDib = loadBitmapFromFile( "shuttle.bmp" )
-- treat the color BrightWhite as transparent setTransparentColor( BrightWhite )
-- copy multiple images to TheWindow for i = 1 to 20 do transBlt( TheWindow, -- destination rand( extent[1] ), -- x position rand( extent[2] ), -- y position hDib ) -- image to copy end for
See Also: bitBlt, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRectangle, getPixel, loadBitmapFromFile, repaintRect, repaintWindow, rgb, setBackColor, setPenBkMode, setPenColor, setPenROP2, setPenStyle, setPenWidth, setPixel, textToBitmap
A TriCheckBox is similar to a CheckBox, but it has three states: on, off, or dim.
A TriCheckBox has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, VScroll, Window
Example:
-- undo last edit in TheTextEdit undo( TheTextEdit )
See Also: clear, copy, cut, paste
A VScroll has the following attributes:
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, Window
Example:
warnErr( "Bad data. Abort program?" )
See Also: abortErr, abs, findKey, playSound, setWarning, shellExecute
See Also: Bitmap, CheckBox, Combo, CText, DefPushButton, DropDownList, EditText, Group, HScroll, HTrackBar, HTrackBar, Icon, List, LText, Menu, MenuItem, MleEdit, PictureButton, Pixmap, Popup, Printer, PushButton, Radio, RText, Screen, setSize, SimpleCombo, SortedCombo, SortedList, StatusBar, TabControl, TabItem, ToggleButton, TogglePicture, ToolBar, TriCheckBox, VScroll
This is the main processing loop for Win32Lib. Call WinMain after all the controls have been declared to run the event loop.
The main window is set to window. When window is closed, the application is shut down.
The style flag is one of the following:
The WinMain function will trigger an onOpen event.
For example:
-- set TheWindow as main window, open normally WinMain( MyWindow, Normal )
See Also: closeWindow, create, getClientPoint, getClientRect, getExtent, getMousePos, getNumber, getSize, getSysColor, getText, isChecked, isEnabled, isScreenPointIn, isVisible, moveWindow, openWindow, popup, setBitmap, setCheck, setEnable, setFocus, setHint, setIcon, setPixmap, setText, setVisible, setWindowBackColor
window specifies the Window to receive the data.
For example:
-- dump s to the window wPrint( MyWindow, s )
See Also: getFontMetric, getFontSize, getTextExtent, setDefaultFont, setFont, setHintFont, setPosition, setTextAlign, setTextColor, wPrintf, wPuts
window specifies the Window to receive the text.
For example:
-- show value of a wPrintf( MyWindow, "the value of a is %d", {a} )
See Also: getFontMetric, getFontSize, getTextExtent, setDefaultFont, setFont, setHintFont, setPosition, setTextAlign, setTextColor, wPrint, wPuts
The window parameter determines what Window will be written to.
Example:
-- put text in a window wPuts( MyWindow, "Hello, World!" )
See Also: getFontMetric, getFontSize, getTextExtent, setDefaultFont, setFont, setHintFont, setPosition, setTextAlign, setTextColor, wPrint, wPrintf
The error codes are:
See Also: createXpm, createXpmFromBmpFile, setTransparentColor, xpmToPixmap
The error codes are:
See Also: createXpm, createXpmFromBmpFile, setTransparentColor, xpmToEuBmp