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

World: r3wp

[!REBOL3-OLD1]

Graham
15-Feb-2009
[11354]
in case we wish to dynamically insert objects into the display and 
then remove them as they do in Javascript
Anton
15-Feb-2009
[11355]
yes, exactly. Dynamic structure.
Graham
15-Feb-2009
[11356]
Why?  If there's a tab order ... then there must be a serial structure
Anton
15-Feb-2009
[11357x2]
Which can be messed up all too easily by dynamic structure. Your 
program could reorder tabs for instance.
Or, as you say, a tab could be inserted/removed.
Graham
15-Feb-2009
[11359x3]
Eg.  I like to create tables first as instant feedback, and then 
fill them with data from an async function.
But I need to overlay a busy graphic which I can then remove ...
in the callback
Anton
15-Feb-2009
[11362x3]
Ok, so you as the programmer know that your table has a specific, 
static order at the time you need to fill it. No problem.
Did you also mean that you'd like ACTIONS associated with STRUCTURE 
elements anonymously?
view [
	; STRUCTURE
	text-list data files  ; <---- element #1
	code-area  ; <---------- element #2

	; ACTIONS
	[on-click [set-face ...] ] ; <---- actions for element #1
	[on-enter [ ... ] ] ; <---------- actions for element #2
]
Graham
15-Feb-2009
[11365x2]
well, I don't want to name each element of the structure
but maybe we have to .
Anton
15-Feb-2009
[11367]
We could combine both approaches. In the ACTIONS section, if there's 
a word followed by a block, then the word is the name reference to 
the element (eg. 'my-text-list), but if there is just a block, then 
the next element is taken anonymously.
Graham
15-Feb-2009
[11368x2]
Any objections to this vid enhancement?
not all structural elements will have an action
Anton
15-Feb-2009
[11370]
view [
	; STRUCTURE
	my-text-list: text-list data files ; <------ element #1
	code-area ; <--------- element #2

	; ACTIONS

 my-text-list [on-click [set-face ...] ] ; <----- actions for my-text-list

 [on-enter [ ... ] ] ; <------- actions for the next anonymous element 
 (in this case code-area).
]
Graham
15-Feb-2009
[11371]
I guess they will ... on-hover, on-tab etc
Anton
15-Feb-2009
[11372]
Yes, that could make some confusion. Specifying empty brackets [ 
] could act as a "ignore this element".
Graham
15-Feb-2009
[11373]
or, [] = don't override the default actions
Anton
15-Feb-2009
[11374]
view [
	; STRUCTURE
	my-text-list: text-list data files ; <-- element #1
	label "on-line"
	code-area

	; ACTIONS

 my-text-list [on-click [set-face ... ] ] ; <--- actions for my-text-list
	[ ]  ; <-- actions for label

 [on-enter [ ... ] ] ; <--- actions for the next anonymous element 
 (code-area)
]
Graham
15-Feb-2009
[11375]
so the layout parser sets the action properties of each gui element
Anton
15-Feb-2009
[11376x3]
Just thinking, should the actions section be specified in a block 
? eg:

view [
	; Structure
	my-text-list: text-list

	; ACTIONS
	actions [
		my-text-list [ ... ]
	]
]
Now, recursive structures.
Sub-panels.
Graham
15-Feb-2009
[11379]
the actions would have to be specified in the panel defintion
Anton
15-Feb-2009
[11380x3]
So each panel only specifies the actions of its own top level elements.
So:
view [
	; Structure
	label "hello"
	panel [
		; Structure
		my-text-list: text-list
		actions [
			my-text-list [ set-face ... ]
		]
	]
	actions [
		[ ] ; <--- actions for the LABEL
		[ ] ; <-- actions for the PANEL
	]
]
Graham
15-Feb-2009
[11383x2]
yes ...
actions: [ skip 1 [ someaction ] ]
Anton
15-Feb-2009
[11385]
Hmm. Using SKIP would be like using GOTO. The trouble it's trying 
to avoid is having lots of dummy empty brackets, of course - a noble 
goal.

It would be better to simply use a name-reference (keeping in mind 
that these are now, in Rebol 3,  local to the window context), for 
jumping across a (possibly varying, during code maintenance) number 
of empty action placeholders.
Graham
15-Feb-2009
[11386x3]
or, how about 

actions [ label [ ] panel [] ]
so we can assign by type
now we don't have to keep the actions in order unless there are more 
than one of the same type
Anton
15-Feb-2009
[11389x2]
view [
	; Structure
	label "hello"
	text-area
	my-text-list: text-list
	code-area

	actions [
		my-text-list [ set-face ... ] ; <--- action for my-text-list
		[ ] ; <-- action for code-area
	]
]
So, above, during code maintenance any number of extra fields can 
be inserted before my-text-list and it won't affect the actions assignment.
Graham
15-Feb-2009
[11391x2]
view [
	; Structure
	label "hello"
	text-area
	my-text-list: text-list
	code-area

	actions [
		text-list [ set-face ... ] ; <--- action for my-text-list
	]
]
there's only one text-list in the window
Anton
15-Feb-2009
[11393x2]
There can be an overlap in names, so we have to deal with this possible 
ambiguity:
view [
	text-list: text-list  ; <--- TEXT-LIST #1
	text-list  ; <--------- TEXT-LIST #2
]
Where the name-reference is the same as the element type (text-list).
Graham
15-Feb-2009
[11395x2]
we could just use order ... and not names
actions [
	text-list [
		[ text list 1 ]
		[ text-list 2 ]
	]
]
Anton
15-Feb-2009
[11397]
Perhaps lit-words could be used to indicate that it's a type, eg:

	actions [

  'text-list [ set-face ... ]  ; <-- Action for all text-lists in the 
  window.
	]
Graham
15-Feb-2009
[11398]
this would allow code reuse
Anton
15-Feb-2009
[11399]
(Ugh... the sight of hard-coded numbers make me a bit queasy...)
Graham
15-Feb-2009
[11400x2]
the numbers aren't there ...
just using the order  in the block
Anton
15-Feb-2009
[11402x2]
oh
so you meant:
	actions [
		text-list [
			[ ... ] ; <-- action for the first text-list
			[ ... ] ; <-- action for the second text-list
		]
	]