From: Marc G. Fournier
-FORMS
+
+FORMS
-
This version (0.81) of PgAccess introduce the visual form builder.
+This version (0.82) of PgAccess introduce the visual form builder.
For the moment, it has only some basic widgets : labels, entries, buttons -, listboxes , checkboxes and radiobuttons.
+, listboxes , checkboxes and radiobuttons.Also there is a query widget that allows you yo have access to a query -results.
+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.
+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.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 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.
+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".
Let's presume that our form have the internal name mf (my
-form). He wil 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 .
+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. +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)
If you want to bound some controls to the fields of the recordset, you -will have to name their associate variable like that :
+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.
+.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.
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 )
-
Please feel free to send me your oppinion at teo@flex.ro on forms
-designing and usage.
-
-
This program is protected by the following copyright -
- -Latest version of PgAccess is 0.81 , 1 March 1998 !
+Latest version of PgAccess is 0.82 , 1 March 1998 !
+
-
|
I think that there were some problems loading libpgtcl library.
-I invite you to read a special section concerning
-libpgtcl
Here are some images from PgAccess windows : Main
+I think that there were some problems loading libpgtcl library.
+
I invite you to read a special section
+concerning libpgtcl
+
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.)
-
-
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
-
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 +
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.
- -However, the application should work without problems!
+least libpq and libpgtcl libraries. +However, the application should work without problems! diff --git a/src/bin/pgaccess/pga-rad.html b/src/bin/pgaccess/pga-rad.html index af4160b0c7..55d40046c2 100644 --- a/src/bin/pgaccess/pga-rad.html +++ b/src/bin/pgaccess/pga-rad.html @@ -1,198 +1,65 @@ -
-Beginning with 0.70 version, I have introduced in PgAccess two new modules -for operating with scripts and forms.
- - This would give to PgAccess the power of creating
-application directly into PgAccess, defining new modules, procedures, forms
-and possibly making it a rapid development tool for PostgreSQL. The "scripts"
-and "forms" modules are using two new tables called pga_forms
-and pga_scripts. PgAccess take care of creating them if user is opening
-a new database and grant ALL permissions on them to PUBLIC.
- Both scripts and forms are containing in fact sources
-of code written in Tcl/Tk and when the user has choose to "open"
-one of them, either by double-clicking in the main window or pressing the
-"Open" button PgAccess is searching for them in pga_forms or
-pga_scripts table, get the code and simply "eval" it !
- Of course, when Designing a script, a simple text editor
-is opened and text is saved as is in pga_scripts table. When "designing"
-a form, a "form editor" that would be very similar with "Visual
-Tcl" would be invoked.
This mechanism and the extremely versatile scripting -mode of Tcl/Tk would give PgAccess a great power for creating end user -application using PosgreSQL. The most important thing is that the user -could call procedures and functions that I have used for building up PgAccess -!
- - Forms are special Tcl/Tk source code that is used
-for creating windows and placing widgets inside it. When Tcl/Tk is "eval"
-them, a new window appears, with buttons as defined that could call "user
-defined scripts", "user defined procedures" or "internal
-PgAccess procedures".
- For the moment, 0.70 version of PgAccess does not have
-a module for designing forms. It is intended to make an interface to the
-most powerful program of designing applications under Tcl/Tk , Visual Tcl
-, so it could handle forms designed to be used inside PgAccess.
- Forms can hold all the widgets allowed in Tcl/Tk , buttons,
+Beginning with 0.70 version, I have introduced in PgAccess two new modules
+for operating with scripts and forms.
+
+
This would give to PgAccess the power of creating application
+directly into PgAccess, defining new modules, procedures, forms and possibly
+making it a rapid development tool for PostgreSQL. The "scripts" and "forms"
+modules are using two new tables called pga_forms and pga_scripts. PgAccess
+take care of creating them if user is opening a new database and grant
+ALL permissions on them to PUBLIC.
+
+
Of course, when Designing a script, a simple text editor
+is opened and text is saved as is in pga_scripts table. When "designing"
+a form, a "form editor" that would be very similar with "Visual Tcl" is
+invoked.
+
+
This mechanism and the extremely versatile scripting mode +of Tcl/Tk would give PgAccess a great power for creating end user application +using PosgreSQL. The most important thing is that the user could call procedures +and functions that I have used for building up PgAccess ! +
Scripts are normal Tcl/Tk code that is interpreted
-by Tcl/Tk. You can define your own procedures inside a script called "Library"
-for example. You can call your procedures from within another script, from
-another procedure.
- The most important thing is that you have total access
+"shell", a startup point for you applications. See the special
+section concerning forms.
+
-
We would like to give you some examples for using forms and scripts. -First of all, get your PgAccess 0.70 version NOW !
- - Define your first
-form. Remember, the form design module hasn't arrived yet :-( , so you
-will have to define your first form using an action query :
-1. Click on Query tab and press "New" button
-2. Enter "Generate my first form" in Query name field
-3. Copy and paste from your browser window into query definition area the
-next text :
-
-insert into pga_forms values('My first form',' set base .pga_win_1;
-if {[winfo exists $base]} { wm deiconify $base; return }; toplevel $base
--class Toplevel; wm focusmodel $base passive; wm geometry $base 395x389+325+188;
-wm maxsize $base 1009 738; wm minsize $base 1 1; wm overrideredirect $base
-0; wm resizable $base 1 1; wm deiconify $base; wm title $base "User
-defined Form No.1"; button $base.b1 -command {execute_script "My
-first script"} -text "My first button" ; button $base.bexit
--command {destroy [focus]} -padx 9 -pady 3 -text Exit ; place $base.bexit
--x 340 -y 355 -anchor nw -bordermode ignore ; place $base.b1 -x 10 -y 10
--anchor nw;');
4. Press "Save query definition button" and then "Close"
-5. In the mai window, select by clicking the query "Generate my first
-form" and press "Open" button.
Your query must have been executed without errors! If you will check -now the "Forms" tab, you will find there your first form. Press -"Open" button and enjoy it! For the moment, if you will press -"My first button" you will get an error message. Of course : -we haven't yet defined our first script !
- - Defining our first
-script :
-1. Click on Scripts tab and pres "New" button
-2. Enter "My first script" in script's name field
-3. Enter the body as the script the following statements :
-
-MsgBox "Warning" "PgAccess unleashed!"
-open_table pga_scripts
-
-4. Press "Save" button then "Cancel"
It's now the time to define our first library script. I am defining -not because I need it. I could write directly in "My first script" -the instructions for creating that warning window but I only wanted to -show you how you can mix PgAccess script execution with Tcl/Tk code and -so on.
- - Define our first
-library that will contain your "user defined" Tcl/Tk procedures
-and functions :
-1. Click on Scripts tab and pres "New" button
-2. Enter "My first library" in script's name field
-3. Enter the body of the script the following statements :
-
-proc MsgBox {title msg} {
- tk_messageBox -title $title -message
-$msg
-}
-
-4. Press "Save" button then "Cancel"
Define
-our first autoexec script that will contain commands that will be executed
-when opening database :
-1. Click on Scripts tab and pres "New" button
-2. Enter "Autoexec" in script's name field
-3. Enter the body of the script the following statements :
-
-execute_script "My first library"
-open_form "My first form"
-
-4. Press "Save" button then "Cancel"
Everything is OK now! You will have to exit PgAccess and enter it again -opening the same database ! Voila , your first form will pop-up on the -screen, a message box is displayed and after clicking Ok button the table -pga_scripts will be opened in table viewer revealing what's inside ! With -this occasion I have shown how you could open in table view mode a "pga_..." -system table that is hidden by PgAccess in main view mode!
- -I am stopping here, asking you to try this new features and sending
-me as more feed-backs as you can! What do you think about this new features
-? How would you like to be developed PgAccess in future ? In this
-moment, I am working in recoding the main part of PgAccess in order to
-give to the user more "system" functions that would help him
-creating new applications very easy.
-
-Remember : I'm waiting your messages at teo@flex.ro
-
-
You will also have the ability of hiding the main window of PgAccess
-at the beginning of "Autoexec" script execution and showing it
-before destroying "My first form". For this example, delete the
-previously defined "My first form" and create it with another
-action query with this code :
-
-insert into pga_forms values('My first form',' set base .pga_win_1;
-if {[winfo exists $base]} { wm deiconify $base; return }; toplevel $base
--class Toplevel; wm focusmodel $base passive; wm geometry $base 395x389+325+188;
-wm maxsize $base 1009 738; wm minsize $base 1 1; wm overrideredirect $base
-0; wm resizable $base 1 1; wm deiconify $base; wm title $base "User
-defined Form No.1"; button $base.b1 -command {execute_script "My
-first script"} -text "My first button" ; button $base.bexit
--command {Window show .dw ; destroy [focus]} -padx 9 -pady 3 -text Exit
-; place $base.bexit -x 340 -y 355 -anchor nw -bordermode ignore ; place
-$base.b1 -x 10 -y 10 -anchor nw;');
-
-This new one is just showing main window (.dw) before destroying the
-"user defined window" .
-Also make "Autoexec" script to show like this :
-
-execute_script "My first library"
-Window hide .dw
-open_form "My first form"
-