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

World: r3wp

[!RebGUI] A lightweight alternative to VID

Henrik
17-Sep-2010
[8824]
is there a way to find the window face of a particular face in RebGUI?
Graham
17-Sep-2010
[8825]
find-window?
Henrik
17-Sep-2010
[8826]
doesn't work as RebGUI doesn't keep PARENT-FACE consistently available.
Maxim
17-Sep-2010
[8827]
in view (not VID) you need to do a show on a face for its parent-face 
to be updated.  but the face must be actually visible IIRC.
Graham
17-Sep-2010
[8828]
I've never had an issue with find-window... can you give us an example 
of it not working?
Maxim
17-Sep-2010
[8829]
actually, I meant to say that you need to do a show on the *parent* 
for the child's parent-face to be refreshed
Henrik
17-Sep-2010
[8830]
I've never experienced PARENT-FACE as reliable, so for the VID Extension 
Kit, I made separate functions to set it properly.
Maxim
17-Sep-2010
[8831]
so you need to make an accessor for the pane which automatically 
assigns the parent-face.
Ashley
17-Sep-2010
[8832x2]
RebGUI makes extensive use of parent-face (which is managed by View) 
... never had an issue with it.
RebGUI functions such as undisplay depend on it:

undisplay: make function! [
	"Closes parent display of face."
	face [object!]
] [
	while [face/parent-face] [face: face/parent-face]
	remove find screen*/pane face
	show screen*
]
Graham
17-Sep-2010
[8834]
undisplay??
Ashley
17-Sep-2010
[8835]
2.x series.
Graham
17-Sep-2010
[8836x2]
Oh ..
what does that do vs unview/only ?
Ashley
17-Sep-2010
[8838]
Give it the widget's face and no matter how deeply embedded the widget 
the "window" it is in will be closed. Avoids having to do unview/only 
face/parent-face/parent-face type operations.
Graham
17-Sep-2010
[8839]
I use this for that

unview-window: func [ face 
][
    unview/only find-window face
]
Gabriele
18-Sep-2010
[8840]
Henrik, parent-face is managed by the native code, so there's something 
definitely wrong if it does not work for you.
Henrik
18-Sep-2010
[8841]
The question is what that would be. But I have noticed way too many 
times that parent-face is NONE for faces that should be set up properly, 
particularly in VID, but apparently also in RebGUI.
Gabriele
18-Sep-2010
[8842]
parent-face can only be none if the face has never been shown, which 
may happen if you access it during layout and before the face as 
been shown.
Henrik
18-Sep-2010
[8843x2]
ok, that may be it.
I do recall that parent-face doesn't work during INIT in VID.
Anton
18-Sep-2010
[8845]
Gabriele is correct. PARENT-FACE is not set by LAYOUT, it is set 
by SHOW. I wrote some code which needed to know the parent-face before 
SHOW was used, so I did something like initialize the PARENT-FACE 
of every face in the face hierarchy myself.
I wanted LAYOUT to do this by default.
Graham
18-Sep-2010
[8846]
Would it be easy to patch layout to do this?
Henrik
18-Sep-2010
[8847]
I've tried, but the problem is that LAYOUT is not necessarily used 
recursively and thus doesn't always have a parent-face to use.
Graham
27-Sep-2010
[8848x3]
If you have something like this

b: button "text" on-click [ print face/text ]

you can't call the button action like this

b/action/on-click b


because the on-click action refers to 'face, and 'face is not passed 
when called this way.

What's the appropriate workround apart from using named faces ?

eg. on-click [ print b/text ]
Hmm.. perhaps face is passed
How to get the color of a button?


button/color seems to return none always even though it is set with 
set-color ...
Ashley
28-Sep-2010
[8851]
button color is controlled via draw block, not face/color.
Graham
28-Sep-2010
[8852x2]
display "" [ bt: button "Test"  button "Set color" [ set-color/no-show 
bt green probe bt/color ] button "Set Color2" [ set-color bt red 
probe bt/color]] do-events


so we can see that the bt/color is set to the right color, 'show 
is then called and bt/color is then set to none :(
this gets the color


display "" [ bt: button "test" green button "Color?" [ probe pick 
 bt/effect/draw 14  ]] do-events
Graham
6-Oct-2010
[8854x2]
What's the rationale for preventing windows with duplicate names 
from opening?  It seems to be a cause of a major bug with window 
handling.
Eg. If you have an app, and open a window1, and from that open window2, 
and then close window1, then window2 also closes but can never be 
opened again.  Removing the duplicate window title check seems to 
fix that bug.
Ashley
7-Oct-2010
[8856]
Havn't hit that bug before, will try and reproduce. Rationale for 
this behaviour is simple: users click a button multiple times and 
open multiple instances of the same window. Coding this check manually 
is a pain ... but if you want this ability then having unique window 
titles is easy.
GrahamC
7-Oct-2010
[8857x2]
I presume that when you close the parent the child is still hanging 
around or something
even though it appears to disappear
Ashley
7-Oct-2010
[8859]
It shouldn't. Perhaps it's behind another window?
GrahamC
7-Oct-2010
[8860]
Nope ..  definitely not.
Ashley
7-Oct-2010
[8861]
Following seems to work for me:

display "test" [
	button "W1"  [
		display "w1" [
			button "W2"  [
				display "w2" [text "test"]
			]
		]
	]
]
GrahamC
7-Oct-2010
[8862x5]
display "main" [ text "this is some text" button "child" [ display/parent 
"Child" [ text "close this window" button "grandchild" [ display/parent 
"Grandch
ild" [ text "topmost windo"]]]]] do-events
close the window that says "close this window" and then try to open 
all the windows again
The grandchild window will not open again.
http://screencast.com/t/y0PwDD9JBYoshowing this behaviour
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
[8870x4]
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?