World: r3wp
[!RebGUI] A lightweight alternative to VID
older newer | first last |
Claude 6-Oct-2008 [7748x6] | REBOL[] rebgui-build: %./rebgui-116/ rebdb-build: %./RebDB-203/ #include %/home/ramcla/Documents/rebol/rebol-linux-sdk-276/source/gfx-colors.r #include %/home/ramcla/Documents/rebol/rebol-linux-sdk-276/source/gfx-funcs.r #include join rebgui-build %rebgui.r #include join rebdb-build %db.r do join rebgui-build %rebgui.r do join rebdb-build %db.r to-amount-text: func[ data /local d ][ d: to-string to-money (to-decimal data) return either d/1 = #"-" [join "-" (skip d index? find d #"$")][(skip d index? find d #"$")] ] table-exist?: func [ table [string!] /local w ][ w: to-word table either error? err: try [db-describe :w][ disarm err return false ][ return true ] ] create-table: func [ table [string!] /local w tables ][ tables: [ t_joueurs [id nom prenom date_naissance adresse code-postal commune pays] t_periodes [id nom date-debut date-fin status] t_jeux [id period_id date lieu] t_resultats [jeux_id personne_id manche_1 manche_2 manche_3] t_resultat_historique [jeux_id personne_id manche_1 manche_2 manche_3] ] w: to-word table db-create :w (select tables w) ] create-db: func [ /local table ][ if not table-exist? table: "t_joueurs" [create-table table] if not table-exist? table: "t_periodes" [create-table table] if not table-exist? table: "t_jeux" [create-table table] if not table-exist? table: "t_resultats" [create-table table] if not table-exist? table: "t_resultat_historique" [create-table table] ] create-db ;print screen avec F3 ctx-rebgui/on-fkey/f3: make function! [face event] [ save/png %screen.png to image! face browse %screen.png ; or call %screen.png ] words: copy [] ; clear words in global context query/clear system/words ; show splash screen splash join rebgui-build "images/logo.png" ; compose pie-chart data pie-data: compose [ "Red" red 1 "Red-Green" (red + green) 1 "Green" green 1 "Green-Blue" (green + blue) 1 "Blue" blue 1 "Blue-Red" (blue + red) 1 ] ; wrap display in a func so it can be called by request-ui display/close rejoin ["Carte (build#" ctx-rebgui/build ")"] [ ; button "Configure Look & Feel" 50 [if request-ui [unview/all show-tour]] tight after 1 menu #LW data [ "Maintenance" [ "Bienvenue" [panel-master/select-tab 1] "Joueurs" [table_joueur 'rsh panel-master/select-tab 2] "Periodes" [panel-master/select-tab 3] "Jeux" [panel-master/select-tab 4] ] "Option" [ "Quit" [quit] "Print Screen" [alert "coucou"] ] ] panel-master: tab-panel options [no-tabs] #LVHW data [ "Bienvenue" [ title-group %./images/setup.png data "bienvenue" "toto" ] "Joueurs" [ label "nom : " ask_nom: field 50 label "prénom :" ask_prenom: field 50 button "Trouver" return maintenance_table_joueurs: table 200x50 #LW options [ "id" left .1 "nom" left .3 "prenom" left .3 "date de naissance" center .3 ] data [] [table_joueur 'rtv] return label "ID :" 35 m_joueur_id: field 50 options[info] return label "Nom :" 35 m_joueur_nom: field 50 label "Prénom :" 35 m_joueur_prenom: field return label "Date de Naissance :" 35 m_joueur_date_naissance: field 43 tip "coucou" on-unfocus [ use[d][ d: copy face/text either empty? d[ set-text m_joueur_age "" ][ either error? err: try [to-date d][ disarm err set-color face red ][ set-color face CTX-REBGUI/COLORS/page d: to-date d set-text m_joueur_age (now/year - d/year ) set-text face to-date d ] ] ] true ] arrow [ use[d][ if not none? d: request-date[ set-text m_joueur_date_naissance d set-text m_joueur_age (now/year - d/year) ] ] ] label "Age :" 35 m_joueur_age: field 50 options [info] return label "Adresse :" 35 m_joueur_adresse: area 100x20 [print coucou] return label "Code Postal :" 35 m_joueur_code-postal: field 50 label "Commune :" 35 m_joueur_commune: field 50 return label "Pays :" 35 m_joueur_pays: field 50 return button "Ajouter" [table_joueur 'add] button "Refresh" [table_joueur 'rsh] button "Update" [table_joueur 'upd] button "Supprimer" [table_joueur 'rmv] ] "periodes"[text "lolo" ] "jeux"[ text "lolo"] ] message-area: area #LW "" 10x-1 ][question "Vraiement ?"] table_joueur: func [ act [word!] ][ switch act[ clr[ clear maintenance_table_joueurs/data maintenance_table_joueurs/redraw ] rsh[ table_joueur 'clr insert tail maintenance_table_joueurs/data copy (db-select [id nom prenom date_naissance ] t_joueurs) maintenance_table_joueurs/redraw probe maintenance_table_joueurs/rows ] cmt[ db-commit t_joueurs table_joueur 'rsh ] rmv [ probe compose[id = (to-integer m_joueur_id/text)] db-delete/where t_joueurs compose[id = (to-integer m_joueur_id/text)] table_joueur 'cmt ] add [ db-insert t_joueurs compose[ next (m_joueur_nom/text) (m_joueur_prenom/text) (to-date m_joueur_date_naissance/text) (m_joueur_adresse/text) (m_joueur_code-postal/text) (m_joueur_commune/text) (m_joueur_pays/text) ] table_joueur 'cmt ] upd [ db-update/where t_joueurs [nom prenom date_naissance adresse code-postal commune pays] compose [ (m_joueur_nom/text) (m_joueur_prenom/text) (to-date m_joueur_date_naissance/text) (m_joueur_adresse/text) (m_joueur_code-postal/text) (m_joueur_commune/text) (m_joueur_pays/text) ] compose[id = (to-integer m_joueur_id/text)] table_joueur 'cmt ] rtv[ foreach [id nom prenom date_naissance adresse code-postal commune pays] db-select/where * t_joueurs compose[id = (first maintenance_table_joueurs/selected)] [ probe maintenance_table_joueurs/selected set-text m_joueur_id id set-text m_joueur_nom nom set-text m_joueur_prenom prenom set-text m_joueur_date_naissance date_naissance set-text m_joueur_age (now/year - date_naissance/year) set-text m_joueur_adresse adresse set-text m_joueur_code-postal code-postal set-text m_joueur_commune commune set-text m_joueur_pays pays ] ] ] ] do-events |
for this code working you need REBDB-203 & REBGUI build 116 in the same folder of this code and a folder "images" with an image like this %./images/setup.png | |
could you and would you explain to me wath append ? .............. i think the probleme is when a do a update on table and selected an another row with the function table_joueur 'rtv | |
thank you in advance | |
here you are ..............;it is better http://users.skynet.be/fc078613/carte.r | |
here you are if you use windows.......; http://users.skynek.be/fc078613/carte.html !!!!!!!!!!!! | |
Graham 6-Oct-2008 [7754] | You need to strip your example down. |
Claude 6-Oct-2008 [7755x7] | hi i do it after |
give a look at http://users.skynek.be/fc078613/carte.html | |
excuse http://users.skynet.be/fc078613/carte.html | |
after download type "maintenance"/"joueurs" | |
if you try to do an update of one row and after selected another row , the table willl not work any more correctly !!!! | |
it's the same thing with "Ajouter" - add !!! i try to remove the action for widget table [table_joueur 'rtv] and no more problem !!!! | |
where is the mistake in this code : rtv[ foreach [id nom prenom date_naissance adresse code-postal commune pays] db-select/where * t_joueurs compose[id = (first maintenance_table_joueurs/selected)] [ probe maintenance_table_joueurs/selected set-text m_joueur_id id set-text m_joueur_nom nom set-text m_joueur_prenom prenom set-text m_joueur_date_naissance date_naissance set-text m_joueur_age (now/year - date_naissance/year) set-text m_joueur_adresse adresse set-text m_joueur_code-postal code-postal set-text m_joueur_commune commune set-text m_joueur_pays pays ] | |
Graham 6-Oct-2008 [7762x2] | that looks wrong set-text m_joueur_age (now/year - date_naissance/year) perhaps set-text m_joueur_age (form now/year - date_naissance/year) |
I think set-text only takes a string | |
Claude 7-Oct-2008 [7764x8] | i test your proposal but it dont work!!! |
i comment all set-text line. and i keep only set-text to id, nom ,prenom, date_naissance. i still have the same problem | |
hi, i finaly find my problem | |
it seem it is the function set-text | |
i replace this func by a face/text: with show face | |
and now it work well | |
ashley a don't know how to tell you this bug......... | |
and a another one it seem that in linux system the widget calendar do not have a good arrow for select year and month look this print screen => http://users.skynet.be/fc078613/images/screen.png | |
Graham 7-Oct-2008 [7772x2] | the arrows use a symbol font so you need to find the equivalent in Linux. |
As I mentioned above, set-text only takes a string .. so you need to form dates, and numbers before using it. | |
Claude 7-Oct-2008 [7774x3] | hi, i retry to modifiy all my set-text by set-text face form data but i have again the same probleme if you want to try go to http://users.skynet.be/fc078613/carte.rip |
or perharps it will by better to give all of us a example of best praticies to use reb-db table and rebgui ????? :-) | |
an example of CRUD will be very good ;-) | |
Graham 7-Oct-2008 [7777] | I've never used reb-db |
Claude 7-Oct-2008 [7778] | perpharps Ashley can do it for us ................... please !!!!! |
Claude 9-Oct-2008 [7779x8] | hi, i continu to progress with my prog |
i would like to know how a can do en print screen from a menu | |
i find this one in docuement of rebgui | |
;print screen avec F3 ctx-rebgui/on-fkey/f3: make function! [face event] [ save/png %screen.png to image! face browse %screen.png ; or call %screen.png ] | |
but i would like to use it form a menu | |
menu #LW data [ "Maintenance" [ "Bienvenue" [panel-master/select-tab 1] "Joueurs" [table_joueur 'rsh panel-master/select-tab 2] "Periodes" [panel-master/select-tab 3] "Jeux" [panel-master/select-tab 4] ] "Option" [ "Quit" [quit] "Print Screen" [print "do a print screen" ] ] ] | |
any hlep please | |
help | |
Ashley 10-Oct-2008 [7787x3] | m: menu ... ... "Option" [ ... "Print Screen" [save/png %screen.png to image! m/parent-face] ] ] |
an example of CRUD will be very good REBOL [] do %db.r do %rebgui.r display "RebDB Test" [ button "Create" [ db-create my-table [ID Date] ] button "Insert" [ db-insert my-table reduce ['next now/date] ] button "Select" [ display "My Table" [ table options ["ID" right .2 "Date" right .8] data (db-select * my-table) ] ] ] do-events | |
Also, the use of get-values and set-values can make getting db data into and out of forms (a display with lots of basic input widgets) significantly easier [than individual widget addressing]. | |
Claude 10-Oct-2008 [7790x5] | thank you very much ashley to your help ;-) |
first for the print screen how to !!! | |
when i ask for a CRUD example i think about a optimize way of => 1 - select data from a table-widget 2 - show values of each data of a row 3 - accept insert & update & remove 4 - check values before insert or update table-db and table-widget. | |
have a look on my little test to do a application http://users.skynet.be/fc078613/carte.r you mus select in the menu "maintenace/joueurs" this is a CRUD like i think | |
i think it is working but i am asking to optimize my code and with your help code better ;-) | |
Ashley 18-Oct-2008 [7795] | RebGUI build#117 released. Release notes here:http://www.dobeash.com/RebGUI/release.html#section-11 |
Graham 18-Oct-2008 [7796] | http://www.dobeash.com/RebGUI/release.html#section-11 |
Ashley 18-Oct-2008 [7797] | http://www.dobeash.com/RebGUI/release.html#section-11 |
older newer | first last |