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

World: r3wp

[!RebGUI] A lightweight alternative to VID

Ladislav
19-Apr-2007
[6219x3]
Ashley: the suggestion: "Replace: error? try [] With: attempt [] 
is an error (in http://www.dobeash.com/RebGUI/design-guide.html)
(should be the other way around)
you probably won't believe, but this version of AS-PAIR looks like 
being 20% faster than the current one:

as-pair: func [
    "Combine X and Y values into a pair."
    x [number!] y [number!]
] [
	1x0 * x + y: 0x1 * y
]
Maxim
19-Apr-2007
[6222x3]
so argument passing is THAT slow?
(for those who didn't check), normal as-pair code is:  

add 1x0 * x 0x1 * y
stange I would not have thought that 'ADD and + would have any speed 
differences.
Ashley
19-Apr-2007
[6225]
Designer's Guide

 updated with a few minor corrections & clarifications (mostly to 
 do with Beta 2 changes).
Ladislav
19-Apr-2007
[6226]
TRIM may be used instead of REPLACE sometimes
Ashley
19-Apr-2007
[6227]
I noticed 'switch is native! in the latest beta.
Ladislav
19-Apr-2007
[6228]
yes
Maxim
19-Apr-2007
[6229x2]
yes  :-)  and supports all  :-) very cool
as in switch/all  :-)
Graham
19-Apr-2007
[6231x2]
Regarding the action block on a tab panel.  It seems to me that it 
must complete before the panel is displayed.  Can there be an option 
to display the panel first, and then perform the action?
I have an async routine that displays all the chat messages in table 
on a panel.  This triggers in the action field of the panel, but 
even though it is async, it takes a finite time, and so slows down 
the display of the panel.
Maxim
19-Apr-2007
[6233]
yep, refresh is paramout, always... often, the time the user focuses 
on the display changes, is enough time for the action to occur... 
so from the user's point of view, everything seems instantaneous 
 :-)
Graham
19-Apr-2007
[6234x3]
Just wondering if we need a refinement for set-text/insert where 
we are inserting text at the caret.
well, not /insert .. perhaps /ins

set 'set-text make function! [
	"Set and show a widget's text attribute."
	face [object!] "Widget"
	text [any-type!] "Text"
	/ins
	/no-show "Don't show"
	/focus
][
	unless string? face/text [exit]
	either all [ ins face/caret ][
		insert skip head face/text face/caret form text
	][	
		insert clear face/text form text
	]
	all [
		face/para
		face/para/scroll: 0x0
		all [face/type = 'area face/pane/data: 0]
	]
	face/line-list: none
	unless no-show [either focus [set-focus face] [show face]]
]
insert skip head face/text max 0 face/caret - 1 form text
Ashley
19-Apr-2007
[6237x2]
Worthy addition, although I'd call it /caret and the following line 
should suffice:

	insert at face/text face/caret form text


Not that 'at treats values less than 0 as head and values greater 
than length of string as tail.
I've also changed clear-text from:

	if f/text ...

to:

	if string? f/text

in light of the issue you had.
Graham
19-Apr-2007
[6239]
good to know about 'at ... does it deal with 'none as well?
Ashley
19-Apr-2007
[6240]
No, but "either all [caret face/caret]" will catch that.
Graham
20-Apr-2007
[6241]
display "" [ a: area "This is a test string" button "dump" [ probe 
a/caret ]] do-events


seems the caret is only set when you tab out of the area.  other 
ways of changing focus such as using the mouse do not  preserve the 
area's caret value
Ashley
20-Apr-2007
[6242]
That's a bug.
Pekr
20-Apr-2007
[6243]
Will menu be corrected? It takes to clicks to open adjacent menu, 
while it should take zero clicks ...
Ashley
20-Apr-2007
[6244]
On the list. (when I get a moment or two I'll actually add this list 
to the Trac Wiki; that approach works better than tickets for me).
Graham
20-Apr-2007
[6245x5]
Until caret handling is fixed, I suggest that set-text/caret insert 
text at the tail if face/caret is none.  Otherwise, you end up erasing 
existing text.
Something like:

set 'set-text make function! [
	"Set and show a widget's text attribute."
	face [object!] "Widget"
	text [any-type!] "Text"
	/caret {insert at cursor position}
	/no-show "Don't show"
	/focus
][
	unless string? face/text [exit]
	insert either all [ caret face/caret ][
			at face/text face/caret 
	][	
		either caret [ tail face/text ][	clear face/text ] 
	] form text
	all [
		face/para
		face/para/scroll: 0x0
		all [face/type = 'area face/pane/data: 0]
	]
	face/line-list: none
	unless no-show [either focus [set-focus face] [show face]]
]
If you have a large left box, how do you then align the following 
widgets so that 'return aligns to the left large widget?
In VID you set a ruler thingy ...
How to programmatically change the date displayed in a calendar widget 
that is currently being displayed?
tried setting the widget/data: now/date and doing an 'init
Ashley
20-Apr-2007
[6250]
Like the set-text change (and code re-factoring).


Not sure about the alignment question, have an example in VID of 
what you're trying to do?

Calenday quetion is easy:

	cal/date: 1-Feb-2006
	poke cal/options 1 1-Feb-2006
	show cal

data is the currently selected date
options/1 the default date
Graham
20-Apr-2007
[6251x3]
That's okay about the alignment .. I just used a panel to do what 
I wanted.
I had a 


calendar widget1 return widget2 and I wanted widget2 to align with 
the right border of the calendar

so now I have

calendar panel blue data [ widget1 return widget2 ]
typo :)

cal/data: 1-Feb-2006
poke cal/options 1 1-Feb-2006
show cal
Ashley
20-Apr-2007
[6254x2]
Note that in your panel example you can make it act like a positioning 
widget with something like:

	panel none data [margin 0x0 area return area]
Remember how we wrapped current-word and caret handling in attempt 
blocks? Well, I've had plenty of caret errors to track down but not 
a single current-word error. Then I recall you had that problem where 
you set face/text to a non-string value ... could the current-word 
problems you experienced be related to that?
Graham
20-Apr-2007
[6256x4]
I don't think so ... but it's hard to remember all of this now.
trap and forget ...
I would have posted the error messge here .. let me reset my search 
parameters for Altme
here it was:

make object! [
    code: 303
    type: 'script
    id: 'expect-arg
    arg1: 'find
    arg2: 'series
    arg3: [series! port! bitset!]

    near: [s: any [all [s: find/reverse str s next s] head str] set [ns]]
    where: 'current-word
]
Ashley
20-Apr-2007
[6260]
I'm trapping and writing these errors out to %rebgui.log, does your 
log file contain any current-word errors? (search for "word trap" 
if there are lots of entries)?
Graham
20-Apr-2007
[6261x2]
just lots of 

19-Apr-2007/18:18:20+12:00 Caret trap password origin: 2x2
margin: 2x2
indent: 0x0
tabs: 0
wrap?: false
scroll: 0x0
but then I had already wrapped an attempt around those
Ashley
20-Apr-2007
[6263]
But at least you haven't had a current-word error since installing 
the latest builds. It's just that looking at the current-word function, 
it's only called from one place, and you already have to have focus 
and caret with a valid string before the function is called, i.e. 
I can't see how it *could* fail [now]. I'll probably leave the attempt 
in there for a couple more builds/weeks, but if it traps no errors 
I'll remove it as fixed.
Graham
21-Apr-2007
[6264x2]
select-row is not working?


>> display "" [ t: table options ["row" left .99] data [ "a" "b" 
][ print face/selected ] button "select" [ t/sele
ct-row 1 ]] do-events
the action is not invoked when I use the button
Ashley
21-Apr-2007
[6266]
Missed that one when I converted actions over to on-*. Change:

	unless no-action [action self]

in %table.r to:

	unless no-action [action/on-click self]

Text-list is OK.
Graham
21-Apr-2007
[6267x2]
ok.
typo ... in tour.r unziped should be unzipped