I am writing a visual form designer (much closer to vTcl) for PgAccess,
a Tcl/Tk frontend to PostgreSQL ( http://www.flex.ro/pgaccess ).

I have the idea of simulating a database specific widget, for example a
database set, by defining some procedures with a very particular name,
making the user to believe it is a "object oriented widget".

So, assuming that the form is called .tf (test form) , and the "virtual
widget" will be named ds (data set), I could make references in Tcl/Tk
style to that "virtual widget" as   .tf.ds , ok ?

Now, let's say that I want to make some assignments to "properties of
that virtual widget", let's say the property called query, of string
type that will hold the SQL command to be executed for select.

Then I could say like that :

.tf.ds:query "select * from cities where people > 150000"
.tf.ds:execute
.tf.ds:movefirst
.tf.ds:movenext
.tf.ds:movelast
.tf.ds:close

Look nice and sounds "object oriented", isn't it ? People will believe
that "there is a database widget" with that properties and methods. It
would be quite elegant.

Then I have defined a normal Tcl procedure as follows :

proc {.tf.ds:query} {qry} {
   set dataset(ds,query) $qry
}

Everything is working fine, even in vTcl , but when I'm saving the
program, inside the source generated by vTcl that procedure didn't
appear. It seems that vTcl ignore it (probably because it's starting
with . as visual widgets do).

More than that. If I'm adding the above procedure inside vTcl, it is
added to "procedure list", it can be called from a button command for
example, but IT DIDN'T APPEAR IN PROCEDURE LIST WINDOW !!!

I think that this method could make more clear and easy to understand
Tcl/Tk sources dealing with databases.

Please Allen, could you verify if you can fix it ?
If it's too complicated, I could change the syntax of manipulating
"pseudo-widget" properties using an associative array like that :

set datasets(.ft.ds,query) "select * from cities"

but I will loose that nice pseudo "object oriented" syntax.

Please cc: me directly to [EMAIL PROTECTED]

-- 
Constantin Teodorescu
FLEX Consulting Braila, ROMANIA
---------------------------------------------------------------------------
To unsubscribe from the Visual Tcl mailing list, please send a message
to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
message body (where [EMAIL PROTECTED] is your e-mail address).

Reply via email to