From 8175eb3485fbfa534529e8cff8242f3249fa9243 Mon Sep 17 00:00:00 2001
From: "Marc G. Fournier"
+
-FORMS
+FORMS
-
+
This version (0.82) of PgAccess introduce the visual form builder. +
This version (0.83) of PgAccess has changed a little the visual form +builder introduced since 0.82 version : variable handling, query-results +interface and control bindings naming convention. Please read it carefully, +download the database demo and practice a while before trying to design +your own forms.
For the moment, it has only some basic widgets : labels, entries, buttons -, listboxes , checkboxes and radiobuttons. +, listboxes , checkboxes and radiobuttons.
+ +Also there is a pseudo query widget that allows you yo have access to +a query results.
+ +How do you generate widgets :
+ +Also there is a query widget that allows you yo have access to a query -results. +
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. +
In the rectangle that you have designed it will appear the selected
+object.
+Move now to the attribute window to change some of its properties.
Renaming, resizing items are possible (for the moment) only by modifying +appropriate parameters in attribute window. You must press Enter +in the edit field after changing a value in order to be accepted.
You can also move items by dragging them or delete them by pressing -Del key. +Del key after selecting them.
In attribute window, there are some fields named Command -and Variable. +and Variable.
The field Command have meaning only for Button widgets and holds the command that will be invoked when -the button is pressed. - -
The field Variable 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. - -
In order to make a simple test, put an entry field and set it's variable
-to v1 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.
-
Another test is defining in Script module a script called "My first
-script" having the following commands:
-
tk_messageBox -title Warning -message "This is my
-first message!"
-
and then define a button who's command is execute_script
-"My first script".
-
The field Variable have +meaning only for EditField , Label widgets , checkboxes and radiobuttons +and it is the name of the global variable that will hold the value for +that widget. For checkboxes the values are t and f (from +true and false) in order to simplify binding to logical data fields (PgAccess +0.82 used 0 and 1).
+ +For radiobuttons, it is usual to assign the +same variable to the same radiobuttons within the same group. That variable +will contain the name of the widget of the radiobutton that has been pressed. +Let's presume that you have entered 3 radiobuttons named red, green and +blue, all of them having the same variable named color. If you will press +them, they will assign their names to global variable.
+ + In order to make a simple test, put an entry
+field and set it's variable to v1 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.
+Another test is defining in Script module a script called "My first
+script" having the following commands:
+tk_messageBox -title Warning -message "This is my
+first message!"
+and then define a button who's command is execute_script
+"My first script".
Let's presume that our form have the internal name mf (my
+form). He will be referred inside the Tcl/Tk source as .mf
+
+If you want to close the form in run-time you have to issue the command
+destroy .mf
Also, any widget will have the name prefixed by .mf We will have .mf.button1 or .mf.listbox1 -. +.
We can name the query widget qry for example. The complete
-name will be .mf.qry then.
-
The Command property of the query widget must contain
-the SQL command that will be executed.
-
When the form will be in run-time, automatically you will have acces
-to the following methods :
-
-
.mf.qry:execute - opens the connection and execute the query
-(returns nothing)
-
.mf.qry:nrecords - returns the number of records in the selected
-query
-
.mf.qry:fields - returns a list of the fields in the result
-set
-
.mf.qry:movefirst - move the cursor to the first record in
-the recordset
-
.mf.qry:movelast , .mf.qry:movenext , .mf.qry:moveprevious -
-moves the cursor
-
.mf.qry:updatecontrols - update the variables inside the designed
-form that have a particular name (I'll explain later)
-
.mf.qry:close - close the connection (if
-you don't close the query result, you will loose memory)
+name will be .mf.qry then.
+The Command property of the query widget must contain the
+SQL command that will be executed.
+When the form will be in run-time, automatically you will have acces to
+the following procedures and functions :
.mf.qry:open - opens the connection and execute the
+query (returns nothing)
+.mf.qry:setsql newsql - set the command query that will
+be executed at the next .mf.qry:open
+.mf.qry:nrecords - returns the number of records in the selected
+query
+.mf.qry:crtrecord - returns the current record number inside
+the query result
+.mf.qry:fields - returns a list of the fields in the result
+set
+.mf.qry:movefirst - move the cursor to the first record
+in the recordset
+.mf.qry:movelast , .mf.qry:movenext , .mf.qry:moveprevious
+- moves the cursor there
+.mf.qry:moveto newrecno - move the cursor to that new record
+number (first is 0)
+.mf.qry:updatecontrols - update the variables inside the
+designed form that have a particular name (I'll explain later)
+.mf.qry:clearcontrols - clear the variables inside the
+designed form binded to a query result
+.mf.qry:fill listbox field - fill the named listbox (whole
+widget name as .mf.listbox1) with the all the values of
+that field in the current queryresult
+.mf.qry:close - close the connection (if
+you don't close the query result, you will loose some memory)
+
It's no need to close a query-result if you want to assign it a new +SQL command and open it again. That will be done automatically.
If you want to bound some controls to the fields of the recordset, you -will have to name their associate variable like that : - -
.mf.qry.salary to get the "salary" field , or .mf.qry.name -to get the "name" field. - -
It's simple, isn't it ? It's just like a new widget that have some properties
-and methods that can be accesed.
-
Also, the name convention is just like in Tcl/Tk.
+will have to name their associate variable like that :
mfqry(salary) to get the "salary" field ,
+or mfqry(name) to get the "name" field. So, you
+take the internale name of the form (without the leading point) and merge
+it with the query-widget name and you will get a associative arrayname.
+The values are given using the field name as a key in this associative
+array.
+* WARNING * The naming style has been
+changed from 0.82 version of PgAccess and I cannot guarantee that it not
+be changed again in the future. I'm just trying to make it as simple it
+could be. The old style naming convention had some incompatibilities with
+Tcl/Tk syntax.
QUESTION : Do +you think that it would be more clear if the above functions and procedures +regarding a query-widget would be named in a similar manner as binded variable +controls ? That mean, mfqry:open and mfqry:updatecontrols +instead of .mf.qry:open and .mf.qry:updatecontrols +?
+ +The only advantage of .mf.qry:open is that is much closer +to the Tk method of referring objects within a window and it may give to +the programmer the feeling that he is using a object-oriented widget. Since +I cannot use further for naming binded variables a similar manner (.mf.qry.salary) +it might be possible to abandon that naming convention .
+ +Here it is a dumped sample database
+that contains a demo database. What should you do ?
+Shift-click the above URL in order to download that tiny file (4 Kb). Create
+a empty database and psql yourdatabase <formdemo.sql
You should find a single table called "phonebook" a form called +"Phone book" and another "A simple demo form".
+ +First of all enter and view the phonebook table in table view. Note
+the fields and their values.
+Open the "Phone book" form and enter a letter (a, e or i) in
+the field to the left of "Find" button then press Find. It's
+fine to enter one letter in order to get more records in query result.
+You will get information about the number of records selected, in the listbox
+you will see all the values of field "name" from the current
+data set. Use buttons to move to first, next, previous or last record within
+the record set.
In order to add a new record, press the "New" button in order +to get new, clean entries. Fill them with your data and press "Add +new" button. A new phonebook record will be added. Also, if you want +to update a record, change it's values in the displayed fields after finding +it and press "Update" button. The values will be updated in the +database BUT NOT IN THE CURRENT QUERY RESULT . If you want to see them +modified, make a new query trying to find it again.
+ +Before using the results from a query you should +know that the information that has been retrieved could be found only in +your computer client memory. It has no live connection to the data +from the database. That's why it isn't possible to develop a simple update +function as interface to that query-result widget. More than that : a query +result could be obtained from a SQL command that return a non-updatable +data set !!! For example fields gathered from multiple tables or summary +fields. It isn't just simple to make an automatic update procedure. The +programmer must know how to make the update or the append procedure, sometimes +using key fields to point to the desired record or an OID. There are examples +in the demo database in "Phone book" form. It may be possible +that in the future, I will develop another pseudo-widget describing a table. +It would be more simple than to implement an update or append or even a +delete procedure.
+ +There is in the demo database also another simple form called "A +simple demo form". It will show you how to handle variables from checkboxes, +radiobuttons, how to use listboxes, open another forms and so on. I think +they will help you.
In order to avoid naming user defined forms with a particular name of another PgAccess form, I would recommend naming them as udf0, udf1 -(user defined form 0 , 1 ) +(user defined form 0 , 1 )
-
Please feel free to send me your oppinion at teo@flex.ro on forms -designing and usage. +designing and usage.
+ +KEEP IN MIND ! THE
+FORM API WILL CHANGE IN ORDER TO BE MORE SIMPLE AND BETTER! SEND
+ME YOUR WISHES, YOUR IDEAS, YOUR OPINIONS !
+ALSO ... DON'T BLAME ME IF YOU WILL HAVE TO RE-DESIGN YOUR OLD FORMS DUE
+TO SOME INCOMPATIBILITIES WITH NEWER PGACCESS VERSIONS.
+
This program is protected by the following copyright -
Latest version of PgAccess is 0.83 , 11 March 1998 !
+
Latest version of PgAccess is 0.82 , 1 March 1998 !
-
- PgAccess can now design Forms, +Reports and Scripts + |
Here are some images from PgAccess windows : Main window , table builder , table(query) -view , visual query builder . - -
Tables
-
- opening tables for viewing, max 200 records (changed by preferences
-menu)
-
- column resizing, dragging the vertical grid line (better in table
-space rather than in the table header)
-
- text wrap in cells - layout saved for every table
-
- import/export to external files (SDF,CSV)
-
- filter capabilities (enter filter like (price>3.14)
-
- sort order capabilities (enter manually the sort field(s))
-
- editing in place
-
- improved table generator assistant
-
- improved field editing
-
Queries
-
- define , edit and stores "user defined queries"
-
- store queries as views
-
- execution of queries
-
- viewing of select type queries result
-
- query deleting and renaming
-
- Visual
-query builder with drag & drop capabilities. For any of you who had
-installed the Tcl/Tk plugin for Netscape Navigator, you can see it at work
-clicking here
-
Sequences
-
- defines sequences, delete them and inspect them
-
Functions
-
- define, inspect and delete functions in SQL language
-
Reports
-
- design and display simple reports from tables
-
- fields and labels, font changing, style and size
-
- saves and loads report description from database
-
- show report previews, sample postscript output file
-
Forms
-
- open user defined forms
-
- form design module available
-
- query widget available, controls bound to query results
-
- click here for a description of forms and
-how they can be used
-
Scripts
-
- define, modify and call user defined scripts
-
Here is a special section concerning forms and
-scripts .
-
-
On the TODO list!
-
- table design (add new fields, renaming, etc.)
-
-
+view
, visual query builder . + +Tables
+- opening tables for viewing, max 200 records (changed by preferences menu)
+
+- column resizing, dragging the vertical grid line (better in table space
+rather than in the table header)
+- text wrap in cells - layout saved for every table
+- import/export to external files (SDF,CSV)
+- filter capabilities (enter filter like (price>3.14)
+- sort order capabilities (enter manually the sort field(s))
+- editing in place
+- improved table generator assistant
+- improved field editing
+Queries
+- define , edit and stores "user defined queries"
+- store queries as views
+- execution of queries
+- viewing of select type queries result
+- query deleting and renaming
+- visual query builder with drag & drop capabilities. For any of you
+who had installed the Tcl/Tk plugin for Netscape Navigator, you can see
+it at work clicking here
+Sequences
+- defines sequences, delete them and inspect them
+Functions
+- define, inspect and delete functions in SQL language
+Reports
+- design and display simple reports from tables
+- fields and labels, font changing, style and size
+- saves and loads report description from database
+- show report previews, sample postscript output file
+Forms
+- open user defined forms
+- form design module available
+- query widget available, controls bound to query results
+- click here for a description of forms and how
+they can be used
+Scripts
+- define, modify and call user defined scripts
+Here is a special section concerning forms and scripts
+.
On the TODO list!
+- table design (add new fields, renaming, etc.)
If you have any comment, suggestion for improvements, please feel free -to e-mail to : teo@flex.ro +to e-mail to : teo@flex.ro
Mailing list for PgAccess Here -you will find how to subscribe to this mailing list. +you will find how to subscribe to this mailing list.
-
Also, you will need the PostgreSQL to Tcl interface library, lined as
+a Tcl/Tk 'load'-able module. It is called libpgtcl and the source is located
in the PostgreSQL directory /src/interfaces/libpgtcl. Specifically, you
will need a libpgtcl library that is 'load'-able from Tcl/Tk. This is technically
different from an ordinary PostgreSQL loadable object file, because libpgtcl
is a collection of object files. Under Linux, this is called libpgtcl.so.
-
You can download from here a version already
-compiled for Linux i386 systems. Just copy libpgtcl.so into your system
-library director (/usr/lib) and go for it. One of the solutions is to remove
-from the source the line containing load libpgtcl.so and to load
-pgaccess.tcl not with wish, but with pgwish (or wishpg) that wish that
-was linked with libpgtcl library!
+
+You can download from here a version already
+compiled for Linux RedHat 4.2 i386 systems. Just copy libpgtcl.so into
+your system library directory (/usr/lib or /lib) and go for it. One of
+the solutions is to remove from the source the line containing load
+libpgtcl.so and to load pgaccess.tcl not with wish, but with pgwish
+(or wishpg) that wish that was linked with libpgtcl library!
If you have installed RedHat 5.0, you should get the last distribution kit of postgreSQL and compile it from scratch. RedHat 5.0 is using some new versions of libraries and you have to compile and install again at -least libpq and libpgtcl libraries. +least libpq and libpgtcl libraries.
+ +However, the application should work without problems!
-However, the application should work without problems!
diff --git a/src/bin/pgaccess/pgaccess.tcl b/src/bin/pgaccess/pgaccess.tcl
index 0a3d3bb8914..775fc310086 100644
--- a/src/bin/pgaccess/pgaccess.tcl
+++ b/src/bin/pgaccess/pgaccess.tcl
@@ -728,6 +728,12 @@ if {$fdvar(oper)=="move"} {
if {$fdvar(oper)!="draw"} return
set fdvar(oper) none
.fd.c delete curdraw
+# Check for x2 The problem is related with some special characters used in different
+countries because PgAccess did not use fonts with `-ISO8859-1' encoding
+-- The sollution was proposed by H.P.Heidinger ( hph@hphbbs.ruhr.de) and
+it's very simple. If you look into PgAccess, you will find fonts declared as follows : $ grep -e '-font' -i pgaccess.tcl It should be something like: -adobe-helvetica-medium-r-normal-*-*-120-*-*-*-*-iso8859-1 You can achieve this by running the following script : #!/bin/sh The final version of PgAccess (1.0) will let the user decide what fonts
+will be used through a "preferences" dialog window.Special locale characters and PgAccess
+
+
+
+-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* \
+-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* \
+-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* \
+-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* \
+cp pgaccess.tcl pgaccess.tcl-org
+cat pgaccess.tcl |\
+sed -e's/\-\*\-\*\ /\-iso8859\-1\ /g' |\
+sed -e's/\-\*\-\*\}/\-iso8859\-1}/g' |\
+sed -e's/\-\*\-\*\]/\-iso8859\-1]/g' |\
+sed -e's/\-\*\-\*$/\-iso8859\-1/g' |\
+sed -e's/\-Clean\-/\-Fixed\-/g' |\
+sed -e's/clean/fixed/g' >pgaccess.iso
+mv pgaccess.iso pgaccess.tcl
+chmod +x pgaccess.tcl