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

World: r3wp

[!RebGUI] A lightweight alternative to VID

Guest
9-Apr-2005
[507x2]
I know. There were ones some time ago too ... just curious what aproach 
Ashley took ....
btw - pekr here, connecting via wireless, so dont know my login info 
right now....
Brock
9-Apr-2005
[509x2]
Wow, localisation integrated.  Thanks.
Wondering if there are any plans to include group element validation, 
ie, mutlple radio-buttons or checkboxes validated based on group-name 
rather than each item checked individually?
shadwolf
9-Apr-2005
[511x3]
where are menu ?
and why arrows are not integrated ? arrow are usefull for drop-down, 
slider, and notepad for example on tour.r as the window is resizabe 
that when the buton bar is (number of buttons) are more big than 
the window to have two arrow to scroll the buttons bar to acces to 
the unviable button and to indicate to the user that the button bar 
of the note pad is bigger than he can see
integrated into tour.r
Ashley
9-Apr-2005
[514]
Pekr: It's all explained in http://www.dobeash.com/it/rebgui/locale.html


Brock: radio-group does this already (set of mutually exclusive choices) 
and I was contemplating a check-group widget which uses the data 
attribute to store a block containing state information for each 
check-box in the group.


shadwolf: menu and tabbing are still WIP. The arrow widget is integrated 
into %widgets.r, I just ran out of room (> 1024 pixel width) with 
the current %tour.r. Once the scroller and spinner widgets are complete 
I'll redo %tour.r breaking it down into sub-widget categories (the 
real solution is to enhance the tab-panel widget but one thing at 
a time).
shadwolf
9-Apr-2005
[515]
ashley it could be cool to add 2 arrows left and right in the notepad 
header (where you have the buttons to open the panels of the notepad) 
when they  are hided because the size of the window is smaller than 
the needed
Brock
9-Apr-2005
[516]
Okay Ashley, thanks.
Ashley
9-Apr-2005
[517]
shadwolf: It's on my (growing) ToDo list. ;)
Brock
9-Apr-2005
[518]
Since you are also responsible for RebForms maybe this can be a feature 
request.  In .Net, you can have a form Validation Control, that confirms 
all of the validation checks on the fields of the form.  You are 
also allowed to indicate for each form element, whether it is to 
be included in the form-level validation or not (ie, free form text 
fields typically don't need validation).
shadwolf
9-Apr-2005
[519x2]
AShley maybe I can help you to implement this ...
how do you plan to detect the fact that the button header content 
of the notepad widget is bigger dans the window :)
Ashley
9-Apr-2005
[521]
Brock: validation is also on my ToDo list (you can see the beginnings 
of it in the field widget character length limits). A couple of questions 
though (both how it is done in .Net and how it *should* be done in 
RebGUI):

	What's the granularity of the validation?

 Does it allow the specification of a mask (e.g. for phone numbers)?

 Is it validated as I type, when I leave the field, or when I save 
 the form? (Or is it flexible enough to let me choose the level of 
 validation?)


shadwolf: Haven't really thought about it much, but I figured the 
tab-panel redraw feel was a logical place to do the work.
shadwolf
9-Apr-2005
[522]
oki thank you I will try to implement it if I have a succefull code 
I'll share it with you
Graham
9-Apr-2005
[523]
Didier did some work on field validation with VID

http://membres.lycos.fr/didec/rebsite/styles/filter-field/test-filter-field.r
Vincent
9-Apr-2005
[524x2]
'construct for 1.2.1 :
construct: func [
    block [block!] /with object [object!]
/local nb spec values name value
][
    if not with [object: object!]
    spec: copy []
    values: copy []
    parse/all :block [
        any [
            to set-word! (nb: 0) some [
                set name set-word! (nb: nb + 1 append spec :name)
            ]
            set value skip (

                insert tail values nb insert/only tail values :value
            )
        ]
    ]
    append spec none
    object: make object spec
    foreach [nb value] values [
        loop nb [
            set in object (to-word first spec) 

                either find [true false none on off] :value [do value][:value]
            spec: next spec
        ]
    ]
    object
]
Ashley
10-Apr-2005
[526]
Impressive! ;)
Robert
10-Apr-2005
[527]
WRT my question about extending/customizing layout. Would it be possible 
to add something to RebGUI so that this is possible:
	if my-var > 5 [optional: button red 100]
Ashley
10-Apr-2005
[528x2]
Not something I've ever needed myself, but certainly possible. I'd 
echo Anton's comment from the View group; "But what syntax is desired?"
Ah, nailed the radio-group problem under 1.2.1 by replacing this 
line:

	pos: pos + either size/y > 20 [0x20] [as-pair width 0]

with these two:


 tmp: either size/y > 20 [0x20] [as-pair width 0] ; required for 1.2.1
	pos: pos + tmp
Vincent
10-Apr-2005
[530x2]
Yes, 1.2.1 crashes with 
pair! + add pair! * number! pair! * number! 
changing the 'as-pair definition can fix the crash too : 
as-pair: func [x y] [(1x0 * x) + (0x1 * y)] ; 'add -> '+

as-pair: func [x y] [to-pair reduce [to-integer x to-integer y]] 
; earlier method
Proposal: IMHO, it would be better to use the VID convention for 
auto-size: negative size -> auto-size

as 9999 can lead to weird errors and crashs, if someone set dimensions 
to 999x999, or worst 99999x99999 .

...and 10k screen size isn't that improbable (the size of a virtual 
screen can be that big!)
Ashley
10-Apr-2005
[532]
The "+" version of as-pair has fixed all the 1.2.1 crashes (and got 
rid of a few 1.2.1 specific work arounds).
Vincent
10-Apr-2005
[533x2]
cool :-) I had that problem with the first RebGUI alpha, until I 
changed the 'as-pair definition.
The memory leak is a known behaviour. The memory allocated is free 
by the GC after a total of 1 - 2 megabytes.

http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlYRJQ
Ashley
10-Apr-2005
[535x2]
I was wondering when someone was going to ask about the whole 9999 
thing. ;) It's an optimization to avoid a redundant size assignment 
prior to 'size-text but has the problems you quoted. I'll probably 
change it back to -1x-1 in the next build or two.
Thanks for the link ... that and some testing has convinced me to 
remove the 'show redefine from the next build.
shadwolf
11-Apr-2005
[537x12]
I'm working on tab-panel 2 arrows insertion ;)
first change into the arrow/feel/engage down  event you will need 
to add if face/action [do face/action] to enable the arrow to launch 
action ;:)
I started the work on arrow motion ;)
in the tab-panel so for now no code is available maybe later to night 
(I have yet some little things done ;)
sorry face/action in arrow was yet supported  !!!
im don't know why the supplyed action for the tab-panel is not doed 
on mouse done avant ...
TAB-PANEL widget looks like :
redraw: function [face act pos] [test-size test-wid] [
			     
				if act = 'show [face/pane/1/size: face/size - 0x20
					either not dir-buttons [
					 	dir-buttons: true
					 	test-wid:  last face/pane
			    		test-size: test-wid/offset/x + test-wid/size/x
						if greater? test-size face/size/x  [
			    			insert tail face/pane face/l-arw: make arrow [
		        				size: 20x20
			    				offset: as-pair (face/size/x - 40) 0
			    				data: 'left
			    				action: [print "you clicked left" ]
		     				] do face/l-arw/init
			    			insert tail face/pane face/r-arw: make arrow [
		        				size: 20x20
			    				offset: as-pair (face/size/x - 20) 0 
			    				action: [print "you clicked right" ]
			    				data: 'right
		     				] do face/r-arw/init
	     				]
		     		 
	     			][	
	     				face/r-arw/offset: as-pair (face/size/x - 20) 0 
	     				face/l-arw/offset: as-pair (face/size/x - 40) 0 
	     			]
		     		

       print "la liste des bouttn est plus grande  que ce que l'on voit!!!" 
		    	]
tab-panel/feel/redraw offcourse
in it the arrow/action is not done when we make a click on them ... 
pretty anoying for the rest ...
another thing anoying is that we need to move the buttons so to do 
this easier we need to pack the header button of the tab-panel into 
two boxes in order to slide them ;)
this means the complete change of the feel event switch for the header 
to adapt them to the new path face/parent-face/parent-face ;)
Ashley
11-Apr-2005
[549]
re: action. Try:

	action: does [print "you clicked right" ]
shadwolf
11-Apr-2005
[550x7]
k
Well I'm going to sleep :)  I have 2 bugs with current implementation 
1) clicking into the panel arrow is not possibe ... 2)  header button 
countainer and sub countainer have the 100x100 size ...
tab-panel: make face [
		color:	none
		pane:	[]
		l-arw: none 
		r-arw: none
		dir-buttons: false
		feel:	make default-feel [
			redraw: function [face act pos] [test-size test-wid] [
				if act = 'show [face/pane/1/size: face/size - 0x20
; 					
; 				 	test-wid: face/pane/1
; 		    		test-size: test-wid/size/x
; 					if greater? test-size face/size/x  [
; 						either not dir-buttons [
; 				 			dir-buttons: true
; 		    				insert tail face/pane face/l-arw: make arrow [
; 	        					size: 20x20
; 		    					offset: as-pair (face/size/x - 40) 0
; 		    					data: 'left
; 		    					action: [print "you clicked left" ]
; 	     					] do face/l-arw/init
; 		    				insert tail face/pane face/r-arw: make arrow [
; 	        					size: 20x20
; 		    					offset: as-pair (face/size/x - 20) 0 
; 		    					action: [print "you clicked right" ]
; 		    					data: 'right
; 	     					] do face/r-arw/init
; 	 					][	
; 	 						face/r-arw/offset: as-pair (face/size/x - 20) 0 
; 	 						face/l-arw/offset: as-pair (face/size/x - 40) 0 
; 	 					]
; 	     			]

; 			    print "la liste des bouttn est plus grande  que ce que l'on 
voit!!!" 
		    	]
			]
		]
		
		init:	has [tab-offset last-tab] [
			;	create main display area
			insert pane make face [ offset: 0x20 edge: default-edge]
			;	add tabs
			tab-offset: 0x0

   insert tail pane make face [ offset: 0x0 pane: [] color: none ]
			container: last pane

   insert container/pane make face [ offset: 0x0 pane: [] color: none]
			foreach [title spec] data [
				insert tail container/pane/1/pane make face [
					offset:	tab-offset
					size:	1x20
					pane:	[]
					text:	title
					effect:	reduce ['round edge-color 5 'draw copy []]
					resize:	none
					font:	make default-font [align: 'center valign: 'bottom]
					para:	default-para
					feel:	make default-feel [
						over: func [face act pos] [
							either act [

        insert face/effect/draw compose [	; compose required for AGG betas
									pen over-color
									line 3x1 (as-pair face/size/x - 4 1)
									line 2x2 (as-pair face/size/x - 3 2)
									line 1x3 (as-pair face/size/x - 2 3)
								]
								show face
							][

        if face/parent-face/parent-face/parent-face/pane/1/pane <> face/data 
        [	; clear unless selected
									clear face/effect/draw
									show face
								]
							]
						]
						engage: function [face act event] [pf old-face] [
							if event/type = 'down [
								pf: face/parent-face
								pf3: pf/parent-face/parent-face

        if pf3/pane/1/pane = face/data [return]	; has a new tab been selected?
								clear face/effect/draw
								old-face: pick pf/pane pf3/data			; find previous tab
								old-face/resize: pf3/size				; remember last size
								old-face/size: old-face/size - 0x1		; deflag old
								clear old-face/effect/draw
								face/size: face/size + 0x1				; flag new
								face/feel/over face true 0x0
								pf3/data: index? find pf/pane face		; set new pane#
								pf3/pane/1/pane: face/data				; init tab panel
								if pf3/size <> face/resize [				; recursive resize
									span-resize pf3/pane/1 pf3/size - face/resize
									face/resize: pf3/size
								]
								show pf3
							]
						]
					]
				]
				last-tab: last container/pane/1/pane

    last-tab/size/x: 10 + first size-text last-tab	; set tab title width

    display/layout "" spec last-tab					; generate tab spec into tab 
    pane
				last-tab/data: last-tab/pane					; swap pane into data
				last-tab/pane: none								; clear pane
				last-tab/resize: size							; original panel size

    tab-offset/x: tab-offset/x + last-tab/size/x	; set offset for next 
    tab title
			]
			print "size et countainer a la con !!"
			probe size/x
			container/size: as-pair size/x 20
			probe container/size/x
			container/pane/1/size: container/size

   container/pane/1/pane/1/size: container/pane/1/pane/1/size + 0x1	; 
   flag 1st tab
			data: 1								; set pane#
			pane/1/pane: container/pane/1/pane/1/data			; init tab panel

   container/pane/1/pane/1/feel/over container/pane/1/pane/1 true 0x0	; 
   flag first as active
		]
	]
as I inserted 2 countainers to hold header buttons in tab panel I 
had to recode lot of path to be able to locate the convienient widgets 
:=
:)))
i solve both bugs by adding 9999x20 in the containers definition
now I have a new bug the 2 last header button are inserted into the 
secon tab-panel (the demo one ;) ))