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

World: r3wp

[!RebGUI] A lightweight alternative to VID

Graham
24-Apr-2009
[8012x5]
this illustrates the problem.


do %/c/rebgui9/rebgui/rebgui.r
do http://www.fm.tul.cz/~ladislav/rebol/default.r
do http://www.fm.tul.cz/~ladislav/rebol/closure.r

nw: func [ /local lab ][
	view/new/offset layout compose [
		below 
		lab: text (form now/precise)
		button "show" [ probe lab/text ]  
	] to-pair reduce [ random 400 random 400 ]
]

nw2: closure [ /local lab ][
	view/new/offset layout compose [
		below 
		lab: text (form now/precise)
		button "show" [ probe lab/text ]  
	] to-pair reduce [ random 400 random 400 ]
] 

display "Double Click Test" [

 table 40x40 options [ "Func Dbl Click me" left .9 ] data [ "one" 
 ] 
	on-click [ nw ]
	on-dbl-click [ ]

 table 40x40 options [ "Closure Dbl Click me" left .9 ] data [ "two" 
 ] 
	on-click [ nw2 ]
	on-dbl-click [ ]
]

do-events
If you use the left hand table, and do a double click, then the "show" 
button will produce the same output in both windows.  Change it to 
a closure on the right hand table, and the "show" button now works 
correctly.
ie the local variable assumes the value from the second window, and 
loses it's own original value.
Rebgui's 'display function prevents the second window opening ... 
so I don't understand why the problem is still occuring.
foreach window view*/screen-face/pane [all [title = window/text exit]]

so 'display exits before it calls the 'layout function
Graham
25-Apr-2009
[8017x5]
Whereabouts is the color information for a button stored?  face/color 
is none so it gets set to none after the button is drawn.
Hmm.  Maybe the first window is not created before the second one 
is as the window creation is async. So, it does not find the window 
title in the pane, and so the layout function is called again.
You don't see this is in smaller apps because of the timing issues.
I see I have altered the display.r a little


foreach window view*/screen-face/pane [if title = window/text [return 
none]] ;; GC - always return a value

instead of using 'exit
Looks like this is the case... a print statement after this confirms 
the layout function is called twice on a double click.
Vladimir
26-Apr-2009
[8022]
Question about the table widget:
Can the label in column header be two rows ?
Like this:
Date
of purchase
Graham
26-Apr-2009
[8023x2]
no
Well, not unless you want to modify it.
Vladimir
27-Apr-2009
[8025]
:)
Ashley
27-Apr-2009
[8026]
a print statement after this confirms the layout function is called 
twice on a double click

 ... as per documentation ( http://www.dobeash.com/RebGUI/user-guide.html#section-3.2.3
 ) "Every on-dbl-click event is preceded by an on-click event, as 
 shown in the following example: ..." But, the real problem here (as 
 you've discovered) is that the method for checking window uniqueness 
 relies upon a [title] string that only manifests *after* a layout 
 is substantiated. I suppose RebGUI could manage its own window title 
 cache, but then you introduce another point of failure (if the cache 
 gets out of sync with view*/screen-face/pane). I wonder if putting 
 a small wait value *before* the current title string test would "fix" 
 the problem (i.e. give the preceeding layout sufficient time to substantiate)?
Graham
27-Apr-2009
[8027x8]
I understand that a dbl-click always produces a single click action, 
but why do we get two windows popping up on  double click?
That seems to me to suggest that the single click action is firing 
twice and not just once.
I'll try the wait thing and see if that works.
How about the display function not returning until it finds it's 
own window in the view*/screen-face/pane ?
Perhaps view needs a way to call a callback after it has substantiated 
the new window ...
puting a wait  0.1 before the window title check seems to fix it 
for me.
Except my application no longer works ... even with a wait as small 
as 0.001
can't see why that should happen.
Pekr
10-May-2009
[8035]
I am trying to adapt Cyphre's old grid to recent RebGUI requirements. 
I got myself past color adaptation, so actually I can get it displayed, 
internally it returns correctly API function results, but I need 
to adapt to event handling. I am facing two problems:

- editing, double-click etc do not work
- during some actions as resizing I get following error:

** Script Error: action has no refinement called on-click
** Where: set-data
** Near: face/action/on-click face


I looked into: help ctx-rebgui/widgets/grid/action, but those funcs 
are not set. Is there any need to set those function for particular 
widget? I looked at some other styles as e.g. button, but button 
is not using its face/action/on-click either, so I am a bit confused 
....
Graham
10-May-2009
[8036x2]
http://trac.geekisp.com/rebgui/browser/widgets/button.r
engage function seems to handle the click on the 'up event
Pekr
10-May-2009
[8038]
yes, but there is no code in grid, which calls on-click. My asumption 
is, that it is being called by rebgui internally for my widget. So 
I have to probably define it. Dunno. Most probably I am not able 
to proceed further. There is not clear description of that functionality.
Graham
10-May-2009
[8039]
which grid?
Pekr
10-May-2009
[8040]
Cyphre's grid. After Henrik's grid it is simply the most advanced 
REBOL grid and it is really stupid it was not adopted to new standard, 
waste of functionality and money ...
Graham
10-May-2009
[8041x2]
I seem to have a grid.r in my distro.
there's on on-key handler there.
Pekr
10-May-2009
[8043]
yes, but you use probably old Rebgui distro, no?
Graham
10-May-2009
[8044]
not the latest version
Pekr
10-May-2009
[8045]
I downloaded 118 and there is no grid. Grid was not adopted to new 
API IIRC.
Graham
10-May-2009
[8046]
I never saw the grid ever working.
Pekr
10-May-2009
[8047x2]
well, there is 'on-key, but it is not what is needed imo. Widgets 
do use abstracted widget/action principle ...
Graham - it is not true. IIRc I prepared package which I sent to 
you, with primitive initial doc, with included rebgui version, and 
it was working. The bad thing is, that it is some early version I 
paid for, but at that time there were some API changes to RebGUI, 
and I was not able to further contract Cyphre to adapt it ...
Graham
10-May-2009
[8049]
Pekr, I never got that to work.
Pekr
10-May-2009
[8050]
I think I know why - because it worked with some 2006 version of 
RebGUI, but not later ... well, I'll see, what I can do ....
Graham
10-May-2009
[8051]
go for it!
Ashley
10-May-2009
[8052]
The problem with the grid widget was that it relied on custom changes 
in rebgui-edit.r (i.e. it wasn't self-contained) and it was just 
too big to easily "grok" (and hence port). A good grid widget should 
have as few features/options as possible IMHO (i.e. get something 
that handles the text-only 80% case before worrying about more complex 
sub-widget support).
Pekr
10-May-2009
[8053]
ok, so here we are, with such argument and final result - no proper 
grid with basic functionality like horizontal scrolling.
Ashley
10-May-2009
[8054]
scroll-panel data [sheet] ?
Pekr
10-May-2009
[8055x4]
OK, here we go:

- full keyboard navigation

- virtual-data-system - ability to hide/show columns, without the 
need to reorganise original data block (virtual columns)
- the same for rows
- programmable navigation (goto)
- buttons, checkboxes - simply layout elements in cells
- tri-state columns - sorted, unsorted, original

missing  (it was supposed to be done as an update):
- column resizing
- saving the configured state for particular form
I do understand your point of view, which is - you try to keep Rebgui 
to its original idea. But - VID styleset is not real alternative 
to R2 GUI navadays, so refusing more complex widgets, especially 
in the case where noone really pushes anyone to use them, is escaping 
my understanding.
Of course if grid breaks some RebGUI habits, then it is not good 
.....
I'll try to talk to Cyphre, but not sure how deep the changes would 
have to be. If it would require a rewrite, then I am not ready to 
pay for it once again ...
Ashley
10-May-2009
[8059]
RebGUI is in maintenance mode so at least no more drastic (widget 
breaking) changes are in the pipeline ;)
shadwolf
10-May-2009
[8060x2]
i'm trying to port area-tc to rebgui ... and I don't understand why
when i do