The Form class is base class for Windows forms. A The Form
class is a container for any kind of forms or dialogs containing
child controls.
access function: CreateForm(name='')
Attribute |
Access |
Type |
Description |
name |
R |
string |
the name of the control |
modalResult |
R |
int |
modal result of showModal() method |
dormStyle |
R/W |
int |
fsNormal=0, fsMDIChild=1, fsMDIForm=2,
fsStayOnTop=3 |
borderStyle |
R/W |
int |
None=0, Single=1, Sizeable=2, Dialog=3,
ToolWindow=4,
SizeToolWin=5 |
borderIcons |
R/W |
ibt |
integer set of SystemMenu=1, Minimize=2,
Maximize=4 Help=8 |
Method |
Returns |
Description |
getHandle() |
int |
returrns Windows HWINDOW handle of
the form |
show() |
bool |
shows the form modeless |
showModal() |
int |
shows form as modal dialog, returns
model result due to form options and user selection |
Example 1 - Simple OkCancel dialog
def FormOKCancelDemo():
frm=CreateForm()
frm.caption='OK or Cancel'
frm.borderIcons=1
frm.width=200
frm.height=80
ok=frm.addControl('Button')
ok.caption='OK'
ok.left=20
ok.modalResult=1
cancel=frm.addControl('Button')
cancel.caption='Cancel'
cancel.left=ok.right+8
cancel.modalResult=2
print 'User pressed',['','OK','Cancel'][frm.showModal()]
|