aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pgaccess/forms.html
blob: 93308cd99ddb559b2e16bed4e5e4133cc21d00c8 (plain)
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
105
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i586) [Netscape]">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFEBCD" LINK="#0000EF" VLINK="#51188E" ALINK="#FF0000">

<H1>
FORMS</H1>

<HR WIDTH="100%">

<P>This version (0.82) of PgAccess introduce the visual form builder.

<P>For the moment, it has only some basic widgets : labels, entries, buttons
, listboxes , checkboxes and radiobuttons.

<P>Also there is a query widget that allows you yo have access to a query
results.

<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>You can also move items by dragging them or delete them by pressing
Del key.

<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>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>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>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!"</FONT></TT>
<BR>and then define a button who's command is <B><TT><FONT SIZE=+1>execute_script
"My first script"</FONT></TT></B>.
<H2>
Database manipulation</H2>
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</TT></B>
<BR>If you want to close the form in run-time you have to issue the command
<B><TT>destroy .mf</TT></B>

<P>Also, any widget will have the name prefixed by <B><TT>.mf&nbsp;</TT></B>&nbsp;&nbsp;&nbsp;&nbsp;
We will have <B><TT>.mf.button1</TT></B> or <B><TT>.mf.listbox1</TT></B>
.

<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><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>If you want to bound some controls to the fields of the recordset, you
will have to name their associate variable like that :

<P><TT>.mf.qry.salary</TT> to get the "salary" field , or <TT>.mf.qry.name</TT>
to get the "name" field.

<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>In order to avoid naming user defined forms with&nbsp; a particular
name of another PgAccess form, I would recommend naming them as udf0, udf1
(user defined form 0 , 1 )

<P>
<HR WIDTH="25%">

<P>Please feel free to send me your oppinion at <B>teo@flex.ro</B> on forms
designing and usage.
</BODY>
</HTML>