1 2-- 3-- PgAccess PgAckage 4-- 5 6-- PGA 7 8 INSERT INTO pga_graphs (graphsource, graphcode, graphname) 9 VALUES ('cities','variable ::Graphs::lineWidth ; set ::Graphs::lineWidth {2} ; variable ::Graphs::labelGap ; set ::Graphs::labelGap {5} ; variable ::Graphs::dataSeriesNames ; lappend ::Graphs::dataSeriesNames {id} ; variable ::Graphs::xtitle ; set ::Graphs::xtitle {City} ; variable ::Graphs::type ; set ::Graphs::type {bar} ; variable ::Graphs::rightMargin ; set ::Graphs::rightMargin {20} ; variable ::Graphs::barGap ; set ::Graphs::barGap {10 3} ; variable ::Graphs::markerSize ; set ::Graphs::markerSize {6} ; variable ::Graphs::dataSeries ; array set ::Graphs::dataSeries {id {3 4 5 6 1 7}} ; variable ::Graphs::tickSize ; set ::Graphs::tickSize {5} ; variable ::Graphs::xcolumn ; set ::Graphs::xcolumn {name} ; variable ::Graphs::header ; set ::Graphs::header {50} ; variable ::Graphs::leftMargin ; set ::Graphs::leftMargin {50} ; variable ::Graphs::numYIntervals ; set ::Graphs::numYIntervals {10} ; variable ::Graphs::name ; set ::Graphs::name {A Silly Graph} ; variable ::Graphs::title ; set ::Graphs::title {An Appropriate Title} ; variable ::Graphs::xsize ; set ::Graphs::xsize {600} ; variable ::Graphs::xlabels ; set ::Graphs::xlabels {Braila Galati Dallas Cairo Bucuresti Montreal} ; variable ::Graphs::ytitle ; set ::Graphs::ytitle {} ; variable ::Graphs::ysize ; set ::Graphs::ysize {400} ; variable ::Graphs::dataSeriesColor ; array set ::Graphs::dataSeriesColor {id #6cd02d77bd70} ; variable ::Graphs::ymin ; set ::Graphs::ymin {0} ; variable ::Graphs::footer ; set ::Graphs::footer {60} ; variable ::Graphs::ymax ; set ::Graphs::ymax {10} ; ','A Silly Graph'); 10-- PGA 11 12 INSERT INTO pga_graphs (graphsource, graphcode, graphname) 13 VALUES ('cities','variable ::Graphs::lineWidth ; set ::Graphs::lineWidth {2} ; variable ::Graphs::labelGap ; set ::Graphs::labelGap {5} ; variable ::Graphs::dataSeriesNames ; lappend ::Graphs::dataSeriesNames {id} ; variable ::Graphs::xtitle ; set ::Graphs::xtitle {xxx} ; variable ::Graphs::type ; set ::Graphs::type {line} ; variable ::Graphs::rightMargin ; set ::Graphs::rightMargin {20} ; variable ::Graphs::barGap ; set ::Graphs::barGap {10 3} ; variable ::Graphs::markerSize ; set ::Graphs::markerSize {6} ; variable ::Graphs::dataSeries ; array set ::Graphs::dataSeries {id {3 4 5 6 1 7}} ; variable ::Graphs::tickSize ; set ::Graphs::tickSize {5} ; variable ::Graphs::xcolumn ; set ::Graphs::xcolumn {prefix} ; variable ::Graphs::header ; set ::Graphs::header {50} ; variable ::Graphs::leftMargin ; set ::Graphs::leftMargin {50} ; variable ::Graphs::numYIntervals ; set ::Graphs::numYIntervals {10} ; variable ::Graphs::name ; set ::Graphs::name {A LIne Graph} ; variable ::Graphs::title ; set ::Graphs::title {Title} ; variable ::Graphs::xsize ; set ::Graphs::xsize {400} ; variable ::Graphs::xlabels ; set ::Graphs::xlabels {4039 4036 5362 9352 4013 5325} ; variable ::Graphs::ytitle ; set ::Graphs::ytitle {} ; variable ::Graphs::ysize ; set ::Graphs::ysize {400} ; variable ::Graphs::dataSeriesColor ; array set ::Graphs::dataSeriesColor {id {#000000 #000000 #000000 #000000}} ; variable ::Graphs::ymin ; set ::Graphs::ymin {-10} ; variable ::Graphs::footer ; set ::Graphs::footer {60} ; variable ::Graphs::ymax ; set ::Graphs::ymax {10} ; ','A LIne Graph'); 14-- PGA 15 16 INSERT INTO pga_forms (formname, formsource) 17 VALUES ('Working with Tables namespace','f3 13 {3 4 5 6 7 9 10 11 12 13} 377x263+59+127 {radio usa {36 24 138 36} {} USA selcont} {radio europe {36 45 141 60} {} Europe selcont} {radio africa {36 66 147 81} {} Africa selcont} {label label6 {9 99 339 114} {} {Select one of the above continents and press} {}} {button button7 {270 93 354 117} {Tables::open phonebook \"continent=\'$selcont\'\" $selorder} {Show them} {}} {button button9 {66 189 312 213} {Tables::design phonebook} {Show me the phonebook table structure} {}} {button button10 {141 228 240 252} {destroy .f3} {Close the form} {}} {button button11 {93 141 282 165} {Tables::open phonebook \"company=true\"} {Show me only the companies} {}} {radio name {183 24 261 36} {} {Order by name} selorder} {radio phone_nr {183 45 267 57} {} {Order by phone number} selorder}'); 18-- PGA 19 20 INSERT INTO pga_forms (formname, formsource) 21 VALUES ('The simplest form','mf 5 {FS {set thename {}}} 306x136+82+146 {label label {42 45 99 60} {} Name {} label flat #000000 #d9d9d9 1 {Helvetica 12 bold italic}} {entry ename {120 42 219 63} {} entry2 thename ename sunken #000000 #fefefe 1 n} {button button3 {6 96 108 129} {set thename Teo} {Set the name} {} button3 raised #000000 #d9d9d9 1 n} {button button4 {192 96 300 129} {destroy .mf} {Close the form} {} button4 raised #000000 #d9d9d9 1 n} {button button5 {114 96 186 129} {set thename {}} {Clear it} {} button5 raised #000000 #d9d9d9 1 n}'); 22-- PGA 23 24 INSERT INTO pga_forms (formname, formsource) 25 VALUES ('A simple demo form','asdf 14 {FS {set color none}} 370x310+50+75 {label label1 {15 36 99 57} {} {Selected color} {} label1 flat #000000 #d9d9d9 1} {entry entry2 {111 36 225 54} {} entry2 color entry2 sunken #000000 #fefefe 1} {radio red {249 21 342 36} {} {Red as cherry} color red flat #900000 #d9d9d9 1} {radio green {249 45 342 60} {} {Green as a melon} color green flat #008800 #d9d9d9 1} {radio blue {249 69 342 84} {} {Blue as the sky} color blue flat #00008c #d9d9d9 1} {button button6 {45 69 198 99} {set color spooky} {Set a weird color} {} button6 ridge #0000b0 #dfbcdf 2} {label label7 {24 129 149 145} {} {The checkbox\'s value} {} label7 flat #000000 #d9d9d9 1} {entry entry8 {162 127 172 145} {} entry8 cbvalue entry8 sunken #000000 #fefefe 1} {checkbox checkbox9 {180 126 279 150} {} {Check me :-)} cbvalue checkbox9 flat #000000 #d9d9d9 1} {button button10 {219 273 366 303} {destroy .asdf} {Close that simple form} {} button10 raised #000000 #d9d9d9 1} {button button11 {219 237 366 267} {Forms::open \"Phone book\"} {Open my phone book} {} button11 raised #000000 #d9d9d9 1} {listbox lb {12 192 162 267} {} listbox12 {} lb sunken #000000 #fefefe 1} {button button13 {12 156 162 186} {.asdf.lb insert end red green blue cyan white navy black purple maroon violet} {Add some information} {} button13 raised #000000 #d9d9d9 1} {button button14 {12 273 162 303} {.asdf.lb delete 0 end} {Clear this listbox} {} button14 raised #000000 #d9d9d9 1}'); 26-- PGA 27 28 INSERT INTO pga_forms (formname, formsource) 29 VALUES ('Working with listboxes','f2 5 {FS {set thestudent \"\"}} 257x263+139+147 {listbox lb {6 6 246 186} {} listbox1 {} lb sunken #000000 #ffffd4 1} {button button2 {9 234 124 258} {# Populate the listbox with some data 30# 31 32foreach student {John Bill Doe Gigi} { 33 .f2.lb insert end $student 34} 35 36 37 38# Binding the event left button release to the 39# list box 40 41bind .f2.lb <ButtonRelease-1> { 42 set idsel [.f2.lb curselection] 43 if {$idsel!=\"\"} { 44 set thestudent [.f2.lb get $idsel] 45 } 46} 47 48# Cleaning the variable thestudent 49 50set thestudent {}} {Show students} {} button2 groove #000000 #d9d9d9 2} {button button3 {132 234 247 258} {destroy .f2} {Close the form} {} button3 groove #000000 #d9d9d9 1} {label label4 {9 213 119 228} {} {You have selected} {} label4 flat #000000 #d9d9d9 1} {label label5 {129 213 219 228} {} {} thestudent label5 flat #00009a #d9d9d9 1}'); 51-- PGA 52 53 INSERT INTO pga_forms (formname, formsource) 54 VALUES ('Full featured form','{full 42 {set entrydemo {nice} 55set color {no color selected} 56 57.full.combobox_demo configure -values {Look a BWidget combo box} 58 59.full.spinbox_demo1 configure -range {0 100 1} 60.full.spinbox_demo2 configure -range {-1000000 1000000 10} 61.full.spinbox_demo3 configure -values {This is a BWidget spin box} 62.full.spinbox_demo3 setvalue first} 420x420+56+126 #996099 left_ptr {}} {label label1 {10 390 170 410} {} {Status line} {} {} sunken #000000 #d9d9d9 2 n center l left_ptr false none {} {}} {label label2 {180 390 410 410} {} {Grooved status line} {} {} groove #000098 #d9d9d9 2 f center l left_ptr false none {} {}} {label label3 {30 10 390 40} {} { Full featured form} {} {} ridge #000000 #d988d9 4 {Times 16 bold italic} center l left_ptr false none {} {}} {button button4 {10 230 140 260} {.full.lb insert end {it\'s} a nice demo form} {Java style button} {} {} groove #6161b6 #d9d9d9 2 b center l left_ptr false none {} {}} {label label5 {40 50 150 70} {} {Java style label} {} {} flat #6161b6 #d9d9d9 1 b center l left_ptr false none {} {}} {entry entry6 {160 50 380 70} {} entry6 entrydemo {} groove #000000 #fefefe 2 {Courier 13} center l left_ptr false none {} {}} {listbox lb {10 130 140 220} {} listbox8 {} {} ridge #000000 #ffffc8 2 n center l left_ptr false none {} {}} {button button9 {20 270 40 290} {} 1 {} {} flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {button button10 {50 270 70 290} {} 2 {} {} flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {button button11 {80 270 230 290} {} {and other hidden buttons} {} {} flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {text txt {150 130 330 220} {} text12 {} {} sunken #000000 #d4ffff 1 n center l left_ptr false none {} {}} {button button13 {150 230 330 260} {.full.txt tag configure bold -font {Helvetica 12 bold} 63.full.txt tag configure italic -font {Helvetica 12 italic} 64.full.txt tag configure large -font {Helvetica -14 bold} 65.full.txt tag configure title -font {Helvetica 12 bold italic} -justify center 66.full.txt tag configure link -font {Helvetica -12 underline} -foreground #000080 67.full.txt tag configure code -font {Courier 13} 68.full.txt tag configure warning -font {Helvetica 12 bold} -foreground #800000 69 70# That\'t the way help files are written 71 72.full.txt delete 1.0 end 73.full.txt insert end {Centered title} {title} \" 74 75You can make different \" {} \"portions of text bold\" {bold} \" or italic \" {italic} \". 76Some parts of them can be written as follows\" {} \" 77SELECT * FROM PHONEBOOK\" {code} \" 78You can also change \" {} \"colors for some words \" {warning} \"or underline them\" {link} } {Old style button} {} {} raised #000000 #d9d9d9 2 n center l left_ptr false none {} {}} {checkbox checkbox14 {50 300 150 320} {} different {} {} flat #00009c #d9d9d9 1 b center l left_ptr false none {} {}} {checkbox checkbox15 {50 330 150 350} {} {fonts and} {} {} flat #cc0000 #d9d9d9 1 i center l left_ptr false none {} {}} {checkbox checkbox16 {50 360 150 380} {} colors {} {} flat #00b600 #dfb2df 1 f center l left_ptr false none {} {}} {radio radio17 {182 300 302 320} {} {red , rosu , rouge} color red flat #9c0000 #d9d9d9 1 n center l left_ptr false none {} {}} {radio radio18 {182 320 302 340} {} {green , verde , vert} color green flat #009000 #d9d9d9 1 n center l left_ptr false none {} {}} {radio radio19 {182 340 302 360} {} {blue , albastru, bleu} color blue flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {label selcolor {186 369 321 384} {} {} color {} flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {button button21 {330 350 410 380} {destroy .full} Exit {} {} raised #7c0000 #dfdbb8 1 b center l left_ptr false none {} {}} {combobox combobox_demo {280 90 394 110} {} combobox22 {} {} sunken #000000 #fefefe 1 n center l left_ptr true none {} {}} {spinbox spinbox_demo1 {340 130 410 150} {} spinbox23 {} {} sunken #000000 #fefefe 1 n center l left_ptr false none {} {}} {label label24 {10 100 30 120} {} {} {} {} flat #000000 #000000 1 n center l trek false none {} {}} {label label26 {30 80 50 100} {} {} {} {} flat #000000 #000000 1 n center l gobbler false none {} {}} {label label27 {50 100 70 120} {} {} {} {} flat #000000 #000000 1 n center l sizing false none {} {}} {label label28 {70 80 90 100} {} {} {} {} flat #000000 #000000 1 n center l bottom_side false none {} {}} {label label29 {90 100 110 120} {} {} {} {} flat #000000 #000000 1 n center l sb_left_arrow false none {} {}} {label label30 {110 80 130 100} {} {} {} {} flat #000000 #000000 1 n center l coffee_mug false none {} {}} {label label31 {110 100 130 120} {} {} {} {} flat #ffffff #ffffff 1 n center l double_arrow false none {} {}} {label label32 {90 80 110 100} {} {} {} {} flat #ffffff #ffffff 1 n center l question_arrow false none {} {}} {label label33 {70 100 90 120} {} {} {} {} flat #ffffff #ffffff 1 n center l shuttle false none {} {}} {label label34 {50 80 70 100} {} {} {} {} flat #ffffff #ffffff 1 n center l iron_cross false none {} {}} {label label35 {30 100 50 120} {} {} {} {} flat #ffffff #ffffff 0 n center l spraycan false none {} {}} {label label36 {10 80 30 100} {} {} {} {} flat #ffffff #ffffff 1 n center l gumby false none {} {}} {label label37 {180 80 250 120} {} {different 79mouse 80cursors} {} {} flat #000000 #f8fe08 1 n center c left_ptr false none {} {}} {spinbox spinbox_demo2 {340 160 410 180} {} spinbox38 {} {} sunken #000000 #fefefe 1 n center l left_ptr false none {} {}} {spinbox spinbox_demo3 {340 190 410 210} {} spinbox39 {} {} sunken #000000 #fefefe 1 n center l left_ptr false none {} {}} {label label40 {135 96 180 99} {} {} {} {} flat #000000 #fefe00 1 n center l left_ptr false none {} {}} {label label42 {340 230 410 340} {} {a 81multi 82line 83label 84aligned 85on 86the 87right} {} {} flat #000000 #ffff00 1 n e r left_ptr false none {} {}}'); 88-- PGA 89 90 INSERT INTO pga_forms (formname, formsource) 91 VALUES ('Working with trees','{ftree 6 {set city \"\"; set continent \"\"} 375x315+36+115 #999999 left_ptr {DataSet(.ftree.qp,city) DataSet(.ftree.qp,continent) DataSet(.ftree.qry,continent)}} {query qp {330 20 350 40} qry_city_continents query1 {} {} flat #d9d9d9 #d9d9d9 1 n center l left_ptr false none {} {}} {tree tr {30 30 210 280} {# these are variables for the labels to the right of the tree 92variable continent 93variable city 94 95# the name of the tree we clicked is the first argument 96set treename [lindex $args 0] 97 98# the name of the node we clicked is the second (or more) argument 99set nodename [lindex $args 1] 100 101# if the node only has two parts, its the root and the continent name 102 103if {[llength [split $nodename \"-\"]]==2} { 104 105 set continent [lindex [split $nodename \"-\"] 1] 106 set city \"\" 107 108 ::DataControl(.ftree.qp)::setSQL \" 109 SELECT DISTINCT city 110 FROM phonebook 111 WHERE continent=\'$continent\' 112 AND city!=\'\'\" 113 ::DataControl(.ftree.qp)::open 114 ::DataControl(.ftree.qp)::fill .ftree.tr city $nodename 115 ::DataControl(.ftree.qp)::close 116 117# else we are looking at a city in a continent 118 119} else { 120 121 set continent [lindex [split $nodename \"-\"] 1] 122 set city [lindex [split $nodename \"-\"] 2] 123 124}} tree2 {} {} sunken #3779fc284b24 #fefefe 1 n center l left_ptr false none {} {}} {button btnfill {240 50 340 90} {# 125# perform these operations 126# under the query that 127# returns distinct continents 128# 129namespace eval DataControl(.ftree.qry) { 130 131 # clear out the tree, starting at the root node 132 drain .ftree.tr root 133 134 # open the query to retrieve the continents 135 open 136 137 # fill up the tree with the names of the continents 138 fill .ftree.tr continent root 139 140 # close the query 141 close 142 143} 144 145 146# change the button label 147.ftree.btnfill configure -text \"Re-fill Tree\"} {Fill Tree} {} {} raised #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {query qry {250 20 270 40} qry_just_continents query4 {} {} flat #d9d9d9 #d9d9d9 1 n center l left_ptr false none {} {}} {label label5 {240 150 340 180} {} City city {} flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {label label6 {240 190 340 220} {} Continent continent {} flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}}'); 148-- PGA 149 150 INSERT INTO pga_forms (formname, formsource) 151 VALUES ('Working with comboboxes','{comb 14 {namespace eval DataControl(.comb.qry_cities) { 152 # you can either set the SQL manually, or use the name of a stored query 153 setSQL \"show the cities\" 154 open 155 updateDataSet 156 fill .comb.combobox_cities name 157} 158 159namespace eval DataControl(.comb.qry_pb) { 160 open 161 updateDataSet 162 fill .comb.combobox_names name 163} 164 165 166# these are bindings for fast lookups on the city combobox 167# keyboard entry will be limited to only those items in the list 168# note the placement of the \'bind\' word, this is a BWidget thing 169# standard Tk widgets would put the \'bind\' at the beginning instead 170# note also that the combobox must be set Editable=true 171 172# these two variables will hold the keystrokes and the last found index 173variable cb 174variable fnd 175 176# clear out the old keystrokes upon receiving focus 177.comb.combobox_cities bind <FocusIn> { 178 set cb \"\" 179} 180 181# clear out the old keystrokes upon receiving a mouse click 182.comb.combobox_cities bind <Button-1> { 183 set cb \"\" 184} 185 186# bind to the actual key press 187.comb.combobox_cities bind <KeyRelease> { 188 append cb %A 189 set curr $cb 190 append curr \"*\" 191 .comb.combobox_cities setvalue last 192 set pos [.comb.combobox_cities getvalue] 193 while {$pos>=0} { 194 .comb.combobox_cities setvalue @$pos 195 set txt [.comb.combobox_cities cget -text] 196 if {[string match -nocase $curr $txt]} { 197 set fnd [.comb.combobox_cities getvalue] 198 break 199 } 200 incr pos -1 201 } 202 .comb.combobox_cities setvalue @$fnd 203} 204 205# this binding isn\'t necessary, but allows for the lookup 206# to fire the command as if it were selected with the mouse 207.comb.combobox_cities bind <Key-Return> { 208 Scripts::execute \"combobox demo city update\" 209}} 375x262+129+209 #999999 left_ptr {DataSet(.comb.qry_pb,phone_nr) DataSet(.comb.qry_pb,city) DataSet(.comb.qry_pb,company) DataSet(.comb.qry_pb,continent) DataSet(.comb.qry_cities,name) DataSet(.comb.qry_pb,name)}} {combobox combobox_cities {20 70 130 90} {Scripts::execute \"combobox demo city update\"} combobox1 selected_city {} groove #000000 #fefefe 2 f center l left_ptr true none {} {}} {query qry_cities {20 10 40 30} {show the cities} query3 {} {} flat {} {} 1 n center l left_ptr false none {} {}} {query qry_pb {340 10 360 30} {SELECT * FROM phonebook WHERE company=\'f\'} query5 {} {} flat {} {} 1 n center l left_ptr false none {} {}} {combobox combobox_names {180 70 360 90} {DataControl(.comb.qry_pb)::moveTo [.comb.combobox_names getvalue] 210DataControl(.comb.qry_pb)::updateDataSet} combobox6 DataSet(.comb.qry_pb,name) {} sunken #000000 #fefefe 1 n center l left_ptr false none {} {}} {entry entry7 {180 210 360 230} {} entry7 DataSet(.comb.qry_pb,phone_nr) {} sunken #000000 #fefefe 1 n center l left_ptr false none {} {}} {label label9 {20 100 130 250} {} {This combobox has 211fast lookups enabled 212from the Form Startup 213script. 214 215Try typing the first 216letter of a city 217in the entry part. 218 219Hit enter to commit and 220update the name box.} {} {} flat #000000 #d9d9d9 1 n n l left_ptr false none {} {}} {label label10 {20 40 130 60} {} city {} {} flat #ffffff #000000 1 {helvetica 12 bold roman} center l left_ptr false none {} {}} {label label11 {180 40 360 60} {} name {} {} flat #ffffff #000000 1 {helvetica 12 bold roman} center l left_ptr false none {} {}} {label label12 {180 180 360 200} {} phone {} {} flat #ffffff #000000 1 {helvetica 12 bold roman} center l left_ptr false none {} {}} {label label14 {180 100 360 170} {} {When you pick a city, this 221combobox will be limited to 222those people in that city. 223 224Below will be their phone #.} {} {} flat #000000 #d9d9d9 1 n n l left_ptr false none {} {}}'); 225-- PGA 226 227 INSERT INTO pga_forms (formname, formsource) 228 VALUES ('Phone book','{pb 28 {} 470x320+126+140 #999999 left_ptr {}} {label label1 {30 10 70 30} {} Name {} label1 flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {entry name_entry {90 10 230 30} {} entry2 DataSet(.pb.qs,name) name_entry sunken #000000 #fefefe 1 n center l left_ptr false none {} {}} {label label3 {30 40 70 60} {} Phone {} label3 flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {entry entry4 {90 40 200 60} {} entry4 DataSet(.pb.qs,phone_nr) entry4 sunken #000000 #fefefe 1 n center l left_ptr false none {} {}} {label label5 {30 70 70 90} {} City {} label5 flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {entry entry6 {90 70 200 90} {} entry6 DataSet(.pb.qs,city) entry6 sunken #000000 #fefefe 1 n center l left_ptr false none {} {}} {query qs {3 6 33 33} {} query7 {} qs flat {} {} 1 n center l left_ptr false none {} {}} {button button8 {180 170 260 210} {namespace eval DataControl(.pb.qs) { 229 setSQL \"select oid,* from phonebook where name ~* \'$what\' order by name\" 230 open 231 set nrecs [getRowCount] 232 updateDataSet 233 fill .pb.allnames name 234 bind .pb.allnames <ButtonRelease-1> { 235 set ancr [.pb.allnames curselection] 236 if {$ancr!=\"\"} { 237 DataControl(.pb.qs)::moveTo $ancr 238 DataControl(.pb.qs)::updateDataSet 239 } 240 } 241}} {Start search} {} button8 raised #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {button button9 {390 280 460 310} {DataControl(.pb.qs)::close 242DataControl(.pb.qs)::clearDataSet 243set nrecs {} 244set what {} 245destroy .pb 246} Exit {} button9 raised #000000 #d9d9d9 2 n center l left_ptr false none {} {}} {button button10 {300 240 320 260} {namespace eval DataControl(.pb.qs) { 247 moveFirst 248 updateDataSet 249} 250} |< {} button10 ridge #000092 #d9d9d9 2 n center l left_ptr false none {} {}} {button button11 {330 240 350 260} {namespace eval DataControl(.pb.qs) { 251 movePrevious 252 updateDataSet 253} 254} << {} button11 ridge #000000 #d9d9d9 2 n center l left_ptr false none {} {}} {button button12 {350 240 370 260} {namespace eval DataControl(.pb.qs) { 255 moveNext 256 updateDataSet 257}} >> {} button12 ridge #000000 #d9d9d9 2 n center l left_ptr false none {} {}} {button button13 {380 240 400 260} {namespace eval DataControl(.pb.qs) { 258 moveLast 259 updateDataSet 260} 261} >| {} button13 ridge #000088 #d9d9d9 2 n center l left_ptr false none {} {}} {checkbox checkbox14 {40 100 140 120} {} {Is it a company ?} DataSet(.pb.qs,company) checkbox14 flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {radio usa {20 130 100 150} {} U.S.A. DataSet(.pb.qs,continent) usa flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {radio europe {90 130 170 150} {} Europe DataSet(.pb.qs,continent) europe flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {radio africa {170 130 250 150} {} Africa DataSet(.pb.qs,continent) africa flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {entry entry18 {130 180 170 200} {} entry18 what entry18 sunken #000000 #fefefe 1 n center l left_ptr false none {} {}} {label label19 {110 220 190 240} {} {records found} {} label19 flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {label label20 {90 220 110 240} {} { } nrecs label20 flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {label label21 {0 250 30 270} {} OID= {} label21 flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {label label22 {39 252 87 267} {} { } pbqs(oid) label22 flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {button button23 {10 280 80 310} {set oid {} 262catch {set oid $DataSet(.pb.qs,oid)} 263if {[string trim $oid]!=\"\"} { 264 sql_exec noquiet \"update phonebook set name=\'$DataSet(.pb.qs,name)\', phone_nr=\'$DataSet(.pb.qs,phone_nr)\',city=\'$DataSet(.pb.qs,city)\',company=\'$DataSet(.pb.qs,company)\',continent=\'$DataSet(.pb.qs,continent)\' where oid=$oid\" 265} else { 266 tk_messageBox -title Error -message \"No record is displayed!\" 267} 268 269} Update {} button23 raised #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {button button24 {210 280 280 310} {set thisname $DataSet(.pb.qs,name) 270if {[string trim $thisname] != \"\"} { 271 sql_exec noquiet \"insert into phonebook values ( 272 \'$DataSet(.pb.qs,name)\', 273 \'$DataSet(.pb.qs,phone_nr)\', 274 \'$DataSet(.pb.qs,city)\', 275 \'$DataSet(.pb.qs,company)\', 276 \'$DataSet(.pb.qs,continent)\' 277 )\" 278 tk_messageBox -title Information -message \"A new record has been added!\" 279} else { 280 tk_messageBox -title Error -message \"This one doesn\'t have a name?\" 281} 282 283} {Add record} {} button24 raised #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {button button25 {140 280 200 310} {DataControl(.pb.qs)::clearDataSet 284# clearcontrols stillinitialise 285# incorectly booleans controls to {} 286# so I force it to \'f\' (false) 287set DataSet(.pb.qs,company) f 288focus .pb.name_entry} {Clear all} {} button25 raised #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {listbox allnames {270 10 460 230} {} listbox26 {} allnames sunken #000000 #fefefe 1 n center l left_ptr false none {} {}} {label label27 {30 250 90 270} {} {} DataSet(.pb.qs,oid) label27 flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}} {label label28 {0 180 120 200} {} {Find name containing} {} {} flat #000000 #d9d9d9 1 n center l left_ptr false none {} {}}'); 289-- PGA 290 291 INSERT INTO pga_scripts (scriptsource, scriptname) 292 VALUES ('Tables::open pga_forms 293 294 295 296','How are forms keeped inside ?'); 297-- PGA 298 299 INSERT INTO pga_scripts (scriptsource, scriptname) 300 VALUES ('Tables::open phonebook \"name ~* \'e\'\" \"name desc\" 301 302 303','Opening a table with filters'); 304-- PGA 305 306 INSERT INTO pga_scripts (scriptsource, scriptname) 307 VALUES ('Mainlib::tab_click Forms 308Forms::open {Full featured form} 309 310 311','Autoexec'); 312-- PGA 313 314 INSERT INTO pga_scripts (scriptsource, scriptname) 315 VALUES ('namespace eval ::DataControl(.comb.qry_pb) { 316 clearDataSet 317 setSQL \"get phonebook for city\" 318 setVars \"{select_city $selected_city}\" 319 open 320 updateDataSet 321 fill .comb.combobox_names name 322} 323 324','combobox demo city update'); 325-- PGA 326 327 INSERT INTO pga_queries (querytype, querycommand, querytables, querylinks, queryresults, querycomments, queryname) 328 VALUES ('S','select * from phonebook where continent=\'usa\' ','','','','','Query that can be saved as view'); 329-- PGA 330 331 INSERT INTO pga_queries (querytype, querycommand, querytables, querylinks, queryresults, querycomments, queryname) 332 VALUES ('S','SELECT * FROM phonebook WHERE city=\'$select_city\' ','','','',' 333','get phonebook for city'); 334-- PGA 335 336 INSERT INTO pga_queries (querytype, querycommand, querytables, querylinks, queryresults, querycomments, queryname) 337 VALUES ('S','select t0.\"name\" from \"cities\" t0 ','cities 10 10 t0','','name t0 unsorted {} Yes',' 338','show the cities'); 339-- PGA 340 341 INSERT INTO pga_queries (querytype, querycommand, querytables, querylinks, queryresults, querycomments, queryname) 342 VALUES ('S','select distinct continent from phonebook ','','','',' 343','qry_just_continents'); 344-- PGA 345 346 INSERT INTO pga_queries (querytype, querycommand, querytables, querylinks, queryresults, querycomments, queryname) 347 VALUES ('S','select t0.\"city\", t0.\"continent\" from \"phonebook\" t0 where t0.\"city\"!=\' ','phonebook 10 10 t0','','city t0 unsorted {} Yes continent t0 unsorted {} Yes',' 348 349','qry_city_continents'); 350-- PGA 351 352 INSERT INTO pga_reports (reportsource, reportbody, reportprocs, reportoptions, reportname) 353 VALUES ('phonebook','set PgAcVar(report,tablename) \"phonebook\" ; set PgAcVar(report,extrasql) \"\" ; set PgAcVar(report,rw) 508 ; set PgAcVar(report,rh) 345 ; set PgAcVar(report,pw) 508 ; set PgAcVar(report,ph) 345 ; set PgAcVar(report,y_rpthdr) 21 ; set PgAcVar(report,y_pghdr) 47 ; set PgAcVar(report,y_detail) 66 ; set PgAcVar(report,y_pgfoo) 96 ; set PgAcVar(report,y_rptfoo) 126 ; .pgaw:ReportBuilder:draft.c create text 10 35 -font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -anchor nw -text {name} -tags {t_l mov ro} ; .pgaw:ReportBuilder:draft.c create text 10 52 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -anchor nw -text {name} -tags {f-name t_f rg_detail mov ro} ; .pgaw:ReportBuilder:draft.c create text 141 36 -font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -anchor nw -text {city} -tags {t_l mov ro} ; .pgaw:ReportBuilder:draft.c create text 141 51 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -anchor nw -text {city} -tags {f-city t_f rg_detail mov ro} ; .pgaw:ReportBuilder:draft.c create text 231 35 -font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -anchor nw -text {phone_nr} -tags {t_l mov ro} ; .pgaw:ReportBuilder:draft.c create text 231 51 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -anchor nw -text {phone_nr} -tags {f-phone_nr t_f rg_detail mov ro}','','','My phone book'); 354-- PGA 355 356 INSERT INTO pga_diagrams (diagramtables, diagramlinks, diagramname) 357 VALUES ('cities 10 10 phonebook 201.0 84.0','{cities name phonebook city}','Simple schema'); 358-- PGA 359 360 INSERT INTO pga_images (imagename, imagesource) 361 VALUES ('button image','R0lGODdhFAAUAPcAAAAAAICAgNjY2Pj8+G/IHLWg9wEU/0AIv8jMd6DyYRT/ 362cgi/dBA1UK+y9BQB/whAv8SQAaepABQUAAgIAMhMHDLy9wj//0C/vw4EHMAA 3639wEA/0AAv1DIHAEy9wAI/wBAvzjIBKigABDIyK+goBQUFAgICHgkBPOvAP8U 364AL8IADEbyP22oAIAFEAACDYE9KgA8RQA/wgAv2jINbSgsgwUAQgIQMH81Iry 365pw3/FEC/CIwEdFoA8QDIBACgAAAUAAQIADAIyNbzMhD/CAy/QDA1yNayoBAB 366FAhACOgEyMkAoBEAFFDIJKigrzgEG6gAthQAAAgAAMjIBDKgAAgUAEAIAJQg 367yPPzoP//FL+/CJQ1JLWy8gQB/0BAvwTQBACnAAAIAAigyKfyoBT/FAi/CEwE 368MAIA8gAA/wAAv8jINTIysggIAUBAQLDIAPOgqP8UFL8ICMTIsL+g8QQU/4Ak 369BKavAAgbyKe2MhQACAgAQEwEyAIAoAAAFAAACMjIyDKgoAgUFEAICPxQJPPz 370r701AHmyAAgBAAhAAGwEAMKoAAwUAADQAADyAAD/AAC/AHAEBPQAAP8AAL8A 371AODIjBMyWhcIFAhAQMjIFDKg8wgU/2zI2PSg2v8UEHAkyPSvMv8UCL8IQOAA 3726BMA8RcA/yzIlPSgtf8UBKAQBKyvAAcUAACECACppwAUFAAICAHI+AAyBwBA 373ABQOyADAMgABCABAQBRSBAAB8gAIDACq8gAU/wAIvwAQbwGvtQAUAQAIQHQk 374FPTz8v///7+/v3Axb/T9tf8CAb9AQCz+yPSpoNyUEKzzrwf/FOAKyBMApxcA 375FAgACBTsyAAAMgAAQBRuDgAAwADAAQADQACfUgDzARwKTPcAqP8AFL8ACAA4 376BADzAABvyAC1oAABFABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 377AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 378AAAAAAAAAAAAAAAAAAAAACwAAAAAFAAUAAAIZQAFCBxIsKDBgwgNDljIsKHD 379AQQhJiQYIOJEihYvCqw4UKIAACBDAsDYceDIgicFcBToMaXJgSsFtBQJkiTL 380lyhhZvxoMGXMlj11lhRIs6bQmxpV7rz4M6nSjgGiSp1K1anVpAEBADs='); 381-- PGA 382 383 CREATE SEQUENCE "cities_id_seq" 384 INCREMENT 1 385 MINVALUE 1 386 MAXVALUE 2147483647 387 START 7 388-- PGA 389CREATE TABLE cities (id int4,name varchar,prefix varchar);INSERT INTO cities (id,name,prefix) VALUES ('3','Braila','4039');INSERT INTO cities (id,name,prefix) VALUES ('4','Galati','4036');INSERT INTO cities (id,name,prefix) VALUES ('5','Dallas','5362');INSERT INTO cities (id,name,prefix) VALUES ('6','Cairo','9352');INSERT INTO cities (id,name,prefix) VALUES ('1','Bucuresti','4013');INSERT INTO cities (id,name,prefix) VALUES ('7','Montreal','5325'); 390-- PGA 391CREATE TABLE phonebook (name varchar,phone_nr varchar,city varchar,company bool,continent varchar);INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('FIAT','623463445','','t','europe');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Gelu Voican','01-32234','Bucuresti','f','europe');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Radu Vasile','01-5523423','Bucuresti','f','europe');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('MUGADUMBU SRL','+92 534662634','Cairo','t','africa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Jimmy Page','66323452','','f','europe');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('IBM','623346234','','t','usa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('John Doe','+44 35 2993825','Washington','f','usa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Bill Clinton','+44 35 9283845','New York','f','usa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Monica Levintchi','+44 38 5234526','Dallas','f','usa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Bill Gates','+42 64 4523454','Los Angeles','f','usa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('COMPAQ','623462345','','t','usa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('SUN','784563253','','t','usa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('DIGITAL','922644516','','t','usa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Frank Zappa','6734567','Montreal','f','usa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Constantin Teodorescu','+40 39 611820','Braila','f','europe');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Ngbendu Wazabanga','34577345','','f','africa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Mugabe Kandalam','7635745','','f','africa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Vasile Lupu','52345623','Bucuresti','f','europe');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Gica Farafrica','+42 64 4523454','Los Angeles','f','usa');INSERT INTO phonebook (name,phone_nr,city,company,continent) VALUES ('Victor Ciorbea','634567','Bucuresti','f','europe'); 392-- PGA 393CREATE 394 FUNCTION getcityprefix 395 (int4) 396 RETURNS varchar 397 AS 'select prefix from cities where id = $1 ' 398 LANGUAGE 'sql' 399-- PGA 400 401 CREATE VIEW "Query that was saved as a view" 402 AS SELECT phonebook.name, phonebook.phone_nr, phonebook.city, phonebook.company, phonebook.continent FROM phonebook WHERE (phonebook.continent = 'usa'::"varchar"); 403-- PGA 404