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

World: r3wp

[!RebGUI] A lightweight alternative to VID

Ashley
21-Apr-2007
[6293]
Then run the following:

	display "" [
		f: field
		field
		button [set-text/caret f "X"]
	]


Click in f, type some text, click or arrow to the middle of the text 
and press the button. Text is inserted at caret.
Graham
21-Apr-2007
[6294x2]
not for me
still requires a tab to set the caret position correctly
Ashley
21-Apr-2007
[6296x4]
Hmm, maybe there are other changes at play here. Let me upload latest 
build ...
Build uploaded.
So, running the text above I click into f, type "ab", press the left 
arrow key once and then the button. What I see is an "X" inserted 
between letters "a" and "b" (i.e. "aXb") with the cursor positioned 
between the "a" and "X". Is this what you see? Is this "correct"?
Or do you expect the cursor to be positioned between the letters 
"X" and "b"?
Graham
21-Apr-2007
[6300]
doesn't matter
Ashley
21-Apr-2007
[6301]
Huh?
Graham
21-Apr-2007
[6302x4]
but if you now move the cursor to the head of the text, and click 
button, it still inserts as before.
I guess the caret should be at the end of the inserted text
and this mirrors what happens when you type
the face/caret is not being updated when you click inside the text
Ashley
21-Apr-2007
[6306]
OK, Mk III

	unless string? face/text [exit]
	either caret [
		if all [
			face = view*/focal-face
			view*/caret
		] [face/caret: index? view*/caret]
		either face/caret [
			insert at face/text face/caret form text
			view*/caret: at face/text face/caret + length? form text
			face/caret: index? view*/caret
		] [insert tail face/text form text]
	] [insert clear face/text form text]
Graham
21-Apr-2007
[6307x2]
sorry ...
no better
Ashley
21-Apr-2007
[6309]
I type "ab" ArLeft and press button to get "aX|b"
the ArLeft, ArLeft and press button to get "X|aXb"

Is this what you get?
Graham
21-Apr-2007
[6310x2]
No
let me resync a new directory
PeterD
21-Apr-2007
[6312x2]
I get aXXb
|aXXa
Graham
21-Apr-2007
[6314x2]
a|Xb
|aXXb
Ashley
21-Apr-2007
[6316]
Ah, my fault. I didn't sync the above change.
Graham
21-Apr-2007
[6317x3]
I did
I put mark III in
>> checksum read %rebgui.r
== 14063079
Ashley
21-Apr-2007
[6320x2]
Uploaded. I still get the same, working, result.
PeterD, you win tie breaks it seems ;)
Graham
21-Apr-2007
[6322]
Rebol isn't indeterminate
PeterD
21-Apr-2007
[6323]
I get 16618006 for checksum ??
Ashley
21-Apr-2007
[6324]
Same here.
Graham
21-Apr-2007
[6325x2]
not me .. and that was a fresh checkout :(
and create-distribution.r
PeterD
21-Apr-2007
[6327]
I still get aXXb
Graham
21-Apr-2007
[6328]
ok, same checksum, let's try again
Ashley
21-Apr-2007
[6329]
Do a search on "build: " on %rebgui.r ... it should come back with 
"build: 87"
PeterD
21-Apr-2007
[6330]
REBOL[version: 87]
Graham
21-Apr-2007
[6331]
Hmm.  Now works as Ashley's does :)
Ashley
21-Apr-2007
[6332]
We have a winner!
Graham
21-Apr-2007
[6333x3]
:)
Looks very good!!
passed all my tests so far
PeterD
21-Apr-2007
[6336]
Works OK, I forgot to reload rebgui
Graham
21-Apr-2007
[6337x4]
in the excitement :)
time to take a break .. later.
Just got this error from an area widget:

make object! [
    code: 303
    type: 'script
    id: 'expect-arg
    arg1: 'max
    arg2: 'value1
    arg3: [number! pair! char! money! date! time! tuple! series!]
    near: [view*/caret: offset-to-caret parent-face min max]
    where: 'on-click
]
I'm putting a  gui-error/continue around the caret handling in area
Ashley
22-Apr-2007
[6341x2]
Build#88 uploaded to SVN with major caret/focus fix. This fixes numerous 
problems related to clicking out of a field/area with focus. To be 
on the safe side, I've left the caret and current-word traps in place 
for the moment. Please delete your %rebgui.log files and report any 
further occurrence of these types of errors (after upgrading to build#88 
that is). Lucky build number to solve this with too! ;)
Couple of deep design questions. Run the following code:

display "A" [
	button [
		display "B" [
			f: field on-unfocus [false]
			button [print "Click"]
			do [set-focus f]
		]
	]
]


1) Click the button to open display "B" ... type some text, then 
click the OS close button ... then try the same thing again.


What you should see is that you can't enter any text the 2nd time. 
This is due to the fact that the 2nd time set-focus is called it 
fails to unfocus so is left in limbo. Not sure what to do about this 
case.


2) Run the sample again. Click button to open display "B" and click 
the button.


Note that the button's action fired as clicking a button does not 
shift focus (i.e. you can click a button and continue typing in a 
field). The question is: even though we are not tabbing out of the 
field, should the button's action have fired. This question becomes 
even more relevant when the button action does something like open 
a new display (or close the existing one) ... should this action 
be allowed to proceed even though there is a failed unfocus action 
pending?