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

World: r3wp

[!REBOL3 GUI]

Henrik
7-Mar-2010
[1171]
If I need to communicate with the container, I usually just: do-style 
parent-face? face actor-name
Steeve
7-Mar-2010
[1172x3]
I was just wondering why you don't need it, actually :)
well, ok it will work, but  in your case, the child faces must be 
well aware of the need to redirect some events to the parent.
In my model, they don't need to know it.
The container "capture" the events he needs
Henrik
7-Mar-2010
[1175x2]
ok, we'll just have to see if this becomes necessary later. the model 
I base containers on is a little different.
right now I have some trouble getting the new record reactor to work....
Steeve
7-Mar-2010
[1177]
:)
Henrik
8-Mar-2010
[1178]
Chris, you are somewhat right. At least there are some parts of GET-PANEL 
and GET-FACE I've not paid enough attention to. The thing for the 
prototype is that it collects data from faces and puts them in an 
object in kind of a convoluted way.

What about the following design for GET-FACE:

- When used on a panel, GET-FACE returns a flat object

- If a face doesn't have a set-word name, then it's not included 
in the object


And for SET-FACE, it would have to be directly opposite, so you can 
say:

set-face get-face panel
Chris
8-Mar-2010
[1179x2]
I think that'd be good step forward, and quite intuitive...
And if possible, the top-level layout object...
Graham
8-Mar-2010
[1181]
This http://www.rebol.net/wiki/Template:GUI_TOC leads to this http://www.rebol.com/r3/docs/gui/gui.html
and this message


So, you found this page from the sitemap? Sneaky.

This GUI section 
is under construction (on a different server). It's not meant for 
publication yet. To be transferred here as they move into final draft 
stage.

Many of these links don't yet exist. They are being filled 
in at this time. Also, the image links are not yet setup.

So, no I didn't.
Graham
9-Mar-2010
[1182x2]
Are scripts like Jawi script supported?
Guess right to left is not
Henrik
9-Mar-2010
[1184x4]
Chris, the top level layout object is the window and it should be 
possible to get that too, but by using GET-PANEL directly. GET-FACE 
on the WINDOW style returns a value that would be stored by clicking 
an ok or cancel button in the window.
...but the value is not yet stored as the ok and cancel button styles 
don't yet exist.
Looking at reactors now, this seems to be the way to store these 
emit functions. Reactors are more powerful than I thought and according 
to docs, under the place Graham links to above, we can write our 
own. The MAKE-REACTOR function doesn't exist though, it's called 
MAKE-FACE-ACTIONS.


I hope to make use of triggers as well. Triggers are faces that are 
not stored in the layout after they have been processed. They are 
performed either when entering a panel during layour or when exiting 
it (possibly also other places). I hope that triggers can be used 
to pass specific options to already laid out faces, making triggers 
appear as options to a face.
ok, triggers can't be used, as they only work on panels. There's 
too much work involved in making them work for individual faces, 
it seems.
BrianH
9-Mar-2010
[1188]
Making a trigger work on a face would require making the face contain 
other faces. Which would turn it into a panel.
Henrik
10-Mar-2010
[1189]
BrianH, yes, that would be a work around, so I'm not using triggers.


I've written a GET-DB-PANEL function now that fulfill the specs, 
including SKIP, TABLE, _DATA, scoping, etc. This function is custom 
to RM-Asset, so I'm not sure we want it in the R3 GUI other than 
as an extension package.


Also, I've written an EMIT reactor that emits the panel in GET-DB-PANEL's 
object format as an SQLite record (predefined object).

I'm using options for now along with GET-DB-PANEL.

What this shows:

- Writing reactores is easy peasy.
- Using reactors is even easier.

- Doesn't break anything in the R3 GUI, if you GET-PANEL instead 
of GET-DB-PANEL.

An example of how this is used:

rec: make object! [] ; the SQLite database record object

view [
	form-panel: panel 1 [
		id: field options [skip: true]		; write-only field
		name: field				; stored in the object as 'name
		age: field				; stored in the object as 'age

  note: field options [_data: true]	; both these will be stored in 
  the _data map!
		bytheway: field options [_data: true]
	] options [record: 'rec]
	button "Emit" emit 'form-panel
	button "Submit" submit 'form-panel %form.txt
	button "Acquire" acquire 'form-panel %form.txt
]

So when you press Emit, 'rec will be set to:

make object! [
	name: ""
	age: ""
	_data: make map! [
		note: ""
		bytheway: ""
	]
]

If you press Submit, this object is made:

make object! [
	id: ""
	name: ""
	age: ""
	note: ""
	bytheway: ""
]

and is stored on disk with the name %form.txt


If you press Acquire, the above mentioned object is automatically 
loaded from disk and into the form.


Still need a one-liner for loading SQLite data into the form. Going 
to work on that now.
Pekr
11-Mar-2010
[1190]
I know that you guys are doing some stuff for real apps, but those 
concepts really seem very preliminary, and kind of high-level in 
relation to GUI itself. Maybe this does not even belong to GUI itself. 
I alway hated, when GUI dictated me, how should I work with my data 
.... it is always like that - you come up with just one method, of 
possible tonnes of other methods of data to form relation handling. 


We don't have tabbing, focusing, accelerator keys support, unicode 
support, layers, transition effect, rich-text and draw probably still 
need some improvements,  etc., we don't have any more complex style 
to prove our GUI allows to be extended flexibly, so I think that 
solving how to handle data from SQL at this stage is very very preliminary 
:-)

This is just my opinion :-)
Henrik
11-Mar-2010
[1191]
Robert needs this for an application as soon as possible. I can assure 
you that if things like GET-PANEL and SET-PANEL aren't working correctly, 
getting data in and out of the UI will be quite painful, worse than 
digging through an R2 face tree manually. But fortunately I spent 
these few hours yesterday, making sure it's easily done in a single 
line of code.
Pekr
11-Mar-2010
[1192]
so, why not to fix get-panel and set-panel then? :-)
Henrik
11-Mar-2010
[1193x2]
fix? could you rephrase that? I already fixed them.
Anyhow, a form like this:

http://rebol.hmkdesign.dk/files/r3/gui/196.png

can be set in one line of code and retrieved in one line of code.
Pekr
11-Mar-2010
[1195x2]
Nice! Henrik - one question. In Zachary app generator I used in DOS 
era for Clipper, there were basically two options, of how to initialise 
form - 'new, and from DB. Simply put - you set-up new record, and 
you want to have some items to be pre-filled with some default values. 
Is that possible with your concept?
Nice "skin" too :-)
Graham
11-Mar-2010
[1197]
I used Genifer for dBase and Clipper
Henrik
11-Mar-2010
[1198]
Currently the form is bound to one record. Good question, btw. on 
new item. It's simple to do in principle, but I think it requires 
a clearly defined set of functions (reactors) for simple db operations:

I guess one wants these reactors (names not finalized):

emit - get data out of form to table. Done.
obtain - get data from table into form. Done.
next - next record
previous - previous record
first - first record
last - last record
new - new record
delete - delete record
Pekr
11-Mar-2010
[1199]
In Zachary I really liked one feature. There was subtale, where you 
defined On-update ... simply you could add multiple to-update records. 
So - you e.g. added 5 iPhones to stock. The field has registered, 
that on-update updates stock amount. If you deleted order, it was 
automatically withdrawn from the stock ... etc.
Henrik
11-Mar-2010
[1200]
there is also the case for displaying multiple records in one form. 
I've solved that in the VID Extension Kit, by providing an alternative 
form with fields that are disabled. clicking a checkmark enables 
the field and lets you set a value. when the value is set and you 
submit, the involved records have that value updated.
Pekr
11-Mar-2010
[1201x2]
When will we be able to build more complex styles, as tabs, grids? 
I mean - is all infrastruture inside already?
I do remember how I disliked one simple draw block (one gob) to represent 
a style. IIRC BrianH said, that multiple gob styles are possible. 
Would that be a hack? Or is method already supported?
Henrik
11-Mar-2010
[1203x2]
You still use a single draw block, although you can switch between 
different draw blocks for one GOB. One thing I don't want, as a style 
writer, is also to have to manage the GOBs as well. That makes it 
significantly more difficult to write styles, but I suppose there 
will be special styles coming around where you can use dialects like 
MAKE-GOB to freely define what's inside that style.
tabs: we already are able to switch between panels and need a button 
panel for doing this.
grid: big job and cyphre has already volunteered. :-)
Pekr
11-Mar-2010
[1205x2]
ah, fine. Hope that he will use some of mine outlined Rebgui grid 
- virtual rows/columns, so that you can use raw data block directly 
from SQL query, no need to rebuild it into special block. Very usefull 
...
btw - docs are geting better and better. Draw and Shape docs were 
added recently. Gobs too ...
Henrik
11-Mar-2010
[1207]
Has anyone taken a look at Active Records? It looks quite interesting.

http://ar.rubyonrails.org/
Pekr
11-Mar-2010
[1208]
This is quite this kind of nonsense I thought we could avoid :-) 
You simply often might find the case, where it will not fit your 
situation, and then docs say - you can't do everything, using the 
concept. So then you are left with some usefull, but not-in-100%-cases 
usefull case, and between the raw solution. IIRC Chis has similar 
solution with his system? I don't remember the name .... however 
- this does not belong in the GUI group, and this is exactly where 
I thought your form  abstraction aproach will lead you :-)
shadwolf
11-Mar-2010
[1209]
To carl concerning the timing problems noticed on my computer i got 
those result (windows seven; CPU core i 5 750, DRR3 1333 Mhz; R3 
a 97)

>> dt [loop 10 [wait 0.0001]]
== 0:00:00.000016

>> dt [loop 100 [wait 0.0001]]
== 0:00:00.000084

>> dt [loop 1000 [wait 0.0001]]
== 0:00:00.000783

>> dt [loop 10000 [wait 0.0001]]
== 0:00:00.007763


As you can see on my coputer my timings are lower than expected so 
sthis issue is related to CPU horse power.
Steeve
11-Mar-2010
[1210x2]
Not the problem, try this instead, it should return around the same 
time, not the case.


>> repeat i 6 [print [n: 10 ** i "x" j: 0.1 ** i tab "=" dt [loop 
n[wait j]]]]
10.0 x 0.1			= 0:00:01.000137
100.0 x 0.01			= 0:00:01.00159
1000.0 x 0.001		= 0:00:01.023774
10000.0 x 0.0001		= 0:00:00.044802 (strange)
100000.0 x 0.00001		= 0:00:00.459103 (here too)
1000000.0 x 0.000001	= 0:00:05.503772
Conclusion, never use timer below 0.001
BrianH
11-Mar-2010
[1212]
I'll go with Carl's conclusion: It's a bug.
Henrik
11-Mar-2010
[1213]
hmm... when writing a reactor, you can specify any-type! as an argument, 
but GUI parsing halts when encountering a path! for that argument. 
Does anyone know if this is a DELECT thing?
Steeve
11-Mar-2010
[1214x3]
yep, delect is used for
path are evaluated by delect, they can't be used as parameter.
lit-path works
Henrik
11-Mar-2010
[1217]
ok, thanks
Steeve
11-Mar-2010
[1218]
strangly, get-path! works too
Henrik
11-Mar-2010
[1219]
I didn't think that it wouldn't work, since this is inside the dialect 
and so the path shouldn't be evaluated.
Steeve
11-Mar-2010
[1220]
well, word are evaluated as-well if they are used for parameters