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

World: r3wp

[!REBOL3 GUI]

Pekr
23-Jan-2011
[5438x2]
I have a question to 'when style - is that adapted? Well, it basically 
works, in a simple panel example:


lay: [button "OK" do [print "OK"] when [load] do [print "screen on-load"]]
view lay

But when I simulate the demo, it is not triggered:


lay: [button "OK" do [print "OK"] when [load] do [print "screen on-load"]]

panel: make-face 'vpanel [columns: 1] 
set-panel-content panel lay

win: make-face 'window []
set-panel-content win panel

view win
in the second example, we don't even need to use 'win, just "view 
panel", and the result is the same. I simply wonder, where's the 
problem. My suspicion is, that panel content functions are not compatible 
with the 'when style?
Cyphre
24-Jan-2011
[5440x3]
Pekr, currently, the LOAD trigger is triggered during the 'making 
of panel' and not when the content of the panel changes. But you 
can 'workaround ' that.

Also the content handling functions doesn't process the triggers 
correctly but we'll fix that part.
The questions are:

1. Should be LOAD triggered when whole content of panel changes? 
I'd say yes.

2. Should be LOAD triggered when part of the content of panel changes? 
I'm not sure here.
To workaround the current issue you should build the panel like:


lay: [button "OK" do [print "OK"] when [load] do [print "screen on-load"]]
panel: make-face 'vpanel [columns: 1 content: lay]
win: make-face 'window []
set-panel-content win panel
view win
I such case the lay is built during the 'vpanel creation so the triggers 
get called.
Pekr
24-Jan-2011
[5443x3]
OK, leaving for a business trip, but one other question:


when I click toggle, it crashes. It seems to me, that the 'of reactor 
and namely exclude panel is not handled properly, but I will try 
later ...
** Script error: cannot access faces in path panel/faces

** Where: exclude-faces -apply- apply if foreach if do-face if do 
do-bind-actor

actor all foreach do-style until if do-event do-event do-event either 
-apply- wa

ke-up loop -apply- wait do-events if view catch either either -apply- 
do
** Near: exclude-faces face name
Cyphre, thanks for the tips. If you will have any new release with 
some bugs fixed, please post it, so that I don't try to adapt already 
dated sources ...
Cyphre
24-Jan-2011
[5446]
We'll definitely release new version this week, as usually ;)
Pekr
24-Jan-2011
[5447]
Ah, I thought that each new version is announced? OK, I will watch 
for changes myself, no problem ;-)
Ladislav
24-Jan-2011
[5448]
Cyphre's "as usually" most probably means "on Friday", and I bet 
Cyphre will put a note to the announcement group when the update 
will be available.
Pekr
24-Jan-2011
[5449x6]
Interesting. I know that I was told that 'when style is not adapted, 
but - you probably saw my earlier screenshot, which shows space at 
the top of the panel. I get this, when I use the following method:

pan: make-face 'vpanel [columns: 1] 
insert-panel-content pan pick test-blocks index
set-panel-content main-pan pan


But - if I use Cyphre's method, the visual space at the top of the 
panel is not there. My quick conclusion is, that panel content handling 
funcitons are not compatible for various creation methods:


pan: make-face 'vpanel [columns: 1content: pick test-blocks index]
set-panel-content main-pan pan

Going to temporarily use Cyphre's version ....
How is now R2's face/pane, and earlier face/faces replaced? I can't 
see it in the structure. Is that a gob!?

>> help main-pan
MAIN-PAN is an object of value:
   style           word!     vpanel

   facets          object!   [init-size min-size max-size align valign 
   res...
   state           object!   [mode over value]
   gob             gob!      offset: 3x46 size: 572x503
   options         object!   [content]
   tags            map!      make map! [ panel true ]
   draw-result     block!    length: 45
   intern          none!     none
   name            word!     main-pan
   names           object!   [t1]


I really miss the simple aproach of R2 guys. I wish I had a /pane, 
a simple block of stored subelements, accessible via normal rebol 
series functions, so no need for me to investigate the special purpose 
functions. That's what I call simplicity.
'of reactor does not work. It calls 'exclude-faces function, which 
crashes on trying to access panel/faces, which does not exist, as 
shown above.


I have also some difficulcy to understand, what is 'of good for. 
I am not sure I like the name, as I was not able to understand the 
code like:


t1: toggle "Toggle" of 'tog      .... where 'tog is not part of the 
panel. The help string says: "Mutual exclusion of logic SET on other 
faces (radio buttons)"


I suggest alternate names - mute, mutual, invert ... that's just 
a suggestion, simply put reading 'of in the code does not make the 
functionality obvious enough for me, unless I look into docs ...
set-panel-content is imo definitely buggy (well, apart from the fact, 
that when I find the bug, most of the time the bug is elsewhere :-)
I mean - insert-panel-content ...
It contains the following code:

	content: either block? content [
		apply :parse-panel [
			content all [in panel/facets 'names panel/facets/names]
		]


So, when I submit a block to set(insert)-panel-content, it tries 
to parse the dialect. But, there is no panel/facets/names.
Pekr
25-Jan-2011
[5455]
I would also like to report, that R3 is highly unstable, when playing 
with panels, and trying to set their content, e.g. manually to some 
slots (I tried doing directly main-pan/content: lay, main-pan/facets: 
lay, main-pan/facets/content: lay, main-pan/gob/pane: lay), to simply 
obey insert-pane-content function. It does not take much time for 
R3 to crash, and now I mean hard-crash - exiting the R3. No matter 
what nonsense I am trying to do, it should not crash R3 imo ....
Cyphre
25-Jan-2011
[5456x3]
re "was told that 'when style is not adapted" - it's not adapted 
to use it with the dynamicc  *-panel-content functions but works 
well if  used in normal layout handling.
How is now R2's face/pane...
 - you can use: faces? my-face to get the block of sub-faces
 'of reactor does not work ...

 - I never tried/know about this one so either it is some obsolete 
 stuff or not updated to the new changes
Henrik
25-Jan-2011
[5459x2]
it probably should work for radio groups
or should be made to work
Cyphre
25-Jan-2011
[5461x2]
re insert-panel-content: I don't see what is wrong with the code 
snippet you posted. Can you show some real example where it fails 
for you?
re "R3 is highly unstable..." - we know about a case where R3 crashes. 
We were able to isolate the problem so it can be reproduced. Carl 
is now investigating this issue. It is possible that all the crashes 
you see are because of this one problem. Let's see once this one 
is fixed.
Pekr
25-Jan-2011
[5463x2]
Cyphre - simply put - in a demo I am porting, I am not able to get 
the subpanel to work - it displays, but  don't perform actions. E.g. 
single button press causes:


** GUI ERROR: Cannot parse the GUI dialect at: panel 240.100.80 title 
Alert grou
p doc Button pressed! scroller
Or I have something wrong in the demo code, not yet fully adapted:

view-sub-panel: funct [
	index
	main-pan
	desc
][
	set 'current-panel index
	set-face desc form pick test-notes index
	pan: pick test-panels index
	unless pan [

  pan: make-face 'vpanel [columns: 1 content: pick test-blocks index]
;		insert-panel-content pan pick test-blocks index
		poke test-panels index pan
	]

	set-panel-content main-pan pan
;	switch-panel main-pan pan 'fly-right
]

view [
	title "R3 GUI Tests"
	text (reform ["R3 V" system/version "of" system/build])
	bar
	hgroup [

		; List of test sections:
		text-list test-sections do [view-sub-panel value main-pan desc]

		; Panel for showing test results:
		vgroup  [
			desc: text-area "Please read the instructions below."
			options [
				max-size: 2000x40
				text-style: 'bold
			]

			main-pan: vpanel [
				text "test" ;doc instructions
			] options [columns: 1 init-size: 280x380]

			hgroup [
				button "Source" do [
					either current-panel [
						view-code trim/head mold/only pick test-blocks 
current-panel
					][
						request "Note:" "Pick a test first."
					]
				]
				button "Halt" leaf close halt
				button "Quit" maroon quit
				check "Debug"  do [guie/debug: if value [[all]]]
				check "Remind" guie/remind do [guie/remind: value]
			]
		]
	]
;	when [enter] do [
;		if quick-start [
;			if spot: find test-sections quick-start [

;				view-sub-panel index? spot main-pan desc  ; for faster testing
;			]
;		]
;		;[request "Alert" instructions]
;	]
]
;[reactors: [[moved [save %win-xy.r face/gob/offset]]]]
Cyphre
25-Jan-2011
[5465]
Pekr, can't you post the whole script somewhere on the net so I can 
download and see what it does?
Pekr
25-Jan-2011
[5466]
yes, sorry, wait a little bit, I am at our subsidiary. But maybe 
I could discuss it personally with Ladislav, as I am in Turnov, some 
20 km from Liberec :-)
Ladislav
25-Jan-2011
[5467]
hmm, do you intend to visit Liberec today or tomorrow?
Pekr
25-Jan-2011
[5468x9]
:-) I don't know if I will have time for that. Still at Aminostar, 
today 3 hours I will write a project doc, tomorrow ditto Aminostar, 
and I should leave for Prague in teh evening. So - if I would be 
supposed to visit Liberec, it would be sometimes after the luch, 
having some 1-2 hours at max ....
As Cyphre explained one concept to me, and because I have some questions, 
I post it publicly, so that others might benefit from the info. I 
was not properly understanding the structure of the panel. Cyphre 
was kind of surprised why do I need to know it, and that I might 
not eventually need it for the layout work, but the truth is, that 
I would like to understand system internals.


In R2, the structure of the face was mostly the same IIRC. And you 
put your elements into face/pane. I found out, that structure of 
face might be different for various styles. I hope I am not wrong. 
And in such a case, I suggest to document particular style fields, 
so that one does know, what does it serve for. That might be really 
good for programmers ...
I was particularly interested to know, what is the difference between 
- style/facets/names and style/names
style/facets/names is a logic value, which you can set to true, and 
it is usefull for compound styles. Sub-faces referenced by name is 
then style local, and does not leak to globals, does not get rewritten 
by new instance of the style ....
example:

stylize [
container: hpanel [
	content: [a: button "A" b: button "B"]
	facets: [names: true]
]
style/names/a, style/names/b is example for the access to the above 
....
Now I have following points to think about:


1) in REBOL we often don't user conventional naming, but if we would 
use it, then probably 'locals? would be a better name?
2) it is a logic value, why 'names, and not 'names? ?

3) for the instance locals, we use name 'intern during the style 
creation, so why not 'intern?

4) I was really so used to the 'pane (or container in other environments), 
that so far I don't like 'content, and I don't like referring to 
the name referenced faces by style/names/a. So, if my understanding 
is correct, and /content just stores the dialect (not reduced?), 
then why not:

face/intern?: true
face/pane/a, face/pane/b
face/facets/layout?


The thing is, that it is still difficult for me to understand the 
role of a gob! Because gob has a pane, and the concept of gob, multiple 
gobs, and faces organising gobs, made the concept messy in my head 
:-(
in above - one correction - face/facets/intern?, as a replacement 
for face/facets/names .....
what is actually being stored in panel/gob? And what is panel/draw-result? 
And is face/facets/content just a layout dialect stored, or already 
reduced?
Rebolek
25-Jan-2011
[5477x2]
Your suggestions seem logical (names? vs. names), I think it can 
be changed.
Gobs - you don't have to care about them.
Pekr
25-Jan-2011
[5479x2]
Ah, return of lost son? :-)
I don't need to care about some stuff I can understand, so - I will 
investigate further anyway, just for the sake of better understanding, 
and .... because it is fun :-)
Rebolek
25-Jan-2011
[5481x2]
yes, from the land of flu :)
it's simple, there's tree-like gob structure. that's all
Pekr
25-Jan-2011
[5483x4]
That gob structure does not comply with faces. I need to see some 
drawing, or it is a mess, which noone will ever understand. And I 
assure you, that programmers will require to understand that ...
what is the difference for e.g. between panel/gob, and panel/facets/gob?
to je kua pekne masne, to od Dakca postavime za tu cenu ve full-coloru 
:-)
akorat to proste neni potreba ... a vlastne mozna nepostavime - muselo 
by se zpocitat, kolik by z toho jednoho panelu byl prouzek
Henrik
25-Jan-2011
[5487]
uh oh... is it really bad now? :-)