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

World: r3wp

[!RebGUI] A lightweight alternative to VID

GrahamC
7-Oct-2010
[8866]
so must be the use of display/parent that is different
Ashley
7-Oct-2010
[8867]
Can't reproduce using build#117 or 218 on Mac. Perhaps it's a Windows 
(7?) specific issue?
TomBon
21-Nov-2010
[8868]
how to add dynamically data to the tree?

face/data or SET-DATA doesn't work for me here...
GrahamC
21-Nov-2010
[8869]
I don't think you can.
TomBon
21-Nov-2010
[8870x5]
oups!
sure?
can change the data, no rebind,init or whatever to display the new 
data?
what about the accessor functions? BUILT-TREE etc. any change via 
this?
oki, looks like a static piece. thx graham...
GrahamC
28-Nov-2010
[8875]
Is there a way to monitor all events ?  In vid you can do 'insert-event-func 
but in Rebgui we have this system/view/screen-face/feel: none	; kill 
global events system (used by 'insert-event-func)
Ashley
29-Nov-2010
[8876]
You can comment out that line without causing any harm [to RebGUI].
GrahamC
29-Nov-2010
[8877]
I did and started getting lots of errors!
Ashley
29-Nov-2010
[8878]
Odd, I just tested with b117 and ran tour.r without a problem.
GrahamC
29-Nov-2010
[8879]
We're running different builds I guess
Awi
13-Jan-2011
[8880x5]
I am using build 117 (public) for creating a reservation application. 
I noticed a tremendous slow down on hovering above buttons created 
at the beginning, but hovering at the buttons created at the end 
is fast. Here is a code sample:
REBOL []

do %rebgui.r
seat-layout: copy []

loop 16 [
	insert tail seat-layout compose/deep [panel 50 data []]
	for row 1 15 1 [
		foreach col [A B - D E] [

   insert tail last seat-layout compose/deep [button 7x5 blue (rejoin 
   [row col]) [alert face/text]]
		]
		insert tail last seat-layout [return]
	]
]

display "test scroll panel" compose/deep [
	calendar 
	scroll-panel 152x100 #HW data [after 4 (seat-layout)]
	calendar
]
do-events
If you move your cursor quickly over the calendar on the left, it 
will leave a trail while focusing, it gets worse when you try to 
select a button in the scroll panel. But the right calendar is not 
affected.
Strangely, when you scroll the panel to bottom right, everything 
is back to normal in that condition, but when you scroll back to 
top left, things are the same again. Any hints how to fix this?
This trailing hover problem is not visible in build 218, but I need 
drop- and edit-list for my app, and these two are broken in b218. 
Thanks for the help!
Ashley
13-Jan-2011
[8885]
On a Mac, no problem. On WinXP it appears that the events are being 
generated faster than they can be processed. Good test case, I've 
never seen this before! ;)


I don't have an immediate fix, but this is one more reason for me 
to get the 2.x series released. Are drop- and edit-list the only 
roadblocks for you?
GrahamC
13-Jan-2011
[8886]
eh?? Is RebGUI alive again?
Ashley
13-Jan-2011
[8887]
Depends on how big the roadblocks are. It's easier to fix *-list 
than port the 2.x event handling back to 117! ;)
Awi
14-Jan-2011
[8888x6]
Ashley, that would be very cool. But with b217/8 I also experienced 
another strange thing when popping up a window on button click. Sometimes 
some texts in the window are blank, sometimes it's displayed correctly. 
The window consists of several panels, fields and buttons. It's reproducible 
consistently, I'm trying to make a sample code for this.
This don't happen in b117 (the same code, except I had to replace 
'question' to 'confirm' and 'ctx-rebgui/layout/only' to 'layout/only')
After an exhaustive testing, by luck I found out the problem. It 
was the table. The bug is pretty strange tough. Here is the test 
case:
REBOL []

do %rebgui.r
seat-layout: copy []

for slot 1 16 1[
	insert tail seat-layout compose/deep [panel 50 data []]
	for row 1 15 1 [
		foreach col [A B - D E] [

   insert tail last seat-layout compose/deep [button 7x5 blue (rejoin 
   [row col]) [display "test" [text "see me?"]]]
		]
		insert tail last seat-layout [return]
	]
]

display "test scroll panel" compose/deep [

 table options ["id" left .2 "name" right .8] data [1x2 "A to B" 3x4 
 "C to D" 5x5 "E to F"] return 
	calendar 
	scroll-panel 152x100 #HW data [after 4 (seat-layout)]
]
do-events
If you run the code, clicking any button will show a new window with 
the text "see me?". But once you select the first table entry, clicking 
on the button will show you an empty window. The only cure is to 
hover on the second or third entry. Hovering is enough to fix the 
not drawn text problem.
But once you start clicking on the calendar, the text will be hidden 
again. Another hovering on the second or third table entrywill bring 
it back again. This only happens to text and fields. Text in buttons 
are not affected.
Awi
15-Jan-2011
[8894x6]
I found another problem with b218: when there is a spinner style 
in display, the confirm and alert requestor's button do not works:
display "test scroll panel" [
	myspinner: spinner options [$0 $10 $1] data $5
	button "confirm" [confirm "yes/no works?"]
	button "alert" [alert "OK works?"]
]
do-events
Sorry for reporting only bugs, I like the 2.x series so much, it's 
much faster, no slow scrolling, I do really hope this version gets 
stable and usable. Currently it's the only usable GUI for me with 
nice graphic.
Here I found another bug with the text-list style. When your list 
is longer than the box (means you have to scroll), deleting the item 
at the bottom caused some calculation mismatch in redraw. This don't 
happen when you start deleting from the top. Here is the test case:
do %rebgui.r

display "test scroll panel" [
	tl-rute: text-list data [ "a"  "b"  "c"  "d"  "e"  "f"]
	button  red "-" [
		if tl-rute/selected [
			remove find tl-rute/data tl-rute/selected
			tl-rute/redraw
		]
	]
]
do-events
Delete "f", then delete other items, you will start to see "none" 
displayed in the list. This don't happen if you start by deleting 
other than "f" items.
GrahamC
15-Jan-2011
[8900]
usually there are methods to do this ..  certainly there is for table/remove-row 
n
Awi
15-Jan-2011
[8901x2]
RebDOC says nothing about deleting rows in text-list. Yes there is 
add-row and remove-row in table.
But the table in 2.x has the habit to prevent drawing text :-), that's 
why I moved my code to text-list, avoiding tables.
Awi
17-Jan-2011
[8903]
Ashley & Graham, just want to let you know that my reservation program 
using b218 is finished, and has been working perfectly. Many thanks 
for your work on RebGUI and all the support. Hopefully I can join 
the effort soon and give some work back to the community. (Currently 
I only have drop-list2 and text-list2, but both are incomplete and 
based on incomplete b218, so I think sharing them will do more confusion 
than help).
GrahamC
17-Jan-2011
[8904]
Maybe we should have moved RebGUI to github instead so people could 
fork and post their changes ... I guess we could still do so if Ashley 
restarts development.
Awi
17-Jan-2011
[8905]
Yes good idea, and if I'm not asking too much, just a small documentaion 
explaining the basic concept of 2x RebGUI, to get people (me) started. 
Currently my only reference is RebDOC and tour.r and diff-ing with 
117. For example I wanted to bring the b117 panel style (no border, 
silver background) back, I looked for some hours, and give up. Even 
some short points in this AltMe thread would be helpful. For example 
I found out how to do append-widget in 2.x through searching in google 
and found the chat history in altme.
GrahamC
17-Jan-2011
[8906]
Yeah ... the docs are in this channel for the tricky stuff.  But 
Ashley has assumed that R3 was going to quickly replace R2 hence 
the lack of movement here.
Awi
17-Jan-2011
[8907]
I also assumed that since like 2008 :-) Some things like this project 
cannot wait, and RebGUI and Rebol2 are more than good enough for 
almost every case in my project. And I think if Rebol3 and r3-gui 
are out someday, I'll just rewrite my apps.
GrahamC
17-Jan-2011
[8908]
Agreed.
Awi
6-Feb-2011
[8909x3]
Found another bug in b218: when using rate and feel, Ok button in 
alerts no longer working, the same with Yes/No buttons in confirm. 
Here is a code sample:
do %rebgui.r

display "rate feel test" [
	lbl: label "label with rate feel" 
		rate 1 
		feel [
			engage: func [f a e] [if a = 'time [print "awi"]]
		]
	btn "test alert" [alert "can you close me?"]
	btn "?" [? lbl]
	btn "unset lbl/rate" [lbl/rate: none show lbl]
	btn "set lbl/rate" [lbl/rate: 1 show lbl]
]
do-events
Nice thing is, when I turn off "rate", it works again, so currently 
I have a workaround, thanks God, I'm very close to shipping as I 
found this bug :-)
Basically what I'm doing is reading/monitoring a serial port using 
rate/feel. Since Rebol does not have a timer, the only thing I can 
think of is using rate/feel, which works very nicely as long as you 
don't "wait". "wait'" will kill your "thread" as the next timer event 
kicks again.
Awi
17-Feb-2011
[8912x4]
I just want to share my modifications of the chat widget in b177, 
I needed a slimmer chat. It should also fix the resize issue:
REBOL []
slim-chat: make baseface [
	options: {
		USAGE:

   chat2 120 data ["Bob" blue "My comment." yello 14-Apr-2007/10:58]

		DESCRIPTION:
			Three column chat display as found in IM apps such as AltME.
			Messages are appended, with those exceeding 'limit not shown.

		OPTIONS:

   [limit n] where n specifies number of messages to show (default 100)
			[id n] where n specifies id column width (default 10)
			[user n] where n specifies user column width (default 15)
			[date n] where n specifies date column width (default 25)
	}
	size: 200x100
	pane: []
	data: []
	edge: default-edge
	action: make default-action [
		on-resize: make function! [face] [

   poke face/pane/2/para/tabs 2 face/pane/1/size/x - sizes/slider - 
   (sizes/cell * any [select face/options 'date 25])
			face/redraw/no-show
		]
	]


 height: 0 ; actual pixel height of all messages (-1 ensures first 
 message is offset to hide it's edge
	rows: 0 ; number of messages
	limit: none ; last n messages to display

	append-message: make function! [
		user [string!]
		user-color [tuple! word! none!]
		msg [string!]
		msg-color [tuple! word! none!]
		date [date!]
		/no-show row
		/local p y t1 t2 t3
	] [
		;	cache current tab stops
		p: self
		t1: pick pane/2/para/tabs 1

  t2: pane/1/size/x - sizes/slider - (sizes/cell * any [select p/options 
  'date 25])

		p: self
		;	get height of message
		y: max sizes/line 4 + second size-text make baseface [
			size: as-pair p/size/x - sizes/slider + 1 10000
			text: msg
			font: default-font
			para: para-wrap
		]

		

		insert tail pane/1/pane reduce [
			make baseface [
				offset: as-pair -1 height - 1
				size: as-pair t2 21
				span: all [p/span find p/span #W #W]
				text: user
				edge: make default-edge [size: 0x1]

    font: make font-top [color: either word? user-color [get user-color] 
    [user-color] style: 'bold]
				color: either word? msg-color [get msg-color] [msg-color]
			]
			make baseface [
				offset: as-pair -1 height - 1 + 20
				size: as-pair p/size/x - sizes/slider + 1 y
				text: form msg
				color: either word? msg-color [get msg-color] [msg-color]
				edge: make default-edge [size: 0x1]
				font: default-font
				para: para-wrap
			]
			make baseface [
				offset: as-pair t2 - 1 height - 1

    size: as-pair (sizes/cell * any [select p/options 'date 25]) + sizes/slider 
    + 1 21
				span: all [p/span find p/span #W #X]

    text: form either now/date = date/date [date/time] [date/date]
				edge: make default-edge [size: 0x1]
				font: make font-top [style: 'bold align: 'right]
				color: either word? msg-color [get msg-color] [msg-color]
			]
		]
		height: height + y - 1 + 20
		if ((length? pane/1/pane) / 3) > limit [
			y: pane/1/pane/2/size/y + pane/1/pane/1/size/y - 2
			remove/part pane/1/pane 3
			foreach [u m d] pane/1/pane [
				u/offset/y: u/offset/y - y
				m/offset/y: m/offset/y - y
				d/offset/y: d/offset/y - y
			]
			height: height - y
		]
		unless no-show [
			insert tail data reduce [user user-color msg msg-color date]
			pane/1/size/y: height
			pane/3/ratio: pane/3/size/y / height
			show p
		]

  show pane/1 ; !!! this cleans up artifacts but "eats" other widgets 
  redraw events !!!
	]


 set-user-color: make function! [id [integer!] color [tuple! word! 
 none!] /local idx] [
		if any [zero? id id > rows] [exit]
		poke data id * 5 - 3 color
		if limit > (rows - id) [

   idx: either rows > limit [(id + limit - rows) * 3 - 2] [id * 3 - 
   2]

   pane/1/pane/:idx/font/color: either word? color [get color] [color]
			show pane/1/pane/:idx
		]
	]


 set-message-text: make function! [id [integer!] string [string!] 
 /local idx] [
		if any [zero? id id > rows] [exit]
		poke data id * 5 - 2 string
		if limit > (rows - id) [

   idx: either rows > limit [(id + limit - rows) * 3 - 1] [id * 3 - 
   1]
			insert clear pane/1/pane/:idx/text string
			redraw
		]
	]


 set-message-color: make function! [id [integer!] color [tuple! word! 
 none!] /local idx] [
		if any [zero? id id > rows] [exit]
		poke data id * 5 - 1 color
		if limit > (rows - id) [

   idx: either rows > limit [(id + limit - rows) * 3 - 1] [id * 3 - 
   1]
			pane/1/pane/:idx/color: either word? color [get color] [color]
			show pane/1/pane/:idx
		]
	]

	redraw: make function! [/no-show /local row] [
		clear pane/1/pane
		height: 0
		rows: (length? data) / 5
		row: max 0 rows - limit: any [select options 'limit 100]

  foreach [user user-color msg msg-color date] skip data row * 5 [

   append-message/no-show user user-color msg msg-color date row: row 
   + 1
		]
		pane/1/size/y: height
		pane/3/ratio: either zero? height [1] [pane/3/size/y / height]
		unless no-show [show self]
	]

	init: make function! [/local p] [
		unless options [options: copy []]
		p: self
		limit: any [select options 'limit 100]
		; chat pane (1)
		insert pane make baseface [
			offset: as-pair 0 sizes/line
			size: p/size - as-pair sizes/slider sizes/line
			span: all [p/span find p/span #W #W]
			pane: []
		]
		;	heading (2)
		insert tail pane make gradface [
			offset: -1x-1
			size: as-pair p/size/x sizes/line
			text: "Chat"
			span: all [p/span find p/span #W #W]
			font: make font-button [align: 'left]
			para: make default-para [tabs: [0 0]]
		]
		;	set header tabs

  poke pane/2/para/tabs 1 sizes/cell * (any [select options 'user 15])

  poke pane/2/para/tabs 2 size/x - sizes/slider - (sizes/cell * any 
  [select options 'date 25])
		;	vertical scroller
		insert tail pane make slider [
			offset: as-pair p/size/x - sizes/slider sizes/line - 2
			size: as-pair sizes/slider p/size/y - sizes/line + 2
			span: case [
				none? p/span [none]
				all [find p/span #H find p/span #W] [#XH]
				find p/span #H [#H]
				find p/span #W [#X]
			]
			action: make default-action [
				on-click: make function! [face] [
					if height > face/size/y [

      face/parent-face/pane/1/offset/y: (height - face/size/y * negate 
      face/data) + sizes/line
						show face/parent-face
					]
				]
			]
		]
		pane/3/init
		action/on-resize self
	]
]
And here is a screenshot: http://uploadpad.com/files/Chat.png
To use this, just save it as slim-chat in rebgui/widgets, and then 
do create-distribution.r. It's fully syntax-compatible with the existing 
chat widget.
I forgot, you will need to add #include %widgets/slim-chat.r in rebgui-widgets.r