
Module gui
The gui module supports the creation of simple GUIs and dialog boxes.
To use the gui module, you can either execute a script with idlew.exe (this is the GUI-enabled version of the Idle interpreter) which preloads this module or you can use the console version of the interpreter, idle.exe. In the latter case, module gui has to be loaded explicitly by calling require( ):
require('gui') -- no harm done if this called from idlew.exe
In both cases, all functions, classes and constants are available under the gui prefix.
Although most of the higher-level functions do not directly use handles and other Windows API paraphernalia, the gui module is a relatively thin wrapper around the Microsoft API, so some knowledge about the way Windows works (or is supposed to work) is probably required: you should have a rough idea what messages, window handles and the like mean.
The gui module supports two different styles of programming: a simple procedural mode where you create the main window and its controls yourself. There is also a slightly more advanced mode where all the GUI elements (buttons, listboxes, edit fields etc) are mapped onto classes (see the Idle standard module Class).
The following control types are currently supported:
- Static (mostly text)
- Radiobuttons
- Pushbuttons
- Checkboxes
- Input fields (one-line edit fields)
- Edit fields (multi-line edit fields)
- Richedit fields
- Listboxes
- Comboboxes
- Datepickers
- Listviews
- Progressbars
- Statusbars
- Trackbars
- Treeviews
The gui module also supports menus and accelerator tables, dragging and dropping of files, popup menus and common dialog boxes to choose fonts and to open or save files and to select folders.
Back to the main Idle Runtime library documentation.
Defaults
top of page
gui.defaults is a table with a few global pre-defined values. They can be changed but doing so after creating and before closing a dialog box may have unpredictable side effects. In other words, change them only when no GUI or dialog box is currently open.
- gui.defaults.pX: the horizontal pixel width of one dialog box unit (all coordinates used in the gui module are in dialog box units). Default is 4.
- gui.defaults.pY: the vertical pixel width of one dialog box unit. Default is 4.
- gui.defaults.postQuit: if this is true, the module automatically handles generating WM_QUIT messages. If false, the script has to post a gui.WM_QUIT message before it terminates. Generally this is only required for scripts which create more than one dialog box at the same time.
- gui.defaults.defGuiStyle: the standard style for dialog boxes (default is gui.WS.OVERLAPPED, gui.WS.CAPTION, gui.WS.SYSMENU, gui.WS.MINIMIZEBOX and gui.WS.MAXIMIZEBOX).
- gui.defaults.hfont: the standard font for dialog boxes (default is the font returned by API call GetStockObject(DEFAULT_GUI_FONT)).
Creating a dialog box
top of page
There are two ways to create a dialog box. The first is a simple procedural interface which in outline looks like this:
require('gui') -- only required for idle.exe not for idlew.exe __INCLUDE('guiDefaults.inc') -- a few useful definitions local function evHandler(g,id,notf,hwnd) -- event handler if notf<0 then return nil end -- ignore notification codes < 0 if id==30000 and notf==gui.BN.CLICKED then gui.MessageBox('Later?') elseif id==30001 and notf==gui.BN.CLICKED then gui.destroyGui() elseif id==2 then gui.destroyGui() else return nil end return 0 end gui.createGui('simplest gui',{eventHandler=evHandler},51,8) -- class, caption, id, x, y, dx,dy,style gui.addControl('Button','Do not end',30000,24, 5, 1, 1,GD.PUSHBUTTON) gui.addControl('Button','End', 30001,24, 5,26, 1,GD.DEFPUSHBUTTON) gui.displayGui() -- show it gui.mainloop()
The event handler deals with significant events while the dialog box and its controls are shown. After creating a dialog box with gui.createGui() and adding controls with calls to gui.addControl() the dialog box is displayed and the main message loop entered. This loop runs until the dialog box is closed, either explicitly by calling gui.destroyGui(), eg after a button is clicked, or implicitly by clicking the close icon in the dialog box titlebar (this latter way of closing a dialog box is handled internally).
The second way to create dialog boxes is via the object-oriented interface. First you define a table structure which contains all required values (size, styles, optional menu and accelerator table, controls etc) like this:
require('gui') __INCLUDE('guiDefaults.inc') local testgui={title='testgui',cx=67,cy=80,style=GD.SIZEGUI, menu={{name='&File',id=1000,{'file1','file2','file3'}},{name='&Edit',id=2000,{'edit1','edit2','edit3'}},{name='&Help',id=9999}}, accel={{key='^a',id=9999},{key='!F12',id=1000}}, controls={ -- classname, control name, caption, width,height,x, y window style, extended window style {gui.Static, title='&Name:', cx=16,cy=4, x=1, y=2}, {gui.Input, name='i_Name', title='Enter Name', cx=44,cy=5, x=21,y=1, style=GD.INPUT, xstyle=gui.RESIZE.WIDTH}, {gui.Static, title='&Biography:',cx=16,cy=4, x=1, y=7}, {gui.Edit, name='e_Bio', title='End1', cx=64,cy=54, x=1, y=13,style=GD.EDIT, xstyle=_OR(gui.RESIZE.WIDTH,gui.RESIZE.HEIGHT)}, {gui.Button,name='b_Alive',title='&Alive', cx=16,cy=5, x=1, y=69,style=GD.TSTATEBOX, xstyle=gui.RESIZE.TOP}, {gui.Button,name='b_Clear',title='&Clear', cx=16,cy=5, x=21,y=69,style=GD.PUSHBUTTON, xstyle=gui.RESIZE.TOP}, {gui.Button,name='b_End', title='&End', cx=16,cy=5, x=41,y=69,style=GD.DEFPUSHBUTTON,xstyle=gui.RESIZE.TOP} } }
Next the dialog box and all its elements are created and finally the dialog box is displayed and the main loop is called:
-- Create gui window, register menu and accelerator table and create all controls gui.Gui(testgui) -- display dialog box testgui:displayGui() -- and run main loop gui.mainloop()
See the included example programs for more details.
Functions
top of page
gui.acceptDragFiles(cb,gui)
gui.addAccel(acc,gui)
top of page
gui.addControl(class,title,id,cx,cy,x,y,style,xstyle,gui)
gui.addMenu(menu,gui)
top of page
Menu flags:
- gui.MF.ENABLED=0
- gui.MF.CHECKED=0x0008
- gui.MF.DISABLED=0x0003
- gui.MF.HILITE=0x0080
gui.browseForFolder(dir,flags,title)
top of page
browseForFolder( ) flags:
- gui.BIF.RETURNONLYFSDIRS=0x0001
- gui.BIF.RETURNFSANCESTORS=0x0008
- gui.BIF.EDITBOX=0x0010
- gui.BIF.NEWDIALOGSTYLE=0x0040
- gui.BIF.NONEWFOLDERBUTTON=0x0200
- gui.BIF.BROWSEINCLUDEFILES=0x4000
browseForFolder( ) standard folder constants:
- gui.CSIDL.DESKTOP=0x0000
- gui.CSIDL.PROGRAMS=0x0002
- gui.CSIDL.CONTROLS=0x0003
- gui.CSIDL.PRINTERS=0x0004
- gui.CSIDL.PERSONAL=0x0005
- gui.CSIDL.FAVORITES=0x0006
- gui.CSIDL.STARTUP=0x0007
- gui.CSIDL.RECENT=0x0008
- gui.CSIDL.SENDTO=0x0009
- gui.CSIDL.BITBUCKET=0x000a
- gui.CSIDL.STARTMENU=0x000b
- gui.CSIDL.MYDOCUMENTS=0x000c
- gui.CSIDL.MYMUSIC=0x000d
- gui.CSIDL.MYVIDEO=0x000e
- gui.CSIDL.DESKTOPDIRECTORY=0x0010
- gui.CSIDL.DRIVES=0x0011
- gui.CSIDL.NETWORK=0x0012
- gui.CSIDL.NETHOOD=0x0013
- gui.CSIDL.FONTS=0x0014
- gui.CSIDL.TEMPLATES=0x0015
- gui.CSIDL.COMMON_STARTMENU=0x0016
- gui.CSIDL.COMMON_PROGRAMS=0X0017
- gui.CSIDL.COMMON_STARTUP=0x0018
- gui.CSIDL.COMMON_DESKTOPDIRECTORY=0x0019
- gui.CSIDL.APPDATA=0x001a
- gui.CSIDL.PRINTHOOD=0x001b
- gui.CSIDL.LOCAL_APPDATA=0x001c
- gui.CSIDL.COMMON_FAVORITES=0x001f
- gui.CSIDL.INTERNET_CACHE=0x0020
- gui.CSIDL.COOKIES=0x0021
- gui.CSIDL.HISTORY=0x0022
- gui.CSIDL.COMMON_APPDATA=0x0023
- gui.CSIDL.WINDOWS=0x0024
- gui.CSIDL.SYSTEM=0x0025
- gui.CSIDL.PROGRAM_FILES=0x0026
- gui.CSIDL.MYPICTURES=0x0027
- gui.CSIDL.PROFILE=0x0028
- gui.CSIDL.PROGRAM_FILES_COMMON=0x002b
- gui.CSIDL.COMMON_TEMPLATES=0x002d
- gui.CSIDL.COMMON_DOCUMENTS=0x002e
- gui.CSIDL.COMMON_ADMINTOOLS=0x002f
- gui.CSIDL.ADMINTOOLS=0x0030
- gui.CSIDL.CONNECTIONS=0x0031
- gui.CSIDL.COMMON_MUSIC=0x0035
- gui.CSIDL.COMMON_PICTURES=0x0036
- gui.CSIDL.COMMON_VIDEO=0x0037
gui.chooseFont(face,height,flags)
top of page
chooseFont( ) flags:
- gui.CF.EFFECTS=0x0100
- gui.CF.FIXEDPITCHONLY=0x4000
- gui.CF.SCALABLEONLY=0x00020000
- gui.CF.TTONLY=0x00040000
gui.controlControl(id,what,cx,cy,x,y,gui)
top of page
gui.controlFromHwnd(hwnd,gui)
gui.controlWindow(hwnd,what,cx,cy,x,y)
top of page
gui.createFont(face,height,bold,ital,under)
gui.createGui(title,handlers,cx,cy,x,y,style,xstyle)
top of page
gui.deleteObject(o)
gui.destroyGui(gui)
top of page
gui.displayGui(gui)
gui.getDC(hwnd)
top of page
gui.getDlgCtrlID(hwnd)
gui.getDlgItem(hwnd,id)
top of page
gui.getStockObject(o)
gui.getSystemMetrics(sm)
top of page
System Metrics constants:
- gui.SM.CXSCREEN=0
- gui.SM.CYSCREEN=1
- gui.SM.CMOUSEBUTTONS=43
- gui.SM.MOUSEWHEELPRESENT=75
- gui.SM.CXVIRTUALSCREEN=78
- gui.SM.CYVIRTUALSCREEN=79
- gui.SM.CMONITORS=80
gui.getWindowLong(hwnd,off)
top of page
get/setWindowLong( ) flags:
- gui.GWL.WNDPROC=-4
- gui.GWL.HINSTANCE=-6
- gui.GWL.HWNDPARENT=-8
- gui.GWL.STYLE=-16
- gui.GWL.EXSTYLE=-20
- gui.GWL.GWL_ID=-12
gui.HIBYTE(w)
top of page
gui.HIWORD(l)
gui.LOBYTE(w)
top of page
gui.LOWORD(l)
gui.mainloop()
top of page
gui.MAKELONG(w1,w2)
gui.MAKEWORD(b1,b2)
top of page
gui.MessageBox(msg,title,flags)
Message Box constants:
- gui.MB.OK=0x0000
- gui.MB.OKCANCEL=0x0001
- gui.MB.ABORTRETRYIGNORE=0x0002
- gui.MB.YESNOCANCEL=0x0003
- gui.MB.YESNO=0x0004
- gui.MB.RETRYCANCEL=0x0005
- gui.MB.CANCELTRYCONTINUE=0x0006
- gui.MB.ICONHAND=0x0010
- gui.MB.ICONQUESTION=0x0020
- gui.MB.ICONEXCLAMATION=0x0030
- gui.MB.ICONASTERISK=0x0040
- gui.MB.SETFOREGROUND=0x00010000
- gui.MB.APPLMODAL=0x00000000
- gui.MB.SYSTEMMODAL=0x00001000
- gui.MB.TASKMODAL=0x00002000
ID button codes returned by MessageBox( ), also used in default dialog handling:
- gui.ID.OK=1
- gui.ID.CANCEL=2
- gui.ID.ABORT=3
- gui.ID.RETRY=4
- gui.ID.IGNORE=5
- gui.ID.YES=6
- gui.ID.NO=7
gui.MessageFmt(t,fmt,...)
top of page
gui.modifyMenu(id,what,gui)
gui.openFilename(dir,filename,flags,title,filters)
top of page
open/saveFilename( ) flags:
- gui.OFN.READONLY=0x0001
- gui.OFN.OVERWRITEPROMPT=0x0002
- gui.OFN.HIDEREADONLY=0x0004
- gui.OFN.NOCHANGEDIR=0x0008
- gui.OFN.ALLOWMULTISELECT=0x0200
- gui.OFN.PATHMUSTEXIST=0x0800
- gui.OFN.FILEMUSTEXIST=0x1000
- gui.OFN.CREATEPROMPT=0x2000
gui.peekloop()
top of page
gui.postWindowMessage(hwnd,msg,wp,lp)
gui.print(...)
top of page
gui.printf(fmt,...)
gui.registerHotkey(hk[,cb])
top of page
gui.resizeControls(w,h,gui)?
Control resize flags:
- gui.RESIZE.TOP=0x10000000*0x10
- gui.RESIZE.LEFT=0x20000000*0x10
- gui.RESIZE.WIDTH=0x40000000*0x10
- gui.RESIZE.HEIGHT=0x80000000*0x10
gui.saveFilename(dir,filename,flags,title,filters)
top of page
gui.sendControlMessage(id,msg,wp,lp,gui)
gui.sendWindowMessage(hwnd,msg,wp,lp)
top of page
gui.setGui(gui)
gui.setMinMaxInfo(minX,minY,maxX,maxY,gui)
top of page
gui.setTextColor(hDC,rgb)
gui.setWindowLong(hwnd,off,v)
top of page
gui.showPopupMenu(menu,x,y,id)
gui.steploop()
top of page
Class Gui
top of page
gui.Gui=g.Class:new('Gui')
Gui:setGui()
top of page
Gui:displayGui()
Gui:destroyGui()
top of page
Gui:hide()
Gui:show()
top of page
Gui:setText(s)
Gui:getText()
top of page
Gui:addControl(class,title,id,cx,cy,x,y,style,xstyle)
Gui:addMenu(menu)
top of page
Gui:addAccel(accel)
Gui:modifyMenu(id,what)
top of page
Gui:setMinMaxInfo(minX,minY,maxX,maxY)
Gui:resizeControls(w,h)
top of page
Gui:controlControl(id,what,cx,cy,x,y)
Gui:sendControlMessage(id,msg,wp,lp)
top of page
Gui:controlFromHwnd(hwnd)
Gui:acceptDragFiles(cb)
top of page
Class Control
top of page
gui.Control=g.Class:new('Control')
Control:sendMessage(msg,wp,lp)
top of page
Control:move(cx,cy,x,y)
Control:hide()
top of page
Control:show()
Control:enable()
top of page
Control:disable()
Control:destroy()
top of page
Control:focus()
Control:setText(s)
top of page
Control:getText()
Control:setColor(c)
top of page
Control:update()
Control:setRedraw(f)
top of page
Control:setFont(hf)
Control:clear()
top of page
Control:copy()
Control:cut()
top of page
Control:paste()
Control:undo()
top of page
Class Static
top of page
gui.Static=Control:new('Static')
Class Button
top of page
gui.Button=Control:new('Button')
Button:click()
top of page
Button:getCheck()
Button:isChecked()
top of page
Button:setCheck(chk)
Class Input
top of page
gui.Input=Control:new('Input')
Input:setTextLimit(n)
top of page
Input:isModified()
Input:setModified(m)
top of page
Input:canUndo()
Input:getSel()
top of page
Input:replaceSel(s,undo)
Input:setPasswordChar(ch)
top of page
Input:setReadOnly(ro)
Input:setSel(st,en)
top of page
Class Edit
top of page
gui.Edit=Input:new('Edit')
Edit:getLineCount()
top of page
Edit:getLine(n)
Class Listbox
top of page
gui.Listbox=Control:new('Listbox')
Listbox:reset()
top of page
Listbox:addString(s)
Listbox:deleteString(n)
top of page
Listbox:getText(n)
Listbox:getCount()
top of page
Listbox:getSelCount()
Listbox:getSel()
top of page
Class Combobox
top of page
gui.Combobox=Control:new('Combobox')
Combobox:reset()
top of page
Combobox:addString(s)
Combobox:deleteString(n)
top of page
Combobox:getLBText(n)
Combobox:getCount()
top of page
Combobox:getSel()
Class Richedit
top of page
gui.Richedit=Edit:new('Richedit')
Richedit:getSel()
top of page
Richedit:setSel(s,e)
Richedit:getSelText()
top of page
Class Datepicker
top of page
gui.Datepicker=Control:new('Datepicker')
Datepicker:setText(s,t,u)
top of page
Datepicker:setSystemTime(s,t,u)
Datepicker:getSystemTime()
top of page
Class Listview
top of page
gui.Listview=Control:new('Listview')
Listview:reset()
top of page
Listview:setXstyle(xs)
Listview:deleteItem(n)
top of page
Listview:ensureVisible(n)
Listview:getCount()
top of page
Listview:getSelCount()
Listview:getItem(n,sn)
top of page
Listview:getItemState(n)
Listview:insertColumn(col,len,fmt,n)
top of page
Listview:insertColumns(cols)
Listview:insertItem(it,n)
top of page
Listview:insertItems(its)
Listview:setCount(n)
top of page
Listview:setItem(it,n,sn)
Listview:setItemState(n,sel,chk)
top of page
Class Progressbar
top of page
gui.Progressbar=Control:new('Progressbar')
Progressbar:getPos()
top of page
Progressbar:setPos(n)
Progressbar:getRange()
top of page
Progressbar:setRange(lo,hi)
Progressbar:setStep(n)
top of page
Progressbar:step()
Class Statusbar
top of page
gui.Statusbar=Control:new('Statusbar')
Statusbar:setText(s,n)
top of page
Statusbar:getText(n)
Statusbar:setParts(t)
top of page
Class Trackbar
top of page
gui.Trackbar=Control:new('Trackbar')
Trackbar:getPos()
top of page
Trackbar:setPos(n)
Trackbar:getRange()
top of page
Trackbar:setRange(lo,hi)
Trackbar:setTicFreq(n)
top of page
Class Treeview
top of page
gui.Treeview=Control:new('Treeview')
Treeview:reset()
top of page
Treeview:deleteItem(tr)
Treeview:ensureVisible(tr)
top of page
Treeview:expand(tr,fl)
Treeview:getCount()
top of page
Treeview:getItem(tr)
Treeview:getItemState(tr)
top of page
Treeview:insertItem(tri,par,pos)
Treeview:selectItem(tr)
top of page
Treeview:setIndent(n)
Treeview:setItemState(tr,bold,chk)
top of page
Treeview:sortChildren(tr,fl)
Messages
top of page
The following lists show the currently supported messages, first the generic messages which are valid for all controls, and then the control specific messages. All messages are stored in separate tables inside module gui such that you would use gui.WM.CLOSE if you wanted to refer to the Windows message WM_CLOSE. As long as you use the class-based interface, there almost never a need to resort to these messages.
Window Messages (generic)
top of page
- gui.WM.CREATE=0x0001
- gui.WM.DESTROY=0x0002
- gui.WM.MOVE=0x0003
- gui.WM.SIZE=0x0005
- gui.WM.ACTIVATE=0x0006
- gui.WM.SETFOCUS=0x0007
- gui.WM.KILLFOCUS=0x0008
- gui.WM.ENABLE=0x000a
- gui.WM.SETREDRAW=0x000b
- gui.WM.SETTEXT=0x000c
- gui.WM.GETTEXT=0x000d
- gui.WM.GETTEXTLENGTH=0x000e
- gui.WM.CLOSE=0x0010
- gui.WM.QUERYENDSESSION=0x0011
- gui.WM.QUERYOPEN=0x0013
- gui.WM.ENDSESSION=0x0016
- gui.WM.QUIT=0x0012
- gui.WM.SHOWWINDOW=0x0018
- gui.WM.WININICHANGE=0x001a
- gui.WM.SETTINGCHANGE=0x001a
- gui.WM.GETMINMAXINFO=0x0024
- gui.WM.SETFONT=0x0030
- gui.WM.GETFONT=0x0031
- gui.WM.NOTIFY=0x004e
- gui.WM.NCDESTROY=0x0082
- gui.WM.KEYDOWN=0x0100
- gui.WM.KEYUP=0x0101
- gui.WM.CHAR=0x0102
- gui.WM.COMMAND=0x0111
- gui.WM.SYSCOMMAND=0x0112
- gui.WM.TIMER=0x0113
- gui.WM.HSCROLL=0x0114
- gui.WM.VSCROLL=0x0115
- gui.WM.INITMENU=0x0116
- gui.WM.INITMENUPOPUP=0x0117
- gui.WM.CTLCOLOREDIT=0x0133
- gui.WM.CTLCOLORLISTBOX=0x0134
- gui.WM.CTLCOLORBTN=0x0135
- gui.WM.CTLCOLORDLG=0x0136
- gui.WM.CTLCOLORSCROLLBAR=0x0137
- gui.WM.CTLCOLORSTATIC=0x0138
- gui.WM.CUT=0x0300
- gui.WM.COPY=0x0301
- gui.WM.PASTE=0x0302
- gui.WM.CLEAR=0x0303
- gui.WM.UNDO=0x0304
Dialog Messages (for dialog boxes)
top of page
- gui.DM.GETDEFID=0x0400
- gui.DM.SETDEFID=0x0401
- gui.DM.REPOSITION=0x0402
Button Messages
top of page
- gui.BM.GETCHECK=0x00f0
- gui.BM.SETCHECK=0x00f1
- gui.BM.CLICK=0x00f5
Combobox Messages
top of page
- gui.CBM.ADDSTRING=0x0143
- gui.CBM.DELETESTRING=0x0144
- gui.CBM.RESETCONTENT=0x014b
- gui.CBM.GETCURSEL=0x014e
- gui.CBM.GETLBTEXT=0x0148
- gui.CBM.GETLBTEXTLEN=0x0149
- gui.CBM.GETCOUNT=0x0146
Datetime Picker Messages
top of page
- gui.DTM.GETSYSTEMTIME=0x1001
- gui.DTM.SETSYSTEMTIME=0x1002
Edit Messages
top of page
- gui.EM.GETMODIFY=0x00b8
- gui.EM.SETMODIFY=0x00b9
- gui.EM.GETLINECOUNT=0x00ba
- gui.EM.GETLINE=0x00c4
- gui.EM.GETSEL=0x00b0
- gui.EM.REPLACESEL=0x00c2
- gui.EM.LIMITTEXT=0x00c5
- gui.EM.SETPASSWORDCHAR=0x00cc
- gui.EM.SETREADONLY=0x00cf
- gui.EM.SETSEL=0x00b1
- gui.EM.CANUNDO=0x00c6
- gui.EM.EXGETSEL=0x0434
- gui.EM.EXSETSEL=0x0437
- gui.EM.GETSELTEXT=0x043e
Listbox Messages
top of page
- gui.LBM.ADDSTRING=0x0180
- gui.LBM.DELETESTRING=0x0182
- gui.LBM.RESETCONTENT=0x0184
- gui.LBM.GETCURSEL=0x0188
- gui.LBM.GETTEXT=0x0189
- gui.LBM.GETTEXTLEN=0x018a
- gui.LBM.GETCOUNT=0x018b
- gui.LBM.GETSELCOUNT=0x0190
- gui.LBM.GETSELITEMS=0x0191
Listview Messages
top of page
- gui.LVM.DELETEITEM=0x1008
- gui.LVM.DELETEALLITEMS=0x1009
- gui.LVM.ENSUREVISIBLE=0x1013
- gui.LVM.GETITEM=0x1005
- gui.LVM.GETITEMSTATE=0x102c
- gui.LVM.GETITEMCOUNT=0x1004
- gui.LVM.GETITEMTEXT=0x102d
- gui.LVM.GETSELECTEDCOUNT=0x1032
- gui.LVM.INSERTCOLUMN=0x101b
- gui.LVM.INSERTITEM=0x1007
- gui.LVM.SETITEM=0x1006
- gui.LVM.SETITEMSTATE=0x102b
- gui.LVM.SETITEMCOUNT=0x102f
- gui.LVM.SETITEMTEXT=0x102e
- gui.LVM.SETEXTENDEDLISTVIEWSTYLE=0x1036
Progressbar Messages
top of page
- gui.PBM.GETPOS=0x0408
- gui.PBM.GETRANGE=0x0407
- gui.PBM.SETPOS=0x0402
- gui.PBM.SETRANGE=0x0406
- gui.PBM.SETSTEP=0x0404
- gui.PBM.STEPIT=0x0405
Statusbar Messages
top of page
- gui.SBM.SETTEXT=0x401
- gui.SBM.GETTEXT=0x0402
- gui.SBM.SETPARTS=0x0404
Trackbar Messages
top of page
- gui.TBM.GETPOS=0x0400
- gui.TBM.GETRANGEMIN=0x0401
- gui.TBM.GETRANGEMAX=0x0402
- gui.TBM.SETPOS=0x0405
- gui.TBM.SETRANGE=0x0406
- gui.TBM.SETTICFREQ=0x414
Treeview Messages
top of page
- gui.TVM.INSERTITEM=0x1100
- gui.TVM.DELETEITEM=0x1101
- gui.TVM.EXPAND=0x1102
- gui.TVM.GETCOUNT=0x1105
- gui.TVM.SETINDENT=0x1107
- gui.TVM.SELECTITEM=0x110b
- gui.TVM.GETITEM=0x110c
- gui.TVM.SETITEM=0x110d
- gui.TVM.SORTCHILDREN=0x1113
- gui.TVM.ENSUREVISIBLE=0x1114
- gui.TVM.ENDEDITLABELNOW=0x1116
Styles
top of page
The following lists show the currently supported window styles, first the generic styles which are valid for all controls, and then the control specific styles. All styles are stored in separate tables inside module gui such that you would use gui.WS.CHILD if you wanted to refer to the style WS_STYLE.
Window Styles (generic)
top of page
- gui.WS.BORDER=0x00800000
- gui.WS.CAPTION=0x00c00000
- gui.WS.CHILD=0x40000000
- gui.WS.CLIPCHILDREN=0x02000000
- gui.WS.CLIPSIBLINGS=0x04000000
- gui.WS.DISABLED=0x08000000
- gui.WS.DLGFRAME=0x00400000
- gui.WS.GROUP=0x00020000
- gui.WS.HSCROLL=0x00100000
- gui.WS.MAXIMIZE=0x01000000
- gui.WS.MAXIMIZEBOX=0x00010000
- gui.WS.MINIMIZE=0x20000000
- gui.WS.MINIMIZEBOX=0x00020000
- gui.WS.OVERLAPPED=0x0000
- gui.WS.OVERLAPPEDWINDOW=0x00cf0000
- gui.WS.POPUP=0x80000000
- gui.WS.POPUPWINDOW=0x80880000
- gui.WS.SIZEBOX=0x00040000
- gui.WS.SYSMENU=0x00080000
- gui.WS.TABSTOP=0x00010000
- gui.WS.THICKFRAME=0x00040000
- gui.WS.TILEDWINDOW=0x00cf0000
- gui.WS.VISIBLE=0x10000000
- gui.WS.VSCROLL=0x00200000
Window Styles (extended)
top of page
- gui.WSEX.ACCEPTFILES=0x0010
- gui.WSEX.APPWINDOW=0x00040000
- gui.WSEX.CLIENTEDGE=0x0200
- gui.WSEX.CONTEXTHELP=0x0400
- gui.WSEX.LAYERED=0x00080000
- gui.WSEX.LEFTSCROLLBAR=0x4000
- gui.WSEX.MDICHILD=0x0040
- gui.WSEX.OVERLAPPEDWINDOW=0x0300
- gui.WSEX.RIGHT=0x1000
- gui.WSEX.STATICEDGE=0x00020000
- gui.WSEX.TOOLWINDOW=0x0080
- gui.WSEX.TOPMOST=0x0008
- gui.WSEX.TRANSPARENT=0x0020
- gui.WSEX.WINDOWEDGE=0x0100
Dialog Styles
top of page
- gui.DS.CONTEXTHELP=0x2000
- gui.DS.MODALFRAME=0x0080
- gui.DS.SETFOREGROUND=0x0200
Button Styles
top of page
- gui.BS.TSTATE=0x0005
- gui.BS.AUTOTSTATE=0x0006
- gui.BS.AUTOCHECKBOX=0x0003
- gui.BS.AUTORADIOBUTTON=0x0009
- gui.BS.BITMAP=0x0080
- gui.BS.BOTTOM=0x0800
- gui.BS.CENTER=0x0300
- gui.BS.CHECKBOX=0x0002
- gui.BS.DEFPUSHBUTTON=0x0001
- gui.BS.FLAT=0x8000
- gui.BS.GROUPBOX=0x0007
- gui.BS.ICON=0x0040
- gui.BS.LEFT=0x0100
- gui.BS.MULTILINE=0x2000
- gui.BS.NOTIFY=0x4000
- gui.BS.PUSHBOX=0x000a
- gui.BS.PUSHBUTTON=0x0000
- gui.BS.PUSHLIKE=0x1000
- gui.BS.RADIOBUTTON=0x0004
- gui.BS.RIGHT=0x0200
- gui.BS.RIGHTBUTTON=0x0020
- gui.BS.TOP=0x0400
- gui.BS.VCENTER=0x0c00
Combobox Styles
top of page
- gui.CBS.AUTOHSCROLL=0x0040
- gui.CBS.DISABLENOSCROLL=0x0800
- gui.CBS.DROPDOWN=0x0002
- gui.CBS.DROPDOWNLIST=0x0003
- gui.CBS.LOWERCASE=0x4000
- gui.CBS.NOINTEGRALHEIGHT=0x0400
- gui.CBS.OEMCONVERT=0x0080
- gui.CBS.SIMPLE=0x0001
- gui.CBS.SORT=0x0100
- gui.CBS.UPPERCASE=0x2000
Common Control Styles (generic for common controls)
top of page
- gui.CCS.BOTTOM=0x0003
- gui.CCS.LEFT=0x0081
- gui.CCS.NODIVIDER=0x0040
- gui.CCS.NOMOVEX=0x0082
- gui.CCS.NOMOVEY=0x0002
- gui.CCS.NOPARENTALIGN=0x0008
- gui.CCS.NORESIZE=0x0004
- gui.CCS.RIGHT=0x0083
- gui.CCS.TOP=0x0001
- gui.CCS.VERT=0x0080
Datetime Picker Styles
top of page
- gui.DTS.LONGDATEFORMAT=0x0004
- gui.DTS.RIGHTALIGN=0x0020
- gui.DTS.SHORTDATEFORMAT=0x0000
- gui.DTS.SHOWNONE=0x0002
- gui.DTS.TIMEFORMAT=0x0009
- gui.DTS.UPDOWN=0x0001
Edit Styles
top of page
- gui.ES.AUTOHSCROLL=0x0080
- gui.ES.AUTOVSCROLL=0x0040
- gui.ES.CENTER=0x0001
- gui.ES.LEFT=0x0000
- gui.ES.LOWERCASE=0x0010
- gui.ES.MULTILINE=0x0004
- gui.ES.NOHIDESEL=0x0100
- gui.ES.NUMBER=0x2000
- gui.ES.OEMCONVERT=0x0400
- gui.ES.PASSWORD=0x0020
- gui.ES.READONLY=0x0800
- gui.ES.RIGHT=0x0002
- gui.ES.UPPERCASE=0x0008
- gui.ES.WANTRETURN=0x1000
Listbox Styles
top of page
- gui.LBS.DISABLENOSCROLL=0x1000
- gui.LBS.EXTENDEDSEL=0x0800
- gui.LBS.HASSTRINGS=0x0040
- gui.LBS.MULTICOLUMN=0x0200
- gui.LBS.MULTIPLESEL=0x0008
- gui.LBS.NODATA=0x2000
- gui.LBS.NOINTEGRALHEIGHT=0x0100
- gui.LBS.NOSEL=0x4000
- gui.LBS.NOTIFY=0x0001
- gui.LBS.SORT=0x0002
- gui.LBS.STANDARD=0x00a00003
- gui.LBS.USETABSTOPS=0x0080
- gui.LBS.WANTKEYBOARDINPUT=0x0400
Listview Styles
top of page
- gui.LVS.ALIGNLEFT=0x0800
- gui.LVS.ALIGNTOP=0x0000
- gui.LVS.AUTOARRANGE=0x0100
- gui.LVS.EDITLABELS=0x0200
- gui.LVS.ICON=0x0000
- gui.LVS.LIST=0x0003
- gui.LVS.NOCOLUMNHEADER=0x4000
- gui.LVS.NOLABELWRAP=0x0080
- gui.LVS.NOSCROLL=0x2000
- gui.LVS.NOSORTHEADER=0x8000
- gui.LVS.REPORT=0x0001
- gui.LVS.SHOWSELALWAYS=0x0008
- gui.LVS.SINGLESEL=0x0004
- gui.LVS.SMALLICON=0x0002
- gui.LVS.SORTASCENDING=0x0010
- gui.LVS.SORTDESCENDING=0x0020
Listview Styles (extended)
top of page
- gui.LVSEX.BORDERSELECT=0x8000
- gui.LVSEX.CHECKBOXES=0x0004
- gui.LVSEX.FLATSB=0x0100
- gui.LVSEX.FULLROWSELECT=0x0020
- gui.LVSEX.GRIDLINES=0x0001
- gui.LVSEX.HEADERDRAGDROP=0x0010
- gui.LVSEX.SUBITEMIMAGES=0x0002
- gui.LVSEX.TRACKSELECT=0x0008
- gui.LVSEX.DOUBLEBUFFER=0x00010000
Progressbar Styles
top of page
- gui.PBS.MARQUEE=0x0008
- gui.PBS.SMOOTH=0x0001
- gui.PBS.VERTICAL=0x0004
Static Styles
top of page
- gui.SS.BITMAP=0x000e
- gui.SS.BLACKFRAME=0x0007
- gui.SS.BLACKRECT=0x0004
- gui.SS.CENTER=0x0001
- gui.SS.CENTERIMAGE=0x0200
- gui.SS.ETCHEDFRAME=0x0012
- gui.SS.ETCHEDHORZ=0x0010
- gui.SS.ETCHEDVERT=0x0011
- gui.SS.GRAYFRAME=0x0008
- gui.SS.GRAYRECT=0x0005
- gui.SS.ICON=0x0003
- gui.SS.LEFT=0x0000
- gui.SS.LEFTNOWORDWRAP=0x000c
- gui.SS.NOPREFIX=0x0080
- gui.SS.NOTIFY=0x0100
- gui.SS.REALSIZEIMAGE=0x0800
- gui.SS.RIGHT=0x0002
- gui.SS.RIGHTJUST=0x0400
- gui.SS.SIMPLE=0x000b
- gui.SS.SUNKEN=0x1000
- gui.SS.WHITEFRAME=0x0009
- gui.SS.WHITERECT=0x0006
Trackbar Styles
top of page
- gui.TBS.AUTOTICKS=0x0001
- gui.TBS.BOTH=0x0008
- gui.TBS.BOTTOM=0x0000
- gui.TBS.ENABLESELRANGE=0x0020
- gui.TBS.FIXEDLENGTH=0x0040
- gui.TBS.HORZ=0x0000
- gui.TBS.LEFT=0x0004
- gui.TBS.NOTHUMB=0x0080
- gui.TBS.NOTICKS=0x0010
- gui.TBS.RIGHT=0x0000
- gui.TBS.TOP=0x0004
- gui.TBS.VERT=0x0002
Treeview Styles
top of page
- gui.TVS.CHECKBOXES=0x0100
- gui.TVS.DISABLEDRAGDROP=0x0010
- gui.TVS.EDITLABELS=0x0008
- gui.TVS.FULLROWSELECT=0x1000
- gui.TVS.HASBUTTONS=0x0001
- gui.TVS.HASLINES=0x0002
- gui.TVS.INFOTIP=0x0800
- gui.TVS.LINESATROOT=0x0004
- gui.TVS.NONEVENHEIGHT=0x4000
- gui.TVS.NOSCROLL=0x2000
- gui.TVS.NOTOOLTIPS=0x0080
- gui.TVS.SHOWSELALWAYS=0x0020
- gui.TVS.SINGLEEXPAND=0x0400
- gui.TVS.TRACKSELECT=0x0200
Notifications and States
top of page
These are a few predefined tables with control notifications and states. To use a notification like BN_CLICKED you would refer to gui.BN.CLICKED.
Button Notifications and States
top of page
- gui.BN.CLICKED=0
- gui.BN.DBLCLK=5
- gui.BN.SETFOCUS=6
- gui.BN.KILLFOCUS=7
- gui.BST.UNCHECKED=0
- gui.BST.CHECKED=1
- gui.BST.INDETERMINATE=2
- gui.BST.PUSHED=4
Combobox Notifications
top of page
- gui.CBN.SELCHANGE=1,
- gui.CBN.DBLCLK=2,
- gui.CBN.SETFOCUS=3,
- gui.CBN.KILLFOCUS=4,
- gui.CBN.EDITCHANGE=5,
- gui.CBN.EDITUPDATE=6,
- gui.CBN.DROPDOWN=7,
- gui.CBN.CLOSEUP=8,
- gui.CBN.SELENDOK=9
Edit Notifications
top of page
- gui.EN.SETFOCUS=0x0100
- gui.EN.KILLFOCUS=0x0200
- gui.EN.CHANGE=0x0300
Listbox Notifications
top of page
- gui.LBN.SELCHANGE=1
- gui.LBN.DBLCLK=2
- gui.LBN.SELCANCEL=3
- gui.LBN.SETFOCUS=4
- gui.LBN.KILLFOCUS=5
Listview Notifications
top of page
- gui.LVN.ENDLABELEDIT=-106
Scrollbar Notifications
top of page
- gui.SBN.LINEUP=0
- gui.SBN.LINEDOWN=1
- gui.SBN.PAGEUP=2
- gui.SBN.PAGEDOWN=3
- gui.SBN.THUMBPOSITION=4
- gui.SBN.THUMBTRACK=5
- gui.SBN.TOP=6
- gui.SBN.BOTTOM=7
- gui.SBN.ENDTRACK=8
Static Notifications
top of page
- gui.STN.CLICKED=0
- gui.STN.DBLCLK=1
Treeview Notifications
top of page
- gui.TVN.BEGINLABELEDIT=-410
- gui.TVN.ENDLABELEDIT=-411
Common control notifications (generic for all common controls)
top of page
- gui.NM.CLICK=-2
- gui.NM.DBLCLK=-3
- gui.NM.SETFOCUS=-7
- gui.NM.KILLFOCUS=-8
Common control alignment
top of page
- gui.FORMAT.LEFT=0
- gui.FORMAT.RIGHT=1
- gui.FORMAT.CENTER=2
Treeview item position
top of page
- gui.TVPOS.ROOT=-0x10000
- gui.TVPOS.FIRST=-0x0FFFF
- gui.TVPOS.LAST=-0x0FFFE
- gui.TVPOS.SORT=-0x0FFFD