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

World: r3wp

[!RebGUI] A lightweight alternative to VID

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?
Graham
22-Apr-2007
[6343]
pass ...
Ashley
22-Apr-2007
[6344x2]
Ah, you fix one problem only to discover a bigger one! Anyway I've 
uploaded build#89 which addresses the two specific issues above:


1) Clicking the close button on a window now forces an unfocus but 
*without* triggering the on-unfocus action (or a show).


The /close refinement of display must now return true or false to 
proceed or not with the close operation.


2) Clicking a button only fires its action if it is not the current 
focal face and the focal face's on-unfocus action returns true


Try these with the test code posted above. You should see that it 
now behaves as you would expect. But now try the following code:

	display "" [
		field
		calendar
	]


Click on the field and start to type, then click on the calendar 
and continue typing! Why does this happen? It happens because when 
we detect the 'down event we have no way of knowing whether it originated 
from the field or the calendar. %display.r *should* be able to have 
a detect function that (among other things) does a:

	if all [
		find [down up alt-down alt-up] event/type
		face <> view*/focal-face
	][
		code to check on-unfocus
		code to do an unfocus
	]


but this will not work because of a view bug that causes face to 
be the window face *not* the face that originated the event. Urrgh. 
At this time I can't see how to trap and process mouse click focal 
changes. Might have to delve into the VID sources again to see how 
(if) it was solved there.
Oh this is just too funny. Found where it's "solved" in VID. %view-vid.r 
and the 'insert-event-func with the following comment:


;	!!! This next line is a hack, because we really need to know what 
face the event

 ;	is directed toward.  We need a way to get that info, but it's not 
 available here.

Anyway, try the following in VID:

	view layout [at 0x0 field at 0x0 btn]

Start typing, click the button, and then continue typing!
Graham
22-Apr-2007
[6346]
So, the conclusion is ?
Ashley
22-Apr-2007
[6347]
Borrow the same hack from VID and hope http://www.rebol.net/cgi-bin/rambo.r?id=3867&
is fixed!
Graham
22-Apr-2007
[6348x2]
View-face is now gone from display.r
now called 'spec ...
Ashley
22-Apr-2007
[6350x2]
It now reuses the spec word.
Build#90 uploaded to SVN with mouse focus hack borrowed from VID. 
Run this script:

	display "" [

  field on-unfocus [either (length? face/text) > 3 [true] [false]]
		button [print "click"]
		calendar
	]


Click in the field and type a character, then try clicking the button 
or calendar, continue typing and then click the button and calendar 
again.
Graham
22-Apr-2007
[6352]
can't keep up :(
Ashley
22-Apr-2007
[6353]
with what?
Graham
22-Apr-2007
[6354]
all these changes!  :)
Ashley
22-Apr-2007
[6355]
I'm hoping today's builds fix *all* outstanding focus/caret problems, 
many of which have been around for a long time now. ;) If that's 
the case then I'll do a public build and the pace of changes will 
slow.
Graham
22-Apr-2007
[6356]
I need an automated merge utility!
Ashley
22-Apr-2007
[6357x2]
Anyway, whatever happened to release early, release often!
What do you need to merge, I thought I'd inlined all your changes 
by now?
Graham
22-Apr-2007
[6359x5]
custom widgets
error trapping in area.r for caret errors
extra ( redundant ) options in 'display
don't mind me .. just carry on :)
is it feasible to allow one to pick a symbol on the fly rather than 
defining in symbol.r ?
Ashley
22-Apr-2007
[6364]
%create-distribution.r should make the widget merge pretty easy.

Recent changes hopefully make the %area.r caret error trap redundant 
(if not, I'll add that in with the next build)
What extra refinements do you have for display?
Graham
22-Apr-2007
[6365x2]
I wasn't clear on how to create borderless windows, so I added an 
options refinement to allow for that.
as in Vid
Ashley
22-Apr-2007
[6367]
What do you set your options to?
Graham
22-Apr-2007
[6368x3]
let me have a look
[no-border]
It's just so i can create a clean screen capture with out the borders
Ashley
22-Apr-2007
[6371]
re: symbol. You acn do that easily with:

	symbol "&" font [name: "Wingdings"]
	symbol 20x20 "&" font [name: "Wingdings"]
Graham
22-Apr-2007
[6372]
easy enough then
Ashley
22-Apr-2007
[6373]
Isn't no-title what you're after then?
Graham
22-Apr-2007
[6374]
is no-title the same as no-border ?
Ashley
22-Apr-2007
[6375x2]
The following works well enough:

	display "" [
		button [unview]
		do [face/options: [no-title no-border]]
	]
On windows, no-title replaces the windows title-bar and blue 3 pixel 
border with a 1 pixel black border. no-border in conjunction with 
no-title removes the black 1 pixel border. no-border does nothing 
by itself (at least on my WindowsXP box).
Graham
22-Apr-2007
[6377x5]
Except I was displaying a user's template ...
so, this way I guess I'll have to add to the user's form the do block
before I display it.
not a biggie.
Was there a no-hide refinement in the past ?
Ashley
22-Apr-2007
[6382]
Yes, required by the old [rather dysfunctional] modal system.
Graham
22-Apr-2007
[6383]
I need to clean up my old source then!
Ashley
22-Apr-2007
[6384x2]
About the only display refinement that's still specific to dialogs 
is, well, the /dialog!
The /scroll refinement has also gone as on-scroll lets you trap this 
at the widget level now.