REBOL 3.0

Comments on: GUI: Example: Color Picker

Carl Sassenrath, CTO
REBOL Technologies
21-Oct-2008 18:07 GMT

Article #0153
Main page || Index || Prior Article [0152] || Next Article [0154] || 10 Comments || Send feedback

We're getting to the point in R3 where we want to start throwing micro-reblets at the GUI to see what they look like and help uncover any problem areas.

Here's an example of a simple color picker. It shows a few things:

  • Basics of panel-in-panel layout (resizable)
  • Transparent panel background overlay
  • Face DO reactor (event action) reuse
  • In-context computation of values
  • Auto computation on view (entry)
  • API access to panel elements
  • Option override of natural size vs actual size (box)
  • Automatic sizing and resizing

The code is:

stylize [
    lab50: label [facets: [size: 50x10]]
]

view/options [
    cpan: panel 2 200.200.200.80 [
        lab50 "Red:"   slider red    do 'set-clr
        lab50 "Green:" slider green  do 'set-clr
        lab50 "Blue:"  slider blue   do 'set-clr
        lab50 "Alpha:" slider silver do 'set-clr
    ]

    group 1 [
        cbx: box options [size: 100x24]
        cfd: field "0.0.0.0"
        button "Ok" close ; for now
        button "Cancel" close
    ]

    set-clr: when [enter] do [
        vals: get-face cpan
        color: add add add
            255.0.0.0 * vals/1
            0.255.0.0 * vals/2
            0.0.255.0 * vals/3
            0.0.0.255 * vals/4
        set-face  cfd form color
        set-facet cbx 'area-color color
        draw-face cbx
    ]
][
    title: "Pick a Color"
    columns: 0 ; horizontal
]

The result is...

(Ignore the color-scheme/theme -- just a vibrant development scheme to keep awake.)

So, other than the "theme" what parts would like I like to improve?

It's kind of a small thing, but I don't like that stylize at the top for the lab50 style. We can remove it by fiddling with the sizing defaults for label itself. The same may be true for the box face that sets the size option.

All of this is a balancing act of course. It's impossible to generate every useful layout with just the default options, but we can at least strive for making it as simple a possible, and of course, no simpler.

10 Comments

Comments:

-pekr-
21-Oct-2008 16:53:33
1) I don't think stylize is a problem. Here it is one line, but it as well be in separate file as a stylesheet. But anyway - I would put 'style shortcut back to layout dialect, if it is not there

2) why don't you use inline options? It would look like:

label 50x10 "Red:"
box 100x24
I would use options [] form of description only if my block would be better readable as multiple lines of code ...

3) how is face DO reactor functioning? What if our GUI will contain some accelerator keys? How does it collide with style/face actors, which can be looking for 'enter event value? What is 'set-clr tied to? Global window?

claude
21-Oct-2008 17:56:55
hi,

first of all, thanks for rebol.

i'm a true beginner in rebol since 4 years :-(

i try to use it in my job to do little work. i use rebol with nagios. I show with rebgui some sql data. i try to use easy-soccer and use cheyenne with FRS product for input data to a oracle db and automatise some process.

i try every day to keep my faith to rebol. but with rebol3 WE need more !!!!!

i think for your test you would do a application like "pet's store"

there are a lot of avantage to do this:

1-show people like me, how do these things with the best of rebol

2-test your baby rebol3 in real application example

3-test the application with gui part(view3 and agg) , html part(with a plugin perhaps) , server part (rebol services)

4-present to the world the benefits of rebol in terms of coding, deployment, simplicity

5-etc......

i would like to have in rebol3, facet TABLE(widget) very cool,very fast and easy to populate. facet TREE etc....

we need 'WORD to easily manage amounts in applications accountants, or otherwise.

etc...

i don't know if rebol is for me....

but i my work i try to show to the others some rebol avantage......

help me, help us, that rebol be seen as a real solution

regards

ps: think to a "pet's store" example ;)

Philippe
22-Oct-2008 15:20:22
I don't remember who do that (Oldes?) : a very nice color picker wich allows the choice of color and shows the RGB+Alpha result, but also the HTML code. For the "OK" button, I suggest to push also the result directly in the clipboard.
MikeL
23-Oct-2008 23:29:47
I don't see any problem with this. Looks clean and easy to do.

Some of the prior VID challenges were on tabbing and focus and hiding (tabbing seemed to unhide) so examples that show these would be interesting.

Jose de Jesus Rodriguez
24-Oct-2008 1:31:09
I'm totaly new at Rebol. I copied and pasted this code in the console and get the following error message:

** Script Error: view expected view-face argument of type: object ** Near: view/options [ cpan: panel 2 200.200.200.80 [ lab50 "Red:" slider red do 'set-clr lab50 "Green:" sl... >>

Can someone help me?

-pekr-
24-Oct-2008 2:13:09
Jose,

those are examples of unreleased REBOL 3 alpha version, so it will not work with R2 :-)

With R2, VID2 had some deficiencies, and it was not easy to extend/fix, without rewriting it. That is also why you could be interested in RebGUI alternative GUI for R2. With R3, we try to utilise our 7 years of experience, it is total GUI rewrite, and it should be really cool and robust ...

Henrik
24-Oct-2008 10:33:04
Hi, Jose and welcome

Rebol Technologies are building a new version of REBOL, REBOL 3.0, which is being talked about in this blog and so, all examples are for their new unreleased version of REBOL.

You may want to study the REBOL 2.7 version over at rebol.com or go to reboltalk.com and ask questions there.

Shadwolf
28-Oct-2008 1:07:16
Sorry for you Claude rebol is not for everyone and less for begginers. Why ? Because Carl Said So...

Unfair? hum Yes I agree Even Dockimble and Cyphre started their first rebol experience with print "Hello Worl!" then they done a alert "Hello World", well and after they went all freak and start doing amazing things...

So Welcome to rebol world even if Carl will not welcome you ^^.

Shadwolf
28-Oct-2008 1:11:42
Can I say I absolutly don't care? Can I say I'm pissed of? Can I say that yet another boring and useless widget?

If I can speak you get my opinion on the topic. You want to interrest me come with a native menu/popup meny in 50 lines with friendly way to feed the menu entries and let's get crazy some transucent function.

So far i don't see why I shouldn't use RebGUI anymore. So far I don't see why Gabriele project have been trashed out.

Nothing relevant so far.

Shadwolf
28-Oct-2008 1:16:36
Enought of borring post like: "what will be the color of the cat !!!!"

I want a complete widgets list of what is going to be in rebol 3 I want a complete list of the engine. And don't try to trick us again with 50 differents widgets to format 1 line of text!!

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

R3-0153


Comment:


 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

REBOL 3.0
Updated 26-Apr-2024 - Edit - Copyright REBOL Technologies - REBOL.net