tinEWG - A simple wrapper for the Win32 Api

Preample

This documentation is far from being completed or correct!

The name tinEWG means "this is not EuWinGui". tinEWG was born as an extension for EuWinGui, as i tried to improve Designer for EuWinGui.
tinEWG is still under construction and I'am really shure it will be forever. I use it for my own small projects and expand it as i need it myself.
tinEWG is not a replacement for the fullfeatured frameworks like Win32lib or EuGTK or wxWindows, but it is handy for simple Prgrams that don't need a complex GUI.
tinewg is based on ideas of Andrea Cini and his EuWinGui library. I use his documentation of EuWinGui as a starting point for the documentation of tinewg and he kindly gave me the permission to use his work.

Hello Andreas
sure you can use the documentation as a starting base for your project. Thanks for keeping reference to my work.
Best wishes and good luck|

Andrea

License

As i think it is very Important to have a clear License for any kind of Software
i hereby put this Software under the MIT license.

Copyright (c) <2013> <Andreas Wagner andi@indonesianet.de>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Basic usage

Also tinEWG is mostly compatible to EuWinGui, there are some differences
A simple tinEWG program may look like this

First

include tinewg.exw
Window ("EuWinGUI - The First Program",100,100,290,95) 
constant button1=Control(Button,"Info",5,10,270,50) 
SetIcon("T.ICO") 
 
procedure clickbutton() 
	InfoMsg("Programmed in Euphoria with the EuWinGUI Library!!","EuWinGUI")	 
end procedure 
 
SetHandler (button1,Click,routine_id("clickbutton")) 
 
WinMain () 
  

But for sure, you can also write your code in the default EuWinGui style

include tinewg.exw
  atom button1  

   procedure EventLoop() 
      while True do                               
           WaitEvent()                    
           if Event = Click then 
              if EventOwner = button1 then 
               InfoMsg("Programmed in Euphoria with the EuWinGUI Library!!","EuWinGUI") 
               end if 
           end if 
       end while 
   end procedure 
 
   procedure Main() 
       Window("EuWinGUI - The First Program",100,100,290,95) 
       button1 = Control(Button,"Info",5,10,270,50) 
       SetIcon("T.ICO") 
       EventLoop() 
       CloseApp(0) 
   end procedure 
 
   Main() 

Or even mix both of the styles (sometimes you have to do this)

include tinewg.exw
Window("EuWinGUI - The First Program",100,100,290,95) 
constant button1 = Control(Button,"Info",5,10,270,50) 
   
procedure clickbutton() 
	InfoMsg("Programmed in Euphoria with the EuWinGUI Library!!","EuWinGUI")	 
end procedure 
 
SetHandler (button1,Click,routine_id("clickbutton")) 
 
procedure EventLoop() 
   while WaitEvent () do                                             
       ProcessHandlers () 
    end while 
end procedure 
 
procedure Main() 
    SetIcon("T.ICO") 
    EventLoop() 
    CloseApp(0) 
end procedure 
 
Main() 

Global Variables


TINVERSION

include tinewg.exw
public constant TINVERSION

Just a number, can be used to make sure that a specific Version is used, or the Version is not to old for your Software. As of this writing the actual number is 78(hex) I think a real Version 1.0.0 will follow the number FF(hex), if ever.

PosRect

include tinewg.exw
public sequence PosRect

LPRECT

include tinewg.exw
public sequence LPRECT

True

include tinewg.exw
public constant True

False

include tinewg.exw
public constant False

Null

include tinewg.exw
public constant Null

Void

include tinewg.exw
public object Void

CloseEventEnabled

include tinewg.exw
public integer CloseEventEnabled

initially set to False; if set to True before running the event loop allows the generation of a Close event if the user clicks on a window's default close button; process this Event to perform some actions before the application is finished (and remember to finish it with a call to the CloseApp() procedure to free the resources created by EuWinGUI) or to make a Dialog control invisible in a multiple-windows application

See also:

Event Close,CloseApp

UseTransparentPics

include tinewg.exw
public integer UseTransparentPics

(initially set to False; if set to True before using the SetPic() procedure, tells Windows to use the color of the leftmost/topmost pixel of a bitmap loaded from a file as "transparent color": all the occurences of that color inside the image are automatically replaced with the color of the window's surface, so that is possible to load into Picture/ClickPicture/PictureButton controls images with a "transparent" background); Note that this flag has no effect if the bitmap has been created in memory using NewMB()

WinOnTop

include tinewg.exw
public integer WinOnTop

(initially set to False; set this variable to True before using the Window() procedure if you need to create an always-on-top Main Window)

ShowFlag

include tinewg.exw
public integer ShowFlag

initially set to True; by default, the Main Window and all controls are shown immediately after their creation. By setting this variable to False BEFORE the creation of the main window or any control it is possible to create them initially hidden. To make them visible it will be necessary to call the SetVisible() EuWinGUI procedure. For example if an application uses many controls the interface's creation could take some time and cause some noisy "flickerings". By setting this variable to False BEFORE using the Window() procedure and resetting it to True BEFORE the creation of the controls, the main window is not shown after its creation and remains hidden until a call to SetVisible(WinHwnd,True) make it visible. This way it is possible to add all the needed controls to the window while it is still hidden and then make it visible only after the interface is completely created and all the settings have been made (i.e. before entering the event loop); this way, no flickerings occur

See also:

SetVisible,AnimateWindow,ShowWindow

AutoResize

include tinewg.exw
public integer AutoResize

UserTrap

include tinewg.exw
public integer UserTrap

GameLoop

include tinewg.exw
public atom GameLoop

WinHwnd

include tinewg.exw
public atom WinHwnd

stores the handle of the Main Window, after it has been created using the Window() procedure, for use with any EuWinGUI function which need a control's handle to work

Event

include tinewg.exw
public atom Event

stores the last Event type recorded after returning from the WaitEvent() function

EventOwner

include tinewg.exw
public atom EventOwner

stores the handle of the control to which the last Event recorded after returning from the WaitEvent() function belongs

EventItem

include tinewg.exw
public atom EventItem

stores an additional value associated with certain Event types, after returning from the WaitEvent() funtion; for instance stores the char code of the key pressed, once a Key Event has occurred

PictureHandle

include tinewg.exw
public atom PictureHandle

WindowType

include tinewg.exw
public atom WindowType

initially set to NoMaxWin; use this variable to set the appearance (style) of the Main Window or of a Dialog control before using the Window() procedure or the Control(Dialog,...) function.

Note:
  1. windows created with either NoTitleWin or NoBorderWin styles, lacking the titlebar, cannot be moved on the screen by the program's User (but it is still possible to move them at run-time)
  2. program which uses a Main Window created with one the latter styles or the NoSysWin one, lacking the default close ("X") button, MUST provide an alternative way to close the program.
Six different styles are available:

NoMaxWin

include tinewg.exw
public constant NoMaxWin

default; window with titlebar, minimize+close buttons and solid frame

NoMaxMinWin

include tinewg.exw
public constant NoMaxMinWin

window with titlebar, close button only and solid frame

NoSysWin

include tinewg.exw
public constant NoSysWin

window with titlebar, no active buttons and solid frame

NoTitleWin

include tinewg.exw
public constant NoTitleWin

window without titlebar and solid frame

NoBorderWin

include tinewg.exw
public constant NoBorderWin

flat window without titlebar and border

StandardWin

include tinewg.exw
public constant StandardWin

Resizeable Window with titlebar

MouseX

include tinewg.exw
public atom MouseX

(store the pointer's coordinates, relative to the upper-left corner of the control's client area, after the occurrence of a recognized mouse event (i.e. Click, Release, RClick, RRelease, Move if the issuing control is the Main Window or a Dialog, or the Move event only if the control is another type) Note: The Move events generated while one of the mouse buttons is pressed (as well as the Release and RRelease events) and recognized by the Main Window or by a Dialog can be issued when the mouse pointer is phisically out of the owner window's boundaries. Since the values stored into MouseX/Y can range from 0 to 65535 (e.g. no negative values are returned by Windows) and are relative to the upper-left corner of the window's client area, it is not directly possible to know if the mouse has generated the events inside or outside the window's boundaries. However it is possible to know that with a simple check: if MouseX (MouseY) is bigger than the width (height) of the owner's window, it means that the event was surely generated while the mouse was outside the right (bottom) boundary of the window, BUT if MouseX (MouseY) is ALSO greater than the screen's width (height) it means that the event was generated while the mouse pointer was outside the left (top) boundary of the window's client area. Practically, if MouseX (MouseY) returns a value of 65535, it means that the event was generated when the pointer was located 1 pixel left (up) of the beginning of the window's client area, 65534 means it was 2 pixels left (top) and so on.)

Ticks

include tinewg.exw
public atom Ticks

FN_DEFAULT

include tinewg.exw
public atom FN_DEFAULT

FN_FIXED

include tinewg.exw
public atom FN_FIXED

The tinewg Events

event_names

include tinewg.exw
public constant event_names

Click

include tinewg.exw
public constant Click
An Event:

generated by leftclicking a Control/Window
recognized/generated by: ALL windows and controls BUT Group,Picture,Framed/Text,Label
when: one of the specified controls is clicked with the left mouse button; if the control is a window, the Event is generated when the mouse button is pressed, otherwise it is generated when the button is released

Move

include tinewg.exw
public constant Move
An Event:

recognized/generated by: ALL windows and controls BUT Group,Picture,Framed/Text,Label
when: the mouse pointer is moved over the client area of one of the specified controls not covered by others

RClick

include tinewg.exw
public constant RClick
An Event:

recognized/generated by: ALL windows and controls BUT Group,Picture,Framed/Text,Label
when: the right mouse button is pressed over a window. Note: by handling this Event it is possible to incidentally break the normal handling procedure of the same event (if any) made by Windows. For example, by intercepting the RClick Event of an Edit field it is possible to prevent the default Cut/Copy/Paste Windows popup menu to be shown. For this reason, particular care must be made if intercepting this Event while the owner control already has an associated default Windows action to perform

Time

include tinewg.exw
public constant Time
An Event:

Close

include tinewg.exw
public constant Close
An Event:

recognized/generated by: Main Window,Dialog when: CloseEventEnabled is set to True, and the user clicks on the window's default close ("X") button

See also:

CloseEventEnabled

HotKey

include tinewg.exw
public constant HotKey
An Event:

Restore

include tinewg.exw
public constant Restore
An Event:

Key

include tinewg.exw
public constant Key
An Event:

DClick

include tinewg.exw
public constant DClick
An Event:

Release

include tinewg.exw
public constant Release
An Event:

recognized/generated by: Main Window,Dialog when: the left mouse button is released after it was pressed over a window

RRelease

include tinewg.exw
public constant RRelease
An Event:

PosChanged

include tinewg.exw
public constant PosChanged
An Event:

CurChange

include tinewg.exw
public constant CurChange
An Event:

Paint

include tinewg.exw
public constant Paint
An Event:

Menu

include tinewg.exw
public constant Menu
An Event:

Default

include tinewg.exw
public constant Default
All Events:

Ipc

include tinewg.exw
public constant Ipc
An Event:

Mci

include tinewg.exw
public constant Mci
An Event:

ReSize

include tinewg.exw
public constant ReSize
An Event:

The tinewg Controls

Button

include tinewg.exw
public constant Button

Simple button with a caption

atom button1=Control(Button,"Button",0,0,80,30)

Button

PictureButton

include tinewg.exw
public constant PictureButton

Button showing a custom BMP picture instead of a caption

Edit

include tinewg.exw
public constant Edit

Editable field with horizontal scrollable text

SimEdit

include tinewg.exw
public constant SimEdit

Simple editable field with fixed width text

MultiEdit

include tinewg.exw
public constant MultiEdit

Multiline editable field with horizontal scrollable text

SimMultiEdit

include tinewg.exw
public constant SimMultiEdit

Simple multiline editable field with fixed width text and word wrapping

List

include tinewg.exw
public constant List

Simple list box

atom lbox=Control(List,"",0,0,80,80)
ListAdd(lbox,"ListItem 1") 
ListAdd(lbox,"ListItem 2") 
[...] 
ListAdd(lbox,"ListItem n") 

Listbox

SortedList

include tinewg.exw
public constant SortedList

Sorted list box. The Items are automaticlly sorted in this ListBox.

RichEdit

include tinewg.exw
public atom RichEdit

ToolTip

include tinewg.exw
public atom ToolTip

CR_WE

include tinewg.exw
public constant CR_WE

CR_NS

include tinewg.exw
public constant CR_NS

CR_SIZE

include tinewg.exw
public constant CR_SIZE

CR_VARROW

include tinewg.exw
public constant CR_VARROW

CR_WAIT

include tinewg.exw
public constant CR_WAIT

CR_NULL

include tinewg.exw
public constant CR_NULL

CR_HELP

include tinewg.exw
public constant CR_HELP

X_DIM

include tinewg.exw
public constant X_DIM

Y_DIM

include tinewg.exw
public constant Y_DIM

KEY_ENTER

include tinewg.exw
public constant KEY_ENTER

KEY_BACKSPACE

include tinewg.exw
public constant KEY_BACKSPACE

KEY_ESCAPE

include tinewg.exw
public constant KEY_ESCAPE

KEY_DOWN

include tinewg.exw
public constant KEY_DOWN

KEY_UP

include tinewg.exw
public constant KEY_UP

KEY_LEFT

include tinewg.exw
public constant KEY_LEFT

KEY_RIGHT

include tinewg.exw
public constant KEY_RIGHT

KEY_CLEAR

include tinewg.exw
public constant KEY_CLEAR

KEY_PAUSE

include tinewg.exw
public constant KEY_PAUSE

KEY_CAPSLOCK

include tinewg.exw
public constant KEY_CAPSLOCK

KEY_PGUP

include tinewg.exw
public constant KEY_PGUP

KEY_PGDN

include tinewg.exw
public constant KEY_PGDN

KEY_END

include tinewg.exw
public constant KEY_END

KEY_HOME

include tinewg.exw
public constant KEY_HOME

KEY_INS

include tinewg.exw
public constant KEY_INS

KEY_DEL

include tinewg.exw
public constant KEY_DEL

KEY_FUNC01

include tinewg.exw
public constant KEY_FUNC01

Save

include tinewg.exw
public constant Save

Open

include tinewg.exw
public constant Open

CL_WHITE

include tinewg.exw
public constant CL_WHITE

CL_GRAY

include tinewg.exw
public constant CL_GRAY

CL_DKGRAY

include tinewg.exw
public constant CL_DKGRAY

CL_BLACK

include tinewg.exw
public constant CL_BLACK

CL_YELLOW

include tinewg.exw
public constant CL_YELLOW

CL_DKYELLOW

include tinewg.exw
public constant CL_DKYELLOW

CL_RED

include tinewg.exw
public constant CL_RED

CL_DKRED

include tinewg.exw
public constant CL_DKRED

CL_GREEN

include tinewg.exw
public constant CL_GREEN

CL_DKGREEN

include tinewg.exw
public constant CL_DKGREEN

CL_CYAN

include tinewg.exw
public constant CL_CYAN

CL_DKCYAN

include tinewg.exw
public constant CL_DKCYAN

CL_BLUE

include tinewg.exw
public constant CL_BLUE

CL_DKBLUE

include tinewg.exw
public constant CL_DKBLUE

CL_PURPLE

include tinewg.exw
public constant CL_PURPLE

CL_DKPURPLE

include tinewg.exw
public constant CL_DKPURPLE

CL_DEFAULT

include tinewg.exw
public constant CL_DEFAULT

PressedKey

include tinewg.exw
public atom PressedKey

EraseBkg

include tinewg.exw
public atom EraseBkg

TrappedMsg

include tinewg.exw
public sequence TrappedMsg

MessageBoxReturnValue

include tinewg.exw
public atom MessageBoxReturnValue

WinBackGround

include tinewg.exw
public atom WinBackGround

ParentWnd

include tinewg.exw
public atom ParentWnd

SpecialMode

include tinewg.exw
public atom SpecialMode

DefaultPrinter

include tinewg.exw
public sequence DefaultPrinter

Designer

include tinewg.exw
public constant Designer

NoDesigner

include tinewg.exw
public constant NoDesigner

gDesigner

include tinewg.exw
public constant gDesigner

ctlEvent

include tinewg.exw
public atom ctlEvent

ctlEventOwner

include tinewg.exw
public atom ctlEventOwner

ctlEventItem

include tinewg.exw
public atom ctlEventItem

BadSig:

include tinewg.exw
public bool NoVisualStyles

BadSig:

include tinewg.exw
WinBackGround

Sets the Color of the Window and Dialog Backgrounds, must be between 0 to 31 must be set before the main Window is created You can also set WinBackGround to any other Brush. e.g. WinBackGround=c_func(myCreateSolidBrush,{#00F0F0F0})

BadSig:

include tinewg.exw
public bool DialogIsChild

Set the creation behavior of Dialog Windows. Dialog as Child is the standardway in the original EWG

BadSig:

include tinewg.exw
public bool DialogIsRealChild

tinEWGApp

include tinewg.exw
public sequence tinEWGApp

The Classname of the Main Window. You can change this as you like it

rs_mode_non

include tinewg.exw
public constant rs_mode_non

LoWord

include tinewg.exw
public function LoWord(atom dword)

HiWord

include tinewg.exw
public function HiWord(atom dword)

SetRtl

include tinewg.exw
public procedure SetRtl()

Multimedia functions


MCI_Alias

include tinewg.exw
public constant MCI_Alias

ShortFileName

include tinewg.exw
public function ShortFileName(sequence filename)

MCI_SendString

include tinewg.exw
public function MCI_SendString(sequence command, object answer = 0, atom size = 0,
        atom handle = WinHwnd)

MCI_Stop

include tinewg.exw
public function MCI_Stop(flatsequence device = MCI_Alias)

MCI_Pause

include tinewg.exw
public function MCI_Pause(flatsequence device = MCI_Alias)

MCI_Play

include tinewg.exw
public function MCI_Play(flatsequence device = MCI_Alias)

MCI_Close

include tinewg.exw
public function MCI_Close(flatsequence device = MCI_Alias)

MCI_Set

include tinewg.exw
public function MCI_Set(flatsequence command, sequence device = MCI_Alias)

MCI_Get

include tinewg.exw
public function MCI_Get(flatsequence command, sequence device = MCI_Alias)

MCI_Volume

include tinewg.exw
public function MCI_Volume(flatsequence percent, sequence device = MCI_Alias)

MCI_Seek

include tinewg.exw
public function MCI_Seek(flatsequence pos, sequence device = MCI_Alias)

MCI_Open

include tinewg.exw
public function MCI_Open(sequence filename, sequence device = "auto",
        sequence alias = MCI_Alias)

PlaySnd

include tinewg.exw
public procedure PlaySnd(sequence filename)

Plays a wave (.WAV) sound. To stop a playing wave sound, use StopSnd() (see below). By starting playing a new sound while another is still in execution will cause the old one to stop and be replaced by the newer one. Note that Windows allows playing wave sound only if they can fit into the system's physical memory, so it is not recommended to play extremely large files. Note also that if the wave file passed as argument doesn't exist, the default Windows "error" sound is played. [sequence wavfile] is the complete pathname of the wave (.WAV) file to play
This function is not compatible with the MCI_* functions!(it does not Play a Sound opend with MCI_Open() etc.)

See also:

StopSnd

StopSnd

include tinewg.exw
public procedure StopSnd()

Stops an actually playing Wavefile started with PlaySnd.
This function is not compatible with the MCI_* functions! (It does not stop a Sound startet with MCI_Play() etc.)

See also:

PlaySnd


Transparent Windows


SetOpacity

include tinewg.exw
public procedure SetOpacity(atom handle = WinHwnd, atom opag = 50)

SetOpacityRGB

include tinewg.exw
public procedure SetOpacityRGB(atom handle = WinHwnd, atom opag = 0)

IPC for tinEWG

A very simple attempt for IPC(Inter Program Communication)


IPC_FRIEND

include tinewg.exw
public atom IPC_FRIEND

After a IPC event is received, this stores the Windowhandle of the sending Window you can use this handle to send Data to this Window.

See also:

Event IPC

IPC_RecString

include tinewg.exw
public function IPC_RecString()

IPC_Ack

include tinewg.exw
public procedure IPC_Ack(atom friend = IPC_FRIEND)

IPC_SendString

include tinewg.exw
public procedure IPC_SendString(object target, sequence data)

GetDesktopWindow

include tinewg.exw
public function GetDesktopWindow()

CallWindowProc

include tinewg.exw
public function CallWindowProc(atom wndproc, atom hwnd, atom msg, atom wParam, atom lParam)

SetWindowLong

include tinewg.exw
public function SetWindowLong(atom hwnd, atom index, atom newlong)

GetWindowLong

include tinewg.exw
public function GetWindowLong(atom hwnd, atom index)

IsIconic

include tinewg.exw
public function IsIconic(atom handle)

Determines whether the specified window is minimized (iconic).
f the window is iconic, the return value is nonzero.
If the window is not iconic, the return value is zero.

IsZoomed

include tinewg.exw
public function IsZoomed(atom handle)

Determines whether a window is maximized.
If the window is zoomed, the return value is nonzero.
If the window is not zoomed, the return value is zero.

IsWindowVisible

include tinewg.exw
public function IsWindowVisible(atom handle)

Determines the visibility state of the specified window.
If the specified window, its parent window, its parent's parent window, and so forth, have the WS_VISIBLE style, the return value is nonzero. Otherwise, the return value is zero.
This does not mean you can see the Window. It just means that the Window has the WS_VISIBLE style set
It is possible that this Window is hidden by other windows.

See also:

ShowWindow,SetVisible

CreateBrush

include tinewg.exw
public function CreateBrush(atom color)

EnumWindows

include tinewg.exw
public function EnumWindows()

CopyImageToClipboard

include tinewg.exw
public procedure CopyImageToClipboard(atom bitmaphandle)

CopyTextToClipboard

include tinewg.exw
public procedure CopyTextToClipboard(sequence text)

CreateMenu

include tinewg.exw
public function CreateMenu()

CreatePopupMenu

include tinewg.exw
public function CreatePopupMenu()

DrawMenuBar

include tinewg.exw
public function DrawMenuBar(atom handle)

TrackPopupMenu

include tinewg.exw
public function TrackPopupMenu(atom menuhandle, atom xpos, atom ypos, atom handle,
        atom flag = False)

ConnectMenu

include tinewg.exw
public function ConnectMenu(atom handle, atom menuhandle)

DestroyMenu

include tinewg.exw
public function DestroyMenu(atom handle)

AppendTextItem

include tinewg.exw
public procedure AppendTextItem(atom menuhandle, atom id, object itemtext)

AppendSeparator

include tinewg.exw
public function AppendSeparator(atom menuhandle)

AppendPopup

include tinewg.exw
public function AppendPopup(atom menuhandle, atom popuphandle, object itemtext)

EnableItem

include tinewg.exw
public procedure EnableItem(atom menuhandle, object id, atom flag)

RedrawWindow

include tinewg.exw
public procedure RedrawWindow(atom handle)

AnimateWindow

include tinewg.exw
public function AnimateWindow(atom handle, atom time1, atom ShowFlags)

SetTimer

include tinewg.exw
public function SetTimer(atom ident, atom time1, atom tproc)

keybd_event

include tinewg.exw
public procedure keybd_event(integer vk, integer scan, integer extended)

Extentedkey = 1 ;keyup = 2 ;keydown = 0 : or_all,scan should be zero

showDesktop

include tinewg.exw
public procedure showDesktop()

Press left Windowskey + d

KillTimer

include tinewg.exw
public function KillTimer(atom ident)

Sleep

include tinewg.exw
public procedure Sleep(atom milliseconds)

Win32api Sleep function, same like the Euphoria sleep() just call it with milliseconds instead of seconds

ShowWindow

include tinewg.exw
public procedure ShowWindow(atom handle, atom style)

Win32api, style is one of the SW_ constants (like SW_SHOWNORMAL etc.) shows or hides a control or window

MessageBox

include tinewg.exw
public function MessageBox(atom hwnd, sequence text, sequence title, sequence style)

GetSystemMetrics

include tinewg.exw
public function GetSystemMetrics(atom index)

FindWindow

include tinewg.exw
public function FindWindow(object name, object class = 0)

SetWindowTheme

include tinewg.exw
public procedure SetWindowTheme(atom handle, object ParamA = 0, object ParamB = 0)

This is (right now) only useful for switching Themes off!
Call it with anything for paramA and paramB switches the Theme off

SendMessage

include tinewg.exw
public function SendMessage(atom hwnd, atom msg, atom wparam, atom lparam)

PostMessage

include tinewg.exw
public function PostMessage(atom hwnd, atom msg, atom wparam, atom lparam)

SetFocus

include tinewg.exw
public function SetFocus(atom handle)

LoadIcon

include tinewg.exw
public function LoadIcon(atom hinstance, object string)

LoadImage

include tinewg.exw
public function LoadImage(atom myinstance, object name, atom ptype, atom width, atom height,
        atom flags)

SetClientRect

include tinewg.exw
public procedure SetClientRect(atom handle, atom xsize, atom ysize)

Resizes a Windows Clientarea to the desired size. The Windowsize will be expanded fit the desired size of the clientarea. SetClientRect(WinHWnd,640,480) will expand an allready exsisting Window, so the Clientarea has a size of 640x480

GetClientRect

include tinewg.exw
public function GetClientRect(atom hwnd)

GetWindowRect

include tinewg.exw
public function GetWindowRect(atom hwnd)

GetChildFromPoint

include tinewg.exw
public function GetChildFromPoint(atom handle, atom x, atom y)

sb_SetParts

include tinewg.exw
public procedure sb_SetParts(atom hwnd, sequence coord)

sb_SetText

include tinewg.exw
public procedure sb_SetText(atom hwnd, sequence text, atom part = 0)

sb_SetIcon

include tinewg.exw
public procedure sb_SetIcon(atom hwnd, atom handle, atom part = 0)

ColorSelection

include tinewg.exw
public procedure ColorSelection(atom handle, atom colour)

SetTextColor

include tinewg.exw
public procedure SetTextColor(atom handle, atom colour)

SetSelection

include tinewg.exw
public procedure SetSelection(atom handle, integer start = 0, integer ende =(- 1))

HideSelection

include tinewg.exw
public procedure HideSelection(atom handle, integer hide = True)

ReplaceSelection

include tinewg.exw
public procedure ReplaceSelection(atom handle, flatsequence text)

GetSelection

include tinewg.exw
public function GetSelection(atom handle)

GetCharFromPos

include tinewg.exw
public function GetCharFromPos(atom handle, integer xpos, integer ypos)

Gets information about the character closest to a specified point in the client area of an edit control. Returns the zero-based index of the char.

LineFromChar

include tinewg.exw
public function LineFromChar(atom handle, integer char = - 1)

Gets the index of the line that contains the specified character index in a multiline edit control. A character index is the zero-based index of the character from the beginning of the edit control. (-1) indicates that the current line will be returned Return value The return value is the zero-based line number of the line containing the character index specified by wParam.

LineIndex

include tinewg.exw
public function LineIndex(atom handle, integer line = - 1)

Gets the character index of the first character of a specified line in a multiline edit control. A character index is the zero-based index of the character from the beginning of the edit control. (-1) specifies the current lineReturn value The return value is the character index of the line specified in the wParam parameter, or it is –1 if the specified line number is greater than the number of lines in the edit control.

LineLength

include tinewg.exw
public function LineLength(atom handle, atom char = - 1)

Retrieves the length, in characters, of a line in an edit control. You can send this message to either an edit control or a rich edit control.Return value For multiline edit controls, the return value is the length, in TCHARs, of the line specified by the wParam parameter. For ANSI text, this is the number of bytes; It does not include the carriage-return character at the end of the line. For single-line edit controls, the return value is the length, in TCHARs, of the text in the edit control.

FindText

include tinewg.exw
public function FindText(atom handle, sequence text, integer start = 0, integer ende = - 1,
        atom wholeword = 1)

edt_GetLine

include tinewg.exw
public function edt_GetLine(atom handle, atom linenumber)

Get a line of text from an edit or richedit control

edt_GetLineCount

include tinewg.exw
public function edt_GetLineCount(atom handle)

Get linecount from an edit or richedit control

edt_GetActLine

include tinewg.exw
public function edt_GetActLine(atom handle)

Get first visible line in an edit or richedit control

edt_GotoLine

include tinewg.exw
public procedure edt_GotoLine(atom handle, atom line)

Scroll to a specific line in a edit or richedit control

tt_AddTool

include tinewg.exw
public procedure tt_AddTool(atom tip, atom handle, sequence text, atom width = - 1)

Add a ToolTip, if width is set to -1 then a single line tooltip will be created

AddToolTip

include tinewg.exw
public procedure AddToolTip(atom handle, sequence text, atom width = - 1)

SetIconToolTip

include tinewg.exw
public procedure SetIconToolTip(atom handle, atom icon = 5, sequence text = "Info")

SetGroup

include tinewg.exw
public procedure SetGroup(object handle, atom group)

ctlSetResize

include tinewg.exw
public procedure ctlSetResize(atom handle, atom modus)

Sets the mode for resizing for a control
new Function for controlling the AutoResizing of controls
avaible modes are:
rs_mode_full does a full resize of the control (you may also use True)
rs_mode_non does not any resizing on the control (you may also use False)
rs_mode_pos does only change the start position of the control
rs_mode_size does only change the size of the control

GetTrappedMessage

include tinewg.exw
public function GetTrappedMessage()

This low-level function is reserved to Programmers who already have a good knowledge of Windows low-level programming and can be safely ignored by casual Users of the library. It resets the UserTrap variable to False and returns a 4-element sequence containing the data (hwnd,message,wParam,lParam) stored and associated with the latest "trapped" Windows message (see the TrapMessage() procedure below) so that the message itself can be handled appropriately into the application's EventLoop() procedure and processed as needed as if it was one of the default EuWinGUI Events.

Note:

This is only here to stay compatible to EuWinGui.

See also:

SetWindowLong,GetWindowLong,TrapMessage

TrapMessage

include tinewg.exw
public procedure TrapMessage(atom msg)

SetDrawingProc

include tinewg.exw
public procedure SetDrawingProc(atom control, atom id)

NewFont

include tinewg.exw
public function NewFont(sequence fontname, integer fontsize, atom bold, atom italic,
        atom underlined)

Creates and loads a new font type for use on EuWinGUI controls and drawing procedures, according to the given argument values and returning its handle. The SetFont() and SetDrawingFont() procedures can use the returned handle to set the newly created font on any control or to set it for use with the following calls to the DrawString() drawing procedure. "fontname" is the name of the font to use, fontsize is the dimension of the new font to create and bold, italic and underlined are self-descriptive style flags to set to True whenever the new font must be created with any of those styles "on".

Notes:

the Operating System will create a font in any case, but IF the specified font, size, or styles are not ALL available at the same time on the system where the application is run, the font type will be created just according to the closest font, size, and styles available. For this reason, it is perfectly possible that a font is created using even a different fontname from the one you specified if, for instance, the fontname you specified is present into the system where your application is run but the size or style attributes you need are not available. Be sure that the font and attributes you want to use are available on the systems where your application is run! Note also that Windows could prevent to set some font types (generally the most "elaborated" ones) on certain control types if they were succesfully created.

Example:
times1 = NewFont("Times New Roman", 16, True,False,False)
   SetFont(Button01,times1) 

will create a new bold font type using "Times New Roman" as base font type and 16 point size and then will use it on "Button01" control. The font will be created exactly with the specified charachteristics, only if it is present on the system where the program is run.
[sequence fontname] is the name of the font to use
[integer fontsize] is the size of the font to create
[atom bold,italic,underlined] flags to set to True or False according to the style needed for the new font

See also:

ChooseFont,SetFont

ChooseFont

include tinewg.exw
public function ChooseFont()

Displays the standard System DialogBox for choosing a Font. ChooseFont returns a 5-Element sequence. You can pass this elements to NewFont() to create the font. If the call fails (the user has closed the Dialog without choosing a font) then all elements of the sequence are 0. It's up to you to catch this situation.

Example:
include tinewg.exw

sequence f,rect 
atom textfont 
Window("ChooseFont Demo") 
atom b1=Control(Button,"ChooseFont",0,0,80,30) 
rect=GetClientRect(WinHwnd) 
atom text=Control(Label,"",0,30,rect[3],rect[4]-30) 

procedure b1click() 
f=ChooseFont() 
if sequence(f[1]) then  
   textfont=NewFont(f[1],f[2],f[3],f[4],f[5]) 
   SetFont(text,textfont)  
else 
   SetFont(text,FN_DEFAULT) 
end if 
SetText(text,"Hallo Welt") 
end procedure 
SetHandler(b1,Click,routine_id("b1click")) 

WinMain() 
See also:

NewFont,SetFont

NewMB

include tinewg.exw
public function NewMB(atom width, atom height)

Creates a new Memory Bitmap with the specified dimensions, filled with the color specified by the last call to the SetPenColor() procedure, and returns its handle. A Memory Bitmap can be used exactly as a bitmap loaded from a file. It can be loaded onto a Picture-class control using the SetPic() procedure.

[atom width, heigth] set the width and heigth of the new Memory Bitmap

SetPenCol

include tinewg.exw
public procedure SetPenCol(atom colorpen)

This extends EuWinGui so you can only set the Pen(for Borders and Lines)

SetPenCol(CL_RED)
SetBrushCol(CL_RED) 

Is equal to

SetPenColor(CL_RED)

SetBrushCol

include tinewg.exw
public procedure SetBrushCol(atom colorpen)

This extends EuWinGui so you can only set the Brush(for filling)

SetPenCol(CL_RED)
SetBrushCol(CL_RED) 

Is equal to

SetPenColor(CL_RED)

SetPenColor

include tinewg.exw
public procedure SetPenColor(atom colorpen)

EuWinGui seems to handle only one Color for Pen and Brush so we simulate this here This function should works as expected for EuWinGui.
Sets the color which will be used by EuWinGUI with all the following drawing procedures until a new call to this procedure will change it. The default color is black, but it is possible to draw using any color. The basic 16 Windows colors are predefined by EuWinGUI and can be used as argument of this procedure (see Appendix D for the complete list of EuWinGUI predefined colors and their hexadecimal values), however, in case a specific color is needed, it is possible to pass it as a hexadecimal RGB value according to the format #bbggrr (where bb, gg, rr are values ranging from #00 to #FF (decimal 0 to 255) and defining the quantity and proportion of blue, green and red which will form the desired color). Note however that depending on the system's settings where your application is run (for example if you are using a screen color depth of 65536 colors, e.g. 16 bit), it is very possible that a given color is not available; in that case, the closest color among the available ones will be automatically used by the operating system. Note that it is possible to check which color was actually used by drawing a point or a line on a bitmap and retrieveing its true color using the GetPixelColor() function.

For example SetPenColor(CL_RED) will set the color of all the following drawings to the standard Windows red color, while SetPenColor(#E0E0E0) will set the pen color to a custom light gray.

[atom color] is the hexadecimal value defining the color which will be used by all the following drawing procedures

See also:

SetBrushCol,SetPenCol

SetPenSize

include tinewg.exw
public procedure SetPenSize(atom size)

Sets the width, in pixels, of the lines that will be drawn by DrawLine(), DrawMultiLine() and DrawPolygon() procedures, until a new call to this procedure will change it. Width must be comprised between 1 and 50; the default value is 1.

[atom width] is the desired width of the lines drawn by the line-drawing procedures

DrawPolygon

include tinewg.exw
public procedure DrawPolygon(flatsequence points, atom fillflag = False)

Draws a polygon (e.g. a closed multi-segment line) linking all the points indicated by the sequence passed as first argument, over the client area of the window or control indicated by the last call to SetDrawingControl(), using the line width indicated by the last call to SetPenSize() and the color indicated by the last call to SetPenColor(). The polygon is also filled with the same color, if the fillflag argument is set to True. Since any drawing made directly over a window or control's surface is automatically cleared by the operating system when the window or control is repainted, to make the drawings persistent (e.g. always visible at any one time) they must be placed inside a custom "paint procedure" which is executed each time this occurs. (See SetDrawingProc() below). Failing to do that will cause the drawing to be cleared as soon as the window or control is repainted by Windows, unless you are drawing on a memory bitmap.

Note that:
  1. the points' sequence must be a plain sequence of integers (e.g. can't contain other sequences) and the coordinates of the points must be entered this way: {x1,y1,x2,y2...,xn,yn} where 'x1' is the horizontal coordinate of point 1, 'y1' is the vertical coordinate of the same point and so on;
  2. the first and last point are automatically linked by the procedure to "close" the polygon, so there's no need to repeat the coordinates of point 1 at the end of the sequence;
  3. the polygon will be completely filled (if so indicated) only if the polygon's sides DO NOT intersecate each other. In the latter case only alternate parts of the whole polygon may be filled;
  4. to draw a same polygon and apart the fill-in option, a single call to DrawPolygon() is much faster than several consecutive calls to DrawLine(). For example, the instruction
Example:

DrawPolygon({10,10,50,10,50,90,10,90},True)
draws and fills a rectangle linking the points whose coordinates are (10,10),(50,10),(50,90) and (10,90). [sequence points] is the plain sequence storing the point's coordinates [atom fillflag] set to True to draw a filled polygon or False to draw an outlined polygons

See also:

DrawPoint

DrawCircle

include tinewg.exw
public procedure DrawCircle(integer x, integer y, integer radius, atom fillflag = False)

DrawRectangle

include tinewg.exw
public procedure DrawRectangle(integer x1, integer y1, integer x2, integer y2,
        atom fillflag = False)

DrawEllipse

include tinewg.exw
public procedure DrawEllipse(integer x1, integer y1, integer x2, integer y2,
        atom fillflag = False)

GetPixelColor

include tinewg.exw
public function GetPixelColor(atom xpos, atom ypos)

Returns the color of the pixel with the specified coordinates from the current drawing bitmap (or Memory Bitmap) or control, according to the last call to SetDrawingMB() or SetDrawingControl(). Note that it is possible to retrieve the color of a pixel of a control ONLY if it is visible on the screen. In case it was not possible to retrieve the color of the specified pixel, the function's result will be bigger than #FFFFFF.
[atom xpos,ypos] are the coordinates of the pixel to check

See also:

DrawPoint

DrawPoint

include tinewg.exw
public procedure DrawPoint(atom xpos, atom ypos)

Draws a single pixel over the client area of the window or control indicated by the last call to SetDrawingControl(), or over the memory bitmap indicated by the last call to SetDrawingMB() using the color indicated by the latest call to SetPenColor(). Since any drawing made directly over a window or control's surface is automatically cleared by the operating system when the window or control is repainted, to make the drawings persistent (e.g. always visible at any one time) they must be placed inside a custom "paint procedure" which is executed each time this occurs. (See SetDrawingProc() below). Failing to do that will cause the drawing to be cleared as soon as the window or control is repainted by Windows, unless you are drawing on a memory bitmap.

[integer pointx,pointy] are the pixel's coordinates (pixel 0,0 is the top-left one)

See also:

DrawPolygon,DrawLine,DrawPoint,GetPixelColor

DrawLine

include tinewg.exw
public procedure DrawLine(integer startx, integer starty, integer endx, integer endy)

Draws a straight line over the client area of the window or control indicated by the last call to SetDrawingControl(), or over the memory bitmap indicated by the last call to SetDrawingMB() using the color indicated by the latest call to SetPenColor() and a line width indicated by the last call to SetPenSize(). Since any drawing made directly over a window or control's surface is automatically cleared by the operating system when the window or control is repainted, to make the drawings persistent (e.g. always visible at any one time) they must be placed inside a custom "paint procedure" which is executed each time this occurs. (See SetDrawingProc() below). Failing to do that will cause the drawing to be cleared as soon as the window or control is repainted by Windows, unless you are drawing on a memory bitmap.

[integer startx,starty] are the line's starting coordinates (point 0,0 is the top-left one) [integer endx,endy] are the line's ending coordinates (point 0,0 is the top-left one)

See also:

DrawPolygon,DrawLine,DrawPoint,DrawMultiLine

DrawMultiLine

include tinewg.exw
public procedure DrawMultiLine(sequence lines)

DrawMultiLine(linestodraw) A particular version of DrawLine() (see above) which draws several (consecutive or not) lines at one time. A single call to DrawMultiLine() to draw several lines is much faster than several consecutive calls to DrawLine(). "linestodraw" is a sequence of 4-element sequences storing the lines to draw. For example:

DrawMultiLine({{10,10,20,20},{35,30,40,50},{100,20,100,50}})
is equivalent to:
DrawLine(10,10,20,20)
DrawLine(35,30,40,50) 
DrawLine(100,20,100,50) 

but much faster to execute. (This is not true for tinEWG)
[sequence linestodraw] is a sequence of 4-element sequences storing the lines to draw

See also:

DrawPolygon,DrawLine,DrawPoint,DrawMultiLine

CopyMB

include tinewg.exw
public procedure CopyMB(atom sourcebitmap, atom xpos, atom ypos, atom xsize, atom ysize,
        atom destbitmap, atom destxpos, atom destypos,
        atom destxsize = xsize, atom destysize = ysize)

Should work like the EWG procedure

CopyMBToControl

include tinewg.exw
public procedure CopyMBToControl(atom sourcebitmap, atom xpos, atom ypos, atom xsize,
        atom ysize, atom destcontrol, atom destxpos, atom destypos,
        atom destxsize = xsize, atom destysize = ysize)

CaptureControl

include tinewg.exw
public procedure CaptureControl(atom handle, atom mem_bitmap, atom flag = True)

DrawString

include tinewg.exw
public procedure DrawString(atom startx, atom starty, sequence text)

Draws some text over the client area of the window or control indicated by the last call to SetDrawingControl(), or over the memory bitmap indicated by the last call to SetDrawingMB() using the color indicated by the last call to SetPenColor() and the font indicated by the last call to SetDrawingFont(). Since any drawing made directly over a window or control's surface is automatically cleared by the operating system when the window or control is repainted, to make the drawings persistent (e.g. always visible at any one time) they must be placed inside a custom "paint procedure" which is executed each time this occurs. (See SetDrawingProc() below). Failing to do that will cause the drawing to be cleared as soon as the window or control is repainted by Windows, unless you are drawing on a memory bitmap.

[atom startx,starty] are the text's starting coordinates (point 0,0 is the top-left one) [sequence text] is the text to draw

SetDrawingFont

include tinewg.exw
public procedure SetDrawingFont(atom font)

This procedure allows to set the font type which will be used with all the following calls to the DrawString() procedure. The font type can be either one created with the NewFont() function or one of the default types.

[atom font] is the handle of the font to use

GetStringSize

include tinewg.exw
public function GetStringSize(atom control, sequence sstring, atom font, atom dimensionflag)

SetRepaintOn

include tinewg.exw
public procedure SetRepaintOn(atom control, atom flag)

IsKeyPressed

include tinewg.exw
public function IsKeyPressed(atom x)

Returns True if the specified keyboard's key is actually pressed, or False otherwise. For instance IsKeyPressed('A') will return True if the keyboard's key 'A' is pressed at the time the function is called.

[atom key] identifies the keyboard's key to check (e.g. 'A' or 'B' ... or '9' and so on)

SetCur

include tinewg.exw
public procedure SetCur(object cursorshape)

Sets temporarily the cursor's shape to one of five available standard window types or to one loaded from disk using the LoadCur() function (see above), "temporarily" meaning that Windows automatically restores the original cursor's shape each time the mouse is moved. For this reason, this procedure is normally used when handling the mouse Events (e.g. Move,Click,Release,RClick,RRelease) of a control to change the shape of the pointer each time it lies, it is clicked or moved over it. For instance, it is possible to change the shape of the cursor to an hourglass to advise the program's User of a lengthy operation in progress by using SetCur(CR_WAIT) inside the handling procedure of the Move Event of all the program's controls and windows.

[atom cursorshape] is one of the default cursor shapes or the handle of a cursor loaded from disk
CR_WE (West-East double arrow)
CR_NS (North-South double arrow)
CR_SIZE (Four directions arrow)
CR_VARROW (Vertical arrow)
CR_WAIT (Hourglass)
CR_NULL (No cursor visible)
CR_HELP

See also:

LoadCur

SetDrawingControl

include tinewg.exw
public procedure SetDrawingControl(atom control)

Set the indicated window or control as the one over which all the following drawing instructions will draw, until a new call to this procedure or to SetDrawingMB() will change it again. Initially, the default "drawing control" is the application's Main Window.

[atom control] is the handle of the control over which all the following drawing instructions will draw

See also:

SetDrawingMB,SetCanvas

SetDrawingMB

include tinewg.exw
public procedure SetDrawingMB(atom bitmap)

Set the indicated bitmap or Memory Bitmap as the one over which all the following drawing instructions will draw, until a new call to this procedure or to SetDrawingControl() will change it again.

[atom bitmap] is the handle of a Memory Bitmap or of a bitmap loaded from file over which all the following drawing instructions will draw

See also:

SetDrawingControl,SetCanvas

SetCanvas

include tinewg.exw
public procedure SetCanvas(atom canvas)

This is a replacement for the SetDrawingMB() and the SetDrawingControl() procedures with tinEWG you only will need SetCanvas() and the above procedures are obsolete, but supported for EuWinGui Apps.

See also:

SetDrawingControl,SetDrawingMB

RunApp

include tinewg.exw
public procedure RunApp(sequence appname, sequence parameter)

Starts or open the given program, file or directory, using the given parameters, if any. Not-executable files can be run directly, but only if their extension is already associated with an executable application. Note that this procedure DOES NOT change the working directory to the one of the started application; should it be necessary to change working directory, just use the Euphoria function chdir() before calling this procedure.

[sequence program] is the complete pathname of the program or file to run
[sequence parameters] are the parameters to use when running the specified program

Activate

include tinewg.exw
public procedure Activate(atom handle)

ActivateText

include tinewg.exw
public procedure ActivateText(atom handle)

Message

include tinewg.exw
public function Message(atom hwnd, atom msg, atom wParam, atom lParam, atom delayflag)

This low-level function is reserved to Programmers who already have a good knowledge of Windows low-level programming and can be safely ignored by casual Users of the library.
It serves to send (if delayflag is False) or post (if delayflag is True) a Windows message to an existing control or window.

[atom hwnd,msg,wParam,lParam] the data to send or post to the application's message queue [atom delayflag] set to True to post the message or False to send it immediately

See also:

PostMessage,SendMessage

CloseApp

include tinewg.exw
public procedure CloseApp(atom exitcode = 0)

Closes the application with the given exit code. Use always this procedure to terminate any EuWinGUI application, so that the memory allocated for fonts and other resources is correctly freed.

[atom exitcode] the code returned to the system when the application closes

WaitEvent

include tinewg.exw
public function WaitEvent()

Starts the event handling procedure and wait until the user interacts in some ways with the program's interface. Once one of the supported events is trapped, sets the global variable Event to the Event's Type and the global variable EventOwner to the handle of the Control which received the Event, then returns.

See also:

ProcessEvent

ProcessEvent

include tinewg.exw
public procedure ProcessEvent()

This procedure works almost like WaitEvent() (see below) with the difference that it returns immediately after having processed all the waiting events. By using this function, a EuWinGUI application can perform other tasks while waiting for more Events to occurr, at the cost of a much increased CPU usage.

See also:

WaitEvent

IsEventWaiting

include tinewg.exw
public function IsEventWaiting()

WarnMsg

include tinewg.exw
public procedure WarnMsg(object text, object title)

Shows a standard warning Dialog with custom message, caption and the exclamation icon. Note: the application freezes (e.g. do not process any Event) until the message box is closed.

[sequence message] is the message to show
[sequence caption] is the Dialog's window caption

See also:

AskMsg,InfoMsg

InfoMsg

include tinewg.exw
public procedure InfoMsg(object text, object title)

Shows a standard information Dialog with custom message, caption and the information icon. Note: the application freezes (e.g. do not process any Event) until the message box is closed.

[sequence message] is the message to show [sequence caption] is the Dialog's window caption

See also:

AskMsg,WarnMsg

AskMsg

include tinewg.exw
public function AskMsg(object text, object title)

Shows a standard ask Dialog with custom message, Yes/No buttons, caption and the question icon. If the user clicks on Yes buttons the function returns True, otherwise it returns False. Note: the application freezes (e.g. do not process any Event) until the message box is closed.

[sequence message] is the message to show
[sequence caption] is the Dialog's window caption

See also:

WarnMsg,InfoMsg

ScreenHeight

include tinewg.exw
public function ScreenHeight()

Returns the current DeskTop (screen) height, in pixels.
This function is very useful to center the main window on the screen. If hei is the window's height, to center it vertically on the screen, set the y position of the window to

floor((ScreenHeight()-hei)/2)
See also:

ScreenWidth

ScreenWidth

include tinewg.exw
public function ScreenWidth()

Returns the current DeskTop (screen) width, in pixels.
This function is very useful to center the main window on the screen. If wid is the window's width, to center it horizontally on the screen, set the x position of the window to

floor((ScreenWidth()-wid)/2)
See also:

ScreenHeight

SetText

include tinewg.exw
public procedure SetText(atom handle, flatsequence text, atom part = 0)

GetText

include tinewg.exw
public function GetText(atom handle)

SetIcon

include tinewg.exw
public procedure SetIcon(sequence icon_file)

Sets the icon of the Main Window or of the last window used with a call to the SetParentWindow() procedure to the one specified. By default, the Main Window's or a Dialog's icon is the one bound with the compiled script, or the Euphoria one if the program was not bound.

[sequence iconpath] is the full pathname of the .ICO file to load

SetIconFR

include tinewg.exw
public procedure SetIconFR(sequence icon_file, atom handle = 0)

LoadIco

include tinewg.exw
public function LoadIco(sequence icon_file)

SetIco

include tinewg.exw
public procedure SetIco(atom handle)

SetIconToButton

include tinewg.exw
public procedure SetIconToButton(atom control, sequence icon_file, atom x = 0, atom y = 0)

If x and/or y = 0 than the original Icon size will be used.

SetIconToButtonFR

include tinewg.exw
public procedure SetIconToButtonFR(atom control, sequence icon_file, atom x = 0, atom y = 0,
        atom handle = 0)

LoadPicFR

include tinewg.exw
public function LoadPicFR(sequence picture_file, atom handle = 0)

SetParentWindow

include tinewg.exw
public procedure SetParentWindow(atom handle)

Sets the Main Window or an existing Dialog control as parent of all the controls created after this procedure has been used and until a new call to the same procedure changes again the "parent" window of all the newly created controls. It allows to populate the Dialog controls with other controls types as it is normally done with the Main Window. Note that Dialogs controls are always created as children of the Main Window, regardless of the window passed as argument of this function.

[atom parentwindow] is the handle of the Main Window (WinHwnd) or of a Dialog which will be used as parent of all the controls created following the call of this procedure

LoadPic

include tinewg.exw
public function LoadPic(sequence picture_file)

Loads a BMP image from disk, returns its handle and stores the same handle into the PictureHandle global atom too. Only standard BMP images can be loaded, but it is not necessary that the file has the .BMP extension. That means that you can rename your BMPs file with new extensions to hide them from the User of your application, but you can still load them with this procedure. Note that each time this function is called, an amount of RAM equal to the size of the just loaded image is used (even if loading the same image multiple times) and won't be available to other applications until the program terminates or until you use the DeleteImage() procedure (see above) to delete the loaded images and free up the used memory. Note that whatever the color resolution of the loaded bitmap is, once the bitmap is loaded it is converted to the color depth actually used by Windows.

[sequence imagepath] is the full pathname of the .BMP file to load

LoadCur

include tinewg.exw
public function LoadCur(sequence cursor_file)

Loads a cursor file from disk and returns its handle. Once a cursor is loaded its handle can be used to change the mouse pointer's shape using the SetCur() procedure (see below).

[sequence cursorpath] is the pathname of the cursor file to load

See also:

SetCur

SetPicture

include tinewg.exw
public procedure SetPicture(atom handle, atom controltype = 0,
        object imagepath = DC_DefaultControl)

A call to this procedure is absolutely equivalent to the code SetPic(control, controltype, LoadPic(imagepath)). It loads and sets at a same time a BMP image into a Picture, ClickPicture, PictureButton or PicturePushButton control, and stores the handle of the loaded image into the PictureHandle global atom. Only standard BMP images are allowed, but it is not necessary that the file has the .BMP extension. That means that you can rename your BMPs file with new extensions to hide them from the User of your application, but you can still load them with this procedure. Note that each time this procedure is called, an amount of RAM equal to the size of the just loaded image is used (even if loading the same image multiple times) and won't be available to other applications until the program terminates. To avoid running out of memory when you need to use a same large bitmap multiple times on a same or different controls, use LoadPic() once to retrieve the handle of the image you need and use SetPic() instead to set it on every control or each time it is needed.

[atom control] is the handle of the Picture, ClickPicture, PictureButton or PicturePushButton control
[atom controltype] is the type (Picture, ClickPicture, PictureButton or PicturePushButton) of the control
[sequence imagepath] is the full pathname of the .BMP file to load

SetPic

include tinewg.exw
public procedure SetPic(atom handle, atom controltype = 0,
        object imagehandle = DC_DefaultControl)

Sets a BMP image already loaded from a file or a Memory Bitmap created with NewMB() into a Picture, ClickPicture, PictureButton or PicturePushButton control. This procedure is especially useful when loading a BMP from file if your application use multiple times a same bitmap because, differently from the SetPicture() procedure below, it doesn't use addictional memory each time it is called as the third argument of the procedure is not a file path but the handle of a previously loaded bitmap image. The handle of a bitmap image is stored inside the PictureHandle global atom after the SetPicture() procedure has been used a first time to load it, or it is returned by a call to LoadPic() (see above). So, if you need to load a same bitmap inside multiple Picture controls, you can save a lot of memory by calling the LoadPic() function to load the bitmap from disk only once and then using SetPic() to set the same image into the other controls, using the handle returned by the function as third argument of the SetPic() procedure.

Example. Say you have four Picture controls and you need to load the same 100Kb image inside them, the code

SetPicture(pic1,Picture,"image.bmp")
SetPicture(pic2,Picture,"image.bmp") 
SetPicture(pic3,Picture,"image.bmp") 
SetPicture(pic4,Picture,"image.bmp") 

and the code

imghandle = LoadPic("image.bmp")
SetPic(pic1,Picture,imghandle) 
SetPic(pic2,Picture,imghandle) 
SetPic(pic3,Picture,imghandle) 
SetPic(pic4,Picture,imghandle) 

work the same, but by using the first method you will need 400Kb of RAM, while the second method only uses 100Kb because the image is loaded in memory only once.

[atom control] is the handle of the Picture, ClickPicture, PictureButton or PicturePushButton control
[atom controltype] is the type (Picture, ClickPicture, PictureButton or PicturePushButton) of the control
[atom imagehandle] is the handle of an already loaded bitmap image to use

SetVisible

include tinewg.exw
public procedure SetVisible(object handle, atom Flag)

Shows or hides a control or a group of controls. Makes the specified control visible or invisible, depending on the value of flag. Hidden controls cannot respond to events.

[atom control] is the handle of the control to show or hide
[atom flag] set to True to show a control, or False to hide it

ListView functions


lv_GetItemCount

include tinewg.exw
public function lv_GetItemCount(atom handle)

lv_Clear

include tinewg.exw
public procedure lv_Clear(atom handle)

lv_GetIndex

include tinewg.exw
public function lv_GetIndex(atom handle)

lv_AddColumn

include tinewg.exw
public function lv_AddColumn(atom handle, sequence header = "", atom width = 60)

lv_InsertRow

include tinewg.exw
public function lv_InsertRow(atom handle, integer row, sequence text)

lv_SetItem

include tinewg.exw
public function lv_SetItem(atom handle, integer row, integer col, sequence text)

lv_GetItem

include tinewg.exw
public function lv_GetItem(atom handle, integer row, integer col)

ListBox functions


ListAdd

include tinewg.exw
public procedure ListAdd(atom handle, object item)

Adds the specified string item to a List control. If the List control is actually a SortedList, the new item will be placed in alphabetical order among the existing items, otherwise it will be added at the end of the item's list.

[atom control] is the List control to which the string item must be added
[sequence item] is a string to add to the List item's list

ListClear

include tinewg.exw
public procedure ListClear(atom handle)

Clears all of a list control's items.
[atom control] is the List control to clear

ListDel

include tinewg.exw
public procedure ListDel(atom handle)

Deletes the currently selected item only from a List control.
[atom control] is the List control whose item must be deleted

ListIns

include tinewg.exw
public procedure ListIns(atom handle, object item)

Inserts the specified string item into a List control to the currently selected list position. Using this function with SortedList controls could cause to lose the sorting order.
[atom control] is the List control to which the string item must be added
[sequence item] is a string to add to the List item's list

ListPut

include tinewg.exw
public procedure ListPut(atom handle, object item)

Replaces the currently selected list item with the new string specified. Basically, this procedure deletes the currently selected list item and insert the new one into the same position. To avoid undesired list's flickerings caused by the deletion and re-insertion of the item, use the SetRepaintOn() procedure before and after this function. Using this function with SortedList controls could cause the lost of the sorting order.
[atom control] is the List control whose item must be replaced
[sequence item] is the new string item

ListSeek

include tinewg.exw
public procedure ListSeek(atom handle, atom pos)

Sets the currently selected item of a List control to the specified position. If position is -1, no items will be selected, while if position exceeds the number of items present into the list, the last item will be selected. The first item of a list is the one with position 0 (zero).
[atom control] is the List control to set
[atom position] is the position number of the item to select

GetCount

include tinewg.exw
public function GetCount(atom handle)

GetIndex

include tinewg.exw
public function GetIndex(atom handle)

GetItem

include tinewg.exw
public function GetItem(atom handle)

GetListItemHeight

include tinewg.exw
public function GetListItemHeight(atom handle)

SetListCWidth

include tinewg.exw
public procedure SetListCWidth(atom handle, atom width)

GetSelec

include tinewg.exw
public function GetSelec(atom handle)

IsChecked

include tinewg.exw
public function IsChecked(atom handle)

SetCheck

include tinewg.exw
public procedure SetCheck(atom handle, atom Flag)

SetEnable

include tinewg.exw
public procedure SetEnable(atom handle, atom Flag)

SetEditSel

include tinewg.exw
public procedure SetEditSel(atom handle, atom start_pos, atom end_pos)

GetEditSel

include tinewg.exw
public function GetEditSel(atom handle)

Return a sequnece with the actual selection of the control (if any)

MoveWindow

include tinewg.exw
public procedure MoveWindow(atom handle, atom xpos, atom ypos, atom height, atom width,
        atom repaint)

Resizes and moves a Window or Control to the given size and position. This works with all Windows and Controls you can get a handle for.

See also:

SetDim,SetPos

SetDim

include tinewg.exw
public procedure SetDim(atom handle, atom xsize, atom ysize)

Resizes the main window or a control to the given dimensions. [atom handle] is the handle of the control to move [atom xsize] is the new width of the control [atom ysize] is the new height of the control This works only with Controls created with tinEWG!

See also:

SetPos,MoveWindow

SetPos

include tinewg.exw
public procedure SetPos(atom handle, atom xcoord, atom ycoord)

Moves a control to a new position over the Main Window's client area or the Main Windows to another screen's position. [atom handle] is the handle of the control to move [atom xcoord] is the new x position of the control [atom ycoord] is the new y position of the control This works only with Controls created with tinEWG!

See also:

SetDim,MoveWindow

GetImageWidth

include tinewg.exw
public function GetImageWidth(atom handle)

Returns the Width of an Image or an Memorybitmap

See also:

GetImageHeight,GetImageSize

GetImageHeight

include tinewg.exw
public function GetImageHeight(atom handle)

Returns the Height of an Image or an Memorybitmap

See also:

GetImageSize,GetImageWidth

GetImageSize

include tinewg.exw
public function GetImageSize(atom handle, atom flag)

A more EuWInGui-Style version of getting Image sizes
flag can be X_DIM or Y_DIM

See also:

GetImageHeight,GetImageWidth

DeleteImage

include tinewg.exw
public procedure DeleteImage(atom handle)

Deletes an Image or Memorybitmap, and releases the used memory.

MakeRGB

include tinewg.exw
public function MakeRGB(integer RED, integer GREEN, integer BLUE)

Creates a ColorValue from 3 independed RGB Values. There is no Check for possibillity in this routine. so it is up to you, if you got some strange results ;)

SetColor

include tinewg.exw
public procedure SetColor(atom handle, atom text, atom background)

SetRefresh

include tinewg.exw
public procedure SetRefresh(atom handle)

SetFont

include tinewg.exw
public procedure SetFont(atom handle, atom font)

SetFixedFont

include tinewg.exw
public procedure SetFixedFont(atom handle)

SetWinTimer

include tinewg.exw
public procedure SetWinTimer(atom time1, atom timer = WinTimer)

SetWinTimer sets a/the Timer
a call with time = Null stops the timer

See also:

KillTimer,SetTimer

FileDlg

include tinewg.exw
public function FileDlg(object Flag, sequence defaultfile, sequence filters)

Shows a standard "Open" or "Save As" file dialog (depending on the value of flag) and returns the full pathname of the file selected for opening or saving purposes. The starting folder is the current working directory (so it can be changed, if needed, with a previous call to the Euphoria statement chdir()). Argument defaultfile can hold name and extension (no path) of the file used by default when the file dialog appears. Argument filters holds the extension filter definition for the file dialog. Extension filters are given by couples
of file descriptions and extensions separated by vertical lines, using this format: "File Description 1|*.ex1|File Description 2|*.ex2" and so on;
for instance the string:
"JPEG Images|*.JPG;*.JPEG|All Files|*.*"
sets two filter definitions: "JPEG Files" and "All Files";
if the User chooses the first filter from the drop-down list, only files with .JPEG and .JPG extension will be visible, while if he chooses the "All Files" filter, all files will be visible. Note the use of semicolon (";") to separate different extensions belonging to a same filter definition. If argument filter is an empty string (""), the default "All Files|*.*" filter only is used.
As a final note, be aware that, if using the Save flag, the function does NOT automatically append any extension to the returned filepath, regardless of the selected filter.
The application freezes (e.g. do not process any Event) until the dialog box is closed.
[atom flag] set to Open or Save to display a standard "Open" or "Save As.." file dialog
[sequence defaultfile] is the default file name
[sequence filters] is the filter string definition

Printing functions


GetPageSize

include tinewg.exw
public function GetPageSize(atom dimensionflag)

Returns the width or height in pixels of the current printing document's pages, according to the selected printer and its settings.
[atom dimensionflag] set to X_DIM or Y_DIM to retrieve respectively the width or height of the page

GetPrinterStringSize

include tinewg.exw
public function GetPrinterStringSize(sequence sstring, atom font, atom dimensionflag)

SetPrinterFont

include tinewg.exw
public procedure SetPrinterFont(atom font)

SelectPrinter

include tinewg.exw
public procedure SelectPrinter(atom flag = True)

NewDocument

include tinewg.exw
public procedure NewDocument(sequence documentname = "New Document")

PrintMB

include tinewg.exw
public procedure PrintMB(atom sourcebitmap, atom xpos, atom ypos, atom xsize, atom ysize)

PrintMBBlt

include tinewg.exw
public procedure PrintMBBlt(atom sourcebitmap, atom xpos, atom ypos, atom xsize, atom ysize,
        atom destxpos = xpos, atom destypos = ypos, atom destxsize = xsize,
        atom destysize = ysize)

PrintString

include tinewg.exw
public procedure PrintString(atom startx, atom starty, sequence text)

SetPrinterPenColor

include tinewg.exw
public procedure SetPrinterPenColor(atom pencolor)

StartPrinting

include tinewg.exw
public procedure StartPrinting()

NewPage

include tinewg.exw
public procedure NewPage()

PrintWindow

include tinewg.exw
public procedure PrintWindow(atom handle = WinHwnd, atom hdc = Printhdc, atom flags = 0)

DeleteControl

include tinewg.exw
public procedure DeleteControl(atom handle)

Control

include tinewg.exw
public function Control(object window_class, sequence caption = "New", atom xpos = 0,
        atom ypos = 0, atom xsize = 80, atom ysize = 20)

Creates one of the supported Control Types, and returns its handle. Can be used only after that the Window() function has been used. If the control can't be created, the function returns zero.
[atom controltype] is one of the supported Control Types
[sequence caption] is the text associated to the Control
[atom xpos,ypos] the Control's coordinates relative to the Window
[atom xsize,ysize] the Control's width and height

See also:

Window

Window

include tinewg.exw
public function Window(sequence title = "TinEwg Window", atom xpos = - 1, atom ypos = - 1,
        atom xsize = 400, atom ysize = 200)

Creates and shows the application's Main Window and assign the Window's handle to the global variable WinHwnd.
It is the first WinGUI function to use to create the program's interface. If the Main Window can't be created,
WinHwnd is set to zero. The appearance (style) of the Main Window can be choosen, before using this procedure,
by setting the values of global variables WindowType and WinOnTop (see above). xpos,ypos defaults to -1, which centers the Window on the screen.
[sequence caption] is the Window's title
[atom xpos,ypos] are the Window's screen coordinates
[atom xsize,ysize] are the Window's width and height

See also:

Control

GetForegroundWindow

include tinewg.exw
public function GetForegroundWindow()

BringWindowToTop

include tinewg.exw
public function BringWindowToTop(atom hwnd)

SetForegroundWindow

include tinewg.exw
public function SetForegroundWindow(atom hwnd)

SetActiveWindow

include tinewg.exw
public function SetActiveWindow(atom hwnd)

ForceForeground

include tinewg.exw
public procedure ForceForeground(atom aWinHwnd, atom showflag = 1)
The new experimental SetHandler interface

SetHandler

include tinewg.exw
public procedure SetHandler(object handle, object htype, object routineid)

ProcessHandlers

include tinewg.exw
public procedure ProcessHandlers()

WinMain

include tinewg.exw
public procedure WinMain()

WinGame

include tinewg.exw
public procedure WinGame()

pb_Step

include tinewg.exw
public procedure pb_Step(atom handle)

pb_SetRange

include tinewg.exw
public procedure pb_SetRange(atom handle, atom minimum = 1, atom maximum = 100)

pb_SetStep

include tinewg.exw
public procedure pb_SetStep(atom handle, atom step = 1)

pb_SetPos

include tinewg.exw
public function pb_SetPos(atom handle, atom pos = 1)

pb_GetPos

include tinewg.exw
public function pb_GetPos(atom handle)

pb_SetMarquee

include tinewg.exw
public procedure pb_SetMarquee(atom handle, atom onoff = True, atom milliseconds = 30)

pb_MakeMarquee

include tinewg.exw
public procedure pb_MakeMarquee(atom handle)

pb_MakeVertical

include tinewg.exw
public procedure pb_MakeVertical(atom handle)