1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; Linux 2.0.32 i586) [Netscape]">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFEBCD" LINK="#0000EF" VLINK="#51188E" ALINK="#FF0000">
<H1>FORMS</H1>
<P>
<HR WIDTH="100%"></P>
<P>This version (0.81) of PgAccess introduce the visual form builder.</P>
<P>For the moment, it has only some basic widgets : labels, entries, buttons
, listboxes , checkboxes and radiobuttons.</P>
<P>Also there is a query widget that allows you yo have access to a query
results.</P>
<P>In a manner very similar with Visual Tcl or Visual Basic, the user must
select a widget from the toolbar and drags on the canvas the rectangle
that would define the widget. It can also specify some attributes in a
separate window. Renaming, resizing items are possible modifying parameters
in attribute window. Do not forget to press Enter in the edit field after
changing a value in order to be accepted.</P>
<P>You can also move items by dragging them or delete them by pressing
Del key.</P>
<P>In attribute window, there are some fields named <B><TT><FONT SIZE=+1>Command
</FONT></TT></B>and <B><TT><FONT SIZE=+1>Variable</FONT></TT></B>.</P>
<P>The field <B><TT><FONT SIZE=+1>Command </FONT></TT></B>have meaning
only for Button widgets and holds the command that will be invoked when
the button is pressed.</P>
<P>The field <B><TT><FONT SIZE=+1>Variable </FONT></TT></B>have meaning
only for EditField , Label widgets and checkboxes and it is the name of
the global variable that will hold the value for that widget. For checkboxes
the values are 1 or 0.</P>
<P>In order to make a simple test, put an entry field and set it's variable
to <B>v1</B> and a button who's command is "set v1 whisky". Press
the button "Test form" and click on the button. In that entry
should appear whisky. <BR>
Another test is defining in Script module a script called "My first
script" having the following commands:<BR>
<TT><FONT SIZE=+1>tk_messageBox -title Warning -message "This is my
first message!"<BR>
</FONT></TT>and then define a button who's command is <B><TT><FONT SIZE=+1>execute_script
"My first script"</FONT></TT></B>.</P>
<H2>Database manipulation</H2>
<P>Let's presume that our form have the internal name <B><TT>mf </TT></B>(my
form). He wil be referred inside the Tcl/Tk source as <B><TT>.mf<BR>
</TT></B>If you want to close the form in run-time you have to issue the
command <B><TT>destroy .mf</TT></B></P>
<P>Also, any widget will have the name prefixed by <B><TT>.mf </TT></B> We
will have <B><TT>.mf.button1</TT></B> or <B><TT>.mf.listbox1</TT></B> .</P>
<P>We can name the query widget <B><TT>qry</TT></B> for example. The complete
name will be <B><TT>.mf.qry</TT></B> then.<BR>
The <B><TT>Command </TT></B>property of the query widget must contain the
SQL command that will be executed.<BR>
When the form will be in run-time, automatically you will have acces to
the following methods :</P>
<P><TT>.mf.qry:execute</TT> - opens the connection and execute the query
(returns nothing)<BR>
<TT>.mf.qry:nrecords</TT> - returns the number of records in the selected
query<BR>
<TT>.mf.qry:fields</TT> - returns a list of the fields in the result set<BR>
<TT>.mf.qry:movefirst</TT> - move the cursor to the first record in the
recordset<BR>
<TT>.mf.qry:movelast , .mf.qry:movenext , .mf.qry:moveprevious </TT>- moves
the cursor <BR>
<TT>.mf.qry:updatecontrols</TT> - update the variables inside the designed
form that have a particular name (I'll explain later)<BR>
<TT>.mf.qry:close</TT> - close the connection (<B><FONT COLOR="#FF0000">if
you don't close the query result, you will loose memory</FONT></B>)</P>
<P>If you want to bound some controls to the fields of the recordset, you
will have to name their associate variable like that :</P>
<P><TT>.mf.qry.salary</TT> to get the "salary" field , or <TT>.mf.qry.name</TT>
to get the "name" field.</P>
<P>It's simple, isn't it ? It's just like a new widget that have some properties
and methods that can be accesed.<BR>
Also, the name convention is just like in Tcl/Tk.</P>
<P>
<HR WIDTH="25%"></P>
<P>Please feel free to send me your oppinion at <B>teo@flex.ro</B> on forms
designing and usage.<BR>
</P>
</BODY>
</HTML>
|