[REBOL] Re: demo of a tree interface

2004-05-17 Thread Alain Goyé

Thank you Gregg for the precision about capturing keystrokes,

and

Thank you Arie for the idea to look at KeyNote, which I did'nt know about.
It looks nice. But just now I am lacking time. NoteReb will stand by for a
while, unless someone else wants to carry on...

Alain.

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: demo of a tree interface

2004-05-15 Thread Alain Goyé

Jaime,

I tried to follow your advice and replace the "insert" key with "Ctrl + i"
A strange bug happens (is it REBOL or my machine?):

The Ctrl + i combination returns the "tab" key code ( #"^-" ) :

So the new version (http://alain.goye.free.fr/rebol/NoteReb.r) still uses
the same keys but it's easy to change.
New features: resize, search, import/export from/to TreePad ( thanks
Aleksander ! ) ...and new bugs.

Alain.
>
> Very Nice! Only problem I see is that it uses some keys that
> are not available in other platforms or keyboards; ie. insert.
> Maybe a different key combination will be more portable.
>
> Cheers, Jaime
>
> -- The best way to predict the future is to invent it -- Alan Kay
>
> On May 4, 2004, at 3:59 AM, Alain Goyé wrote:
>
> >
> > Thank you!
> >
> > Actually there are still bugs, and I am working to improve it.
> >
> > Alain.
> >
> >>
> >> very neat !
> >>
> >> -MAx
> >> ---
> >> "You can either be part of the problem or part of the solution, but
> >> in the
> > end, being part of the problem is much more fun."
> >>
> >>
> >>> -Original Message-
> >>> From: Alain Goyé [mailto:[EMAIL PROTECTED]
> >>> Sent: Monday, May 03, 2004 4:27 PM
> >>> To: [EMAIL PROTECTED]
> >>> Subject: [REBOL] demo of a tree interface
> >>>
> >>>
> >>> Hi all,
> >>>
> >>> I made this little demo of a tree interface similar to
> >>> TreePad (TM) - in case it interests someone:
> >>> http://alain.goye.free.fr/rebol/NoteReb.r
> >>>
> >>> Please send me any comments you may have.
> >>>
> >>> Alain G.
> >>>
> >>> --
> >>> To unsubscribe from this list, just send an email to
> >>> [EMAIL PROTECTED] with unsubscribe as the subject.
> >>>
> >>>
> >>
> >> --
> >> To unsubscribe from this list, just send an email to
> >> [EMAIL PROTECTED] with unsubscribe as the subject.
> >>
> >>
> >
> > --
> > To unsubscribe from this list, just send an email to
> > [EMAIL PROTECTED] with unsubscribe as the subject.
> >
>
>
> --
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
>
>

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: AW: frustrating pairs...

2004-05-08 Thread Alain Goyé

Thank you Maxim, Carl and Christian for all your answers.

You're right Carl that pairs are better seen as numbers.
And they are still are convenient even though they don't have all other
types' features.

I appreciate Christian's code with its nice use of reverse and select (d:
select [x y x] :d).

Regards,

Alain.
>
> Dear Alain,
>
> > either d = 'x [bx/pane/offset/x: - tmp * sf/data ] [ ; how to improve
that
> ?
> > bx/pane/offset/y: - tmp * sf/data ]
>
> The function MIX-PAIRS as defined below takes two PAIR!s and a word of
value
> X or Y. Depending on the latter MIX-PAIRS returns a new PAIR! which is
> composed by A's axis as supplied in the 'D argument and B's opposite axis.
> This lets you 'simulate' touching only one axis easily.
>
> Sounds very confusing, I know, but look at the following code snippet, you
> will get the idea:
>
> ; cut'n'paste -- (beware of
> line-breaks) -
> REBOL []
> mix-pairs: func [a [pair!] b [pair!] 'd [word!] /local way] [
>   (a * way: pick [1x0 0x1] :d = 'x) + (b * reverse way)
> ]
> scroll: func [bx sf 'd] [
>   bx/pane/offset: mix-pairs bx/size - bx/pane/size * sf/data
bx/pane/offset
> :d
>
>
;^^^
>   ;--  bx/pane/offset is modified only for the direction supplied in :d
>   ;by setting the opposite axis back to the value before the
> modification
>   ;
>   show bx
> ]
> d: 'x
> view layout [
>   across bx: box 200x100 white with [
> pane: make-face/spec 'box [size: 40x40 color: red]
>   ]
>   sf: slider 20x100 [scroll bx sf :d] return
>   tg: btn "toggle" [d: select [x y x] :d
> sf/data: bx/pane/offset/:d / (bx/size/:d - bx/pane/size/:d)
> show [tg sf]
> ] ]
> ; cut'n'paste -- (beware of
> line-breaks) -
>
> regards,
>
> Christian
>
>
>
> --
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
>
>
>

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: ANN: IP-info plugin version

2004-05-07 Thread Alain Goyé

Whaooo.

Alain.

- Original Message - 
From: "rebOldes" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 07, 2004 6:39 PM
Subject: [REBOL] ANN: IP-info plugin version


> 
> Hello rebol-list,
> 
>   IP-info version 0.0.2 is now available
>   http://oldes.multimedia.cz/rss/builds/ipinfo/
> 
> -- 
> Best regards,
>  rebOldes -[ http://oldes.multimedia.cz/ ]
> 
> -- 
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
> 
> 

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] frustrating pairs...

2004-05-07 Thread Alain Goyé
; pairs are not numbers, not series, not objects... too bad !
; If we set:

toto: 5x5

; all this (and more...) is wrong!:

set toto/x 3; toto/x is not a word
set 'toto/x 3   ; 'toto/x is not a word
in toto 'x; toto is not an object
change toto 3; toto is not a series...

; So what ? 
; Well, I am frustrated while trying to touch only x or y of a pair in a function. 
This makes no problem:

zero-pair: func ['arg] [set arg 0x0]
zero-pair toto
toto; OK

; But now if I want a function to set the pair's x value to 0, all this is wrong again:

zero-x: func [arg] [arg/x: 0]; argument goes by reference
zero-x: func ['arg] [arg/x: 0]; Cannot use path on word! value
zero-x: func ['arg] [set arg/x 0]; toto/x is not a word
; etc.

; Of course this for example works:

zero-x: func ['arg] [
p: get arg
set arg as-pair 0 p/y
] 

; or in that special case:

zero-x: func ['arg] [set arg 0x1 * get arg]

; Is there a simpler way ?

; And what if I would like to pass an argument to specify whether to affect x or y in 
the function ?
; this is short nice:

test-print: func [p [pair!] 'd [word!]] [print p/:d]
test-print toto x

; but this isn't that an ugly "usine à gaz" ("gas factory" in French) ? :

test-change: func [
'arg [word!]"the pair to affect"
'd [word!]  "the direction to change: x or y"
val [integer!]  "the value to set"
] [
p: get arg
either d = 'x [
set arg as-pair val p/y
] [
set arg as-pair p/x val
]
]
test-change toto x 10

; ...while one would like so much just to write something like :

arg/:d: val; wrong of course...

; did I miss something please ?
; of course the above examples are useless, but here is the real one: 
; a function to scroll a box's pane using a horizontal OR vertical slider:

scroll: func [bx "box" sf "slider" 'd "direction: x or y" /local tmp][ 
if none? bx/pane [exit]
if 0 < tmp: bx/pane/size/:d - bx/size/:d [
either d = 'x [ bx/pane/offset/x: - tmp * sf/data ] [ ; how to improve that ?
  bx/pane/offset/y: - tmp * sf/data ]
show bx 
] 
]

; Alain.





-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: demo of a tree interface

2004-05-04 Thread Alain Goyé

Thank you!

Actually there are still bugs, and I am working to improve it.

Alain.

>
> very neat !
>
> -MAx
> ---
> "You can either be part of the problem or part of the solution, but in the
end, being part of the problem is much more fun."
>
>
> > -----Original Message-
> > From: Alain Goyé [mailto:[EMAIL PROTECTED]
> > Sent: Monday, May 03, 2004 4:27 PM
> > To: [EMAIL PROTECTED]
> > Subject: [REBOL] demo of a tree interface
> >
> >
> > Hi all,
> >
> > I made this little demo of a tree interface similar to
> > TreePad (TM) - in case it interests someone:
> > http://alain.goye.free.fr/rebol/NoteReb.r
> >
> > Please send me any comments you may have.
> >
> > Alain G.
> >
> > --
> > To unsubscribe from this list, just send an email to
> > [EMAIL PROTECTED] with unsubscribe as the subject.
> >
> >
>
> --
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
>
>

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] demo of a tree interface

2004-05-03 Thread Alain Goyé
Hi all,

I made this little demo of a tree interface similar to TreePad (TM) - in case it 
interests someone: 
http://alain.goye.free.fr/rebol/NoteReb.r

Please send me any comments you may have.

Alain G.

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: Interlacing blocks

2004-01-07 Thread Alain Goyé

Thank you Gregg,

this is my answer !

Alain.

> 
> Hi Alain,
> 
> AG> I needed something to evaluate a function on ALL elements of a
> AG> block, and keep ALL the results (in  a block), so I did these.
> AG> Can this be useful, or is there a better way ? And also better
> AG> names ?
> 
> Looks kind of like MAP to me.
> 
> map: func [fn blk args /local result][
> result: copy []
> repeat el blk [append/only result fn :el args]
> result
> ]
> 
> >> map :odd? [1 3 5 7 9 12] none
> == [true true true true true false]
> 
> You might also look for old discussions here on the COLLECT functions
> some people have done.
> 
> -- Gregg 
> 
> -- 
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
> 
> 

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: Interlacing blocks

2004-01-06 Thread Alain Goyé

Hi all,

after NFOREACH, this will look very simplistic, but I needed something to
evaluate a function on ALL elements of a block, and keep ALL the results (in
a block), so I did these.
Can this be useful, or is there a better way ? And also better names ?
These functions are almost 1-liners. There are 4 variants; example of use
are given below:

toall: func [
blk [block!]
fun [function! native!]
/local res
] [
foreach args blk [append [] either attempt repend copy [res: fun] args [res]
[none]]
]

allarg: func [
blk [block!]
body [block!]
/local fun res
] [
fun: make function! [arg] body
foreach args blk [append [] either attempt [res: fun args] [res] [none]]
]

toany: func [
blk [block!]
fun [function! native!]
/local res
] [
foreach args blk [if attempt repend copy [res: fun] args [return res]] none
]

anyarg: func [
blk [block!]
body [block!]
/local fun res
] [
fun: make function! [arg] body
foreach args blk [if attempt [res: fun args] [return res]] none
]

all toall [1 3 5 7 9 12] func [arg] [odd? arg]; is the same as:
all allarg [1 3 5 7 9 12] [odd? arg]

anyarg [1 3 5 7 9 12] [even? arg]

toall [[2 2][2 3][3 2]] func [arg1 arg2] [arg1 ** arg2]; is the same as:
allarg [[2 2][2 3][3 2]] [arg/1 ** arg/2]


Alain Goyé.

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: a new switch-like flow-control function

2003-12-23 Thread Alain Goyé

Hello all from a newcomer to this list,

Here is a function for only 1 condition but 3 cases : if it can be
useful to anyone

trif: func [
condition
iftrue [block!]
iffalse [block!]
ifnone [block!]
] [
do either condition [
iftrue
] [
either none? condition [
ifnone
] [
iffalse
]
]
]

; example:
print trif request "give an answer" ["yes"]["no"]["cancel"]

by the way,
is it good that "not none" equals "true" ?

Alain Goyé.

>
> Oops, should be > 3 cases.
>
> Anton.
>
> > do select reduce [...] is only better in code-size
> > for > ~8 cases.
>
> --
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
>
>


-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.