r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!RebGUI] A lightweight alternative to VID

Graham
7-Sep-2008
[7704]
Excellent ... the drop-list focus is also fixed
Louis
7-Sep-2008
[7705x2]
Brian, Thanks to you I've made some good progress. I still have some 
questions, but I'm too tired to ask them right now.
Ashley, RebGUI is really a great toolkit. Many thanks for making 
it freely available.
Graham
7-Sep-2008
[7707]
>> display "" [ text-list data [ "test" ] [ print "click" ][print 
"alt click" ] [print "dbl click" ]] do-events

looks like double click no longer works now.
Ashley
8-Sep-2008
[7708]
Fixed in build#115 - face-iterator only.
btiffin
8-Sep-2008
[7709]
Louis; Glad and Yep ... Go Ashley Go!    and now joins in RebDB? 
  What more can ya ask for.  Woohoo.
Pekr
8-Sep-2008
[7710]
Joins in RebDB? That is why Ashley brought us cool SQLite driver. 
SQLite is RebDB 2.0 :-)
Louis
8-Sep-2008
[7711x4]
Why is this line:


current-projects: table (tab-size + 80x35) #HW options ["Priority" 
right .03 "ProjectName" left .2 "ExchangeRate" left .2 "Objectives" 
left .3 "Deliverables" left .0] data (SQL "select * from projects")

causing this error message:

 User Error: Table has an invalid data block
** Near: make error! error
>> 


There is data in the database. The SQLite Database Browser can read 
and display the data.
This works:

>> SQL "select * from projects"                  

== ["1" "Critical Links" "9000" "Better project management." "Critical 
Links, Critical Time" "2" "Funda" "" "To get control of our ...
>> 

and this works:


current-projects: table (tab-size + 80x35) #HW options ["Priority" 
right .03 "ProjectName" left .2 "ExchangeRate" left .2 "Objectives" 
left .3 "Deliverables" left .0] data (1 2 3 4 5)

But the line in my post above doesn't work.
What I want to do is populate the gui table with all the data in 
the SQLite projects table.
Is there an easy way to do that?
Robert
8-Sep-2008
[7715]
Louis, you need to do an: insert clear data-of-table your-data
Graham
8-Sep-2008
[7716x2]
try data [ ( ... ) ]
and I presume you have compose/deep
double click is fixed for me .. thanks
Louis
9-Sep-2008
[7718x2]
Robert and Graham, thanks, but I'm still not able to get this to 
work. Here is the data in the database (2 records):

>> probe (SQL "select * from projects")

["1" "Critical Links" "9000" "Better project management." {Critical 
Links project management software, Critical Time time management 
software.} "2" "RebDar" "9000" {Automatic full-metal backup to multiple 
hard drives.} "One REBOL script."]

Why am I getting:

** User Error: Table has an invalid data block
** Near: make error! error
>> 

What is wrong with the data block?
What I mean is, why is this line:


current-projects: table (tab-size + 80x35) options ["Priority" right 
.03 "ProjectName" left .2 "ExchangeRate" left .2 "Objectives" left 
.3 "Deliverables" left .0] data [(SQL "select * from projects")]


resulting in an "invalid data block" error when the data block seems 
(to me) to be perfectly fine? Surely I am missing something that 
is probably very obvious to some of you.
sqlab
9-Sep-2008
[7720]
Did you see, that your statement gets the data ?
Try to insert a probe before SQL!!
Graham
9-Sep-2008
[7721x2]
your options block defines 5 columns but youre only supplying one 
column.
you're missing a compose/deep as I mentioned before.
Claude
9-Sep-2008
[7723x2]
hi every one . i would like to know if it is possible to change color 
of row in widget table ? . or if i must prefer use table-list of 
shadwolf ?
shadwolf do you have a compatible widget table-list with rebgui-bluid 
114 thank you in advance ?
Louis
9-Sep-2008
[7725x2]
sqlab, yes I saw that. I just didn't know where to put the compose/deep.
Graham, many thanks. I finally got it working. I believed you the 
first time. The problem was I was putting the compose/deep before/after 
"data" instead of after display.  I finally noticed where to put 
it in Ashley's docs after reading them about 50 times.  :>)
shadwolf
11-Sep-2008
[7727x3]
amacleod ----> http://shadwolf.free.fr/RebGUI-038-shad.ziphere is 
a working version of rebgui + my list list-view
i forgot i had this packed
ofcourse the demo isoft is demo-listview feel free to use it as it 
and feel free to adapt it to your needs ( at least for the part writen 
by myself)
amacleod
11-Sep-2008
[7730]
shadwolf, Thanks.. You remember I asked from so long ago? wow!
shadwolf
12-Sep-2008
[7731]
yes i remembered  ^^
Graham
14-Sep-2008
[7732x2]
Ashley, would be feasible to enhance the spreadsheet to allow user 
defined column widths? ( in the options block )
At present the width option specifies a global width for all columns.
Ashley
14-Sep-2008
[7734]
Should be fairly easy, I'll look at it tonight. BTW, please note 
that the sheet widget has one big bug ... cell words (e.g. A1, A2, 
B1, B2, etc) are currently added to the global context ...
Graham
14-Sep-2008
[7735x2]
eek!
which means you can't access two sheets at the same time if they 
are using the same address range.
Ashley
15-Sep-2008
[7737x2]
Correct.
Uploaded build#116. sheet now supports 'widths option, as in:

	sheet options [size 3x3 widths [2 6 4]]
Graham
15-Sep-2008
[7739x2]
cool
Ashley are you keeping this new colour scheme or is it  still experimental?
Ashley
15-Sep-2008
[7741]
The implementation is staying, but needs to be completed ... the 
specific [default] color scheme needs to be improved. The fact it's 
remained unfinished for so long bugs me, it prevents a number of 
fixes/enhancements from being released ... so I'm aiming to "finish 
it" over the next couple of weeks.
shadwolf
22-Sep-2008
[7742]
in rebol/desktop that's still the build 101  available when you click 
the icon  is that normal?
[unknown: 5]
23-Sep-2008
[7743x2]
Good look at McCain's military encounter http://www.youtube.com/watch?v=vQsckD9trn4
sorry wrong group
shadwolf
23-Sep-2008
[7745]
..
Ashley
24-Sep-2008
[7746]
Yes, as soon as the current dev build is stabilized I'll bump the 
release build and update the supporting doc.
Claude
6-Oct-2008
[7747x7]
hi, i have a problem with rebgui build 116 on table or field widget. 
i post a file here could some explain to me what append when i want 
to do a update of a row ......
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
   !!!!!!!!!!!!