• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp158
r3wp1415
total:1573

results window for this page: [start: 1101 end: 1200]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
sqlab:
2-Jul-2009
DideC.
even this does not really use markup, it works at least
ctx: context [
	markup: ["my script with" val1 "and" val2]
	val1: "Hello"
	val2: "Bye"
	build: does [build-markup form reduce markup]
]
Ashley:
20-Jul-2009
Here's the finished code (which obtains REBOL compatable font names 
under Mac):

	fonts: copy []
	caps: make bitset! [#"A" - #"Z"]

 foreach file compose [(read %/System/Library/Fonts/) (read %/Library/Fonts/)] 
 [
		if %.dfont = suffix? file [
			s: form first parse file "."

   parse next s [any [mark: caps (insert mark #" ") 2 skip | skip] end]
			insert tail fonts s
		]
	]
	remove-each font-name fonts: sort unique fonts [

  (size-text make face [text: "A" font: make face/font [name: font-name 
  size: 10]]) =

  size-text make face [text: "A" font: make face/font [name: font-name 
  size: 12]]
	]


(the windows func to do this is http://www.reboltech.com/library/scripts/get-fonts-windows.r
)
Steeve:
8-Sep-2009
I think it's doing the same...

parse-out-date: func [
	trial [string!] /local day
][
	trial: parse trial "-,/"	

 if all [negative? now/zone day: take next trial][insert trial day]
	try [to-date form trial]
]
Steeve:
8-Sep-2009
more clean...

parse-out-date: func [
	trial [string!] /local day
][
	trial: parse trial "-,/"	
	all [
		negative? now/zone 
		integer? attempt [first to block! trial/2]
		;** swap day/month
		insert trial take next trial
	]
	attempt [to-date form trial]
]
Gabriele:
19-Sep-2009
max, it always scares me when people think that obscurity is a form 
of security...
Gabriele:
2-Nov-2009
maybe something like:

magic-function: func [num [number!] /local result] [
    result: form num
    if #"0" = first result [remove result]
    result
]
james_nak:
18-Nov-2009
Anyone know a simple way to transform a block of sub-blocks into 
a single block while retaining the original type? I have [ [1] [2] 
[3]] and I'd like [ 1 2 3]. I can do with with form and parse but 
it  then I get ["1" "2" "3"].
Graham:
18-Nov-2009
>> to-block form [ [ 1 [ 2] 3 ] [ 4] ]
== [1 2 3 4]
Graham:
4-Dec-2009
>> to-decimal "0 "
** Script Error: Invalid argument: 0
** Where: to-decimal
** Near: to decimal! :value


now it seems to me that if you're going to allow string input to 
'to-decimal then the most likely instances of this type of data is 
where it has been parsed in or comes in via a form and so it should 
by default handle whitespaces
Maxim:
7-Dec-2009
that is a cool server form factor  :-)
Von:
12-Dec-2009
Hello! I'm receiving the following error when processing a cgi form 
to send an e-mail of the response.  I correctly can send from my 
laptop, Rebol/Core -- command line, with my set-net settings in user.r 
but when I do the same thing on my hosting account I get the following 
error:
Von:
12-Dec-2009
Hello!  I'm having trouble with my hosting account to send via e-mail 
a cgi form response.  I can get rebol to post the data to the page, 
I just can't get it to send the data to me via e-mail.   I'm able 
to send e-mails from my laptop but when I use the same set-net settings 
on my host account I get the following error: ** User Error: Server 
error: tcp connection failed
** Near: smtp-port: open [scheme: 'esmtp] 
either only
Von:
12-Dec-2009
Hello!  I'm having trouble with my hosting account to send via e-mail 
a cgi form response.  I can get rebol to post the data to the page, 
I just can't get it to send the data to me via e-mail.   I'm able 
to send e-mails from my laptop but when I use the same set-net settings 
on my host account I get the following error: ** User Error: Server 
error: tcp connection failed
** Near: smtp-port: open [scheme: 'esmtp] 
either only
Janko:
21-Jan-2010
yes, I know.. but those abilities only make it stronger not weaker 
at the end (it also has some form of sandboxing it seems):
http://lua-users.org/wiki/SandBoxes
Maxim:
24-Jan-2010
like I said it depends on the server but most servers expect a form-like 
post data.
Maxim:
24-Jan-2010
name is the argument name, like you would specify in a form.
Henrik:
24-Jan-2010
Cyphre made this new FORM-DECIMAL function. I've been allowed to 
share it, so it can be tested:

form-decimal: func [
	num cifre
	/local m n o p result
][
	p: ""
	result: either find num: form num #"e" [
		parse num [
			any [copy m to "." skip] copy n to "E" skip o: (
				all [
					not m
					m: n
					n: ""
				]
				if m/1 = #"-" [
					m: copy next m
					p: "-"
				]
				z: (length? m) + to-integer o
				result: to-string reduce either negative? z [
					["0." (head insert/dup copy "" "0" abs z) m n]
				][
					o: join m n
					["" o (head insert/dup copy "" "0" (z - length? o))]
				]
			)
		]
		result
	][
		num
	]
	result: parse result "."
	o: result/1
	o: skip tail result/1 -3
	while [not head? o][insert o #"." o: skip o -3]
	all [
		not result/2
		insert tail result ""
	]
	result/2: copy/part result/2 cifre
	insert/dup tail result/2 "0" cifre - length? result/2
	all [cifre > 0 insert next result ","]
	all [result/1/1 = #"0" p: ""]
	join p result
]
Henrik:
25-Jan-2010
seems there is a bug in it:

form-decimal -100 1
== "-.100,0"

Anyone with a fix?
Pekr:
25-Jan-2010
Some time ago, I did form-decimal function too. But I am really a 
coding lamer, so dunno, if it cover at least half the cases other 
versions do. Here it is:

form-decimal: func [num /local tmp main rest sign base][

     either found? find tmp: to-string num "E" [

              parse tmp [
                 [copy main to "." 
                  skip
                  copy rest to "E"
                  |
                  copy rest to "E"
                  (main: copy "")  
                  ]
             
                 skip
                 mark: (sign: copy/part mark 1)
                 skip
                 copy base to end
               ]


        either sign = "-" [

                tmp: copy "0."

                loop ((to-integer base) - 1) [insert tail tmp "0"]
                insert tail tmp rest
        ][
                tmp: copy ""

                insert tail tmp join main rest

                loop ((to-integer base) - (length? rest)) [insert tail tmp "0"]  
                    
                           
        ] 
     
      tmp                 

     ][num] 

]
Graham:
25-Jan-2010
form-decimal: func [   num     [number!]
        cifre   [integer!]

        /local sign str poscifre int frac pow
    ][   sign: either negative? num [#"-"] [""]
        str: make string! 16
        either zero? num
        [   insert str #"0"
            if cifre > 0
            [   insert/dup
                    insert
                        tail str
                        #","
                    #"0"
                    cifre
        ]   ]
        [   num: abs num
            num: form
                add
                    multiply
                        power 10 cifre
                        to-decimal num
                    0,5

                        ; mainly WINE bug workaround - might also work for larger numbers 
                        on Windows
                        if find num "E"

                        [       parse num [copy int to "." skip copy frac 15 to "E" skip 
                        copy pow to end]
                                pow: to integer! pow
                                either pow >= 0
                                [       insert/dup
                                                insert/part

                                                        insert clear num int
                                                        frac

                                                        skip frac pow
                                                #"0"

                                                pow - length? frac
                                ]
                                [       num: "0"]
                        ]
            clear any [find num "." ""]
            poscifre: skip  tail num  negate cifre
            insert/part insert str sign num
                num: skip num
                    1 + remainder
                        subtract
                            index? poscifre
                            2
                        3
            while [(index? poscifre) > (index? num)]
            [   insert/part
                    insert
                        tail str
                        #"'"
                    num
                    num: skip num 3
            ]
            if empty? str [insert str #"0"]
            if not tail? poscifre
            [   insert
                    insert/dup
                        insert
                            tail str
                            #","
                        #"0"
                        cifre - length? poscifre
                    poscifre
            ]
        ]
        str
    ]
Janko:
25-Jan-2010
is form-decimal for scientific format for really large/small numbers 
like 1.25e+100 ? or is it for stuff like money 12.300,00 ? I have 
a function for the money :) (formating) , it's quite short if I remember 
correct.
Graham:
25-Jan-2010
That's a good point, if you only need a couple of decimal places, 
the form decimal could be much shorter
amacleod:
25-Jan-2010
form-decimal 4.17E-3
== "0.0017"
form-decimal 4.17E+3
== 4170.0

positive version seems to work.
Pekr:
26-Jan-2010
negative version is correct too, no? Mine form-decimal returns the 
same ...
Henrik:
31-Jan-2010
amacleod, we've been discussing FORM-DECIMAL for a while in this 
very group. Scroll up to see.
ChristianE:
23-Mar-2010
>> test: func [/local self] [self: get in disarm self: try [1 / 0] 
'where print ["My name is" uppercase form self]]
>> test
My name is TEST
ChristianE:
23-Mar-2010
>> test: func [/local self] [self: get in disarm try [1 / 0] 'where 
print ["My name is" uppercase form self]]
>> test
My name is TEST
ChristianE:
23-Mar-2010
>> test: function [] [self] [self: get in disarm try [1 / 0] 'where 
print ["My name is" uppercase form self]]
>> test
My name is TEST
ChristianE:
23-Mar-2010
>> test: does [print ["My name is" uppercase form get in disarm try 
[1 / 0] 'where]]
>> test
My name is TEST
ChristianE:
23-Mar-2010
>> test: function [] [error me] [error: disarm try [1 / 0] probe 
error me: error/where print ["My name is" uppercase form me]]
>> test
make object! [
    code: 400
    type: 'math
    id: 'zero-divide
    arg1: none
    arg2: none
    arg3: none
    near: [1 / 0]
    where: 'test
]
My name is TEST
Oldes:
13-Apr-2010
Maybe what you want is:
>> form s
== {"
}
>> length? form s
== 3
Oldes:
13-Apr-2010
FORM - Converts a value to a string.
MOLD - Converts a value to a REBOL-readable string.
Ladislav:
13-Apr-2010
Certainly, that is another possibility, and if you state it that 
way, then, of course, there is a possibility to use that form, it 
is just not the one chosen in the MOLD implementation in this case.
Pekr:
17-Apr-2010
wow, what a bunch of reactions :-) BrianH - I used strings, because 
of original Mikrotik format. They use 10.10.10.10/24 format for IP, 
so it was easier for me to carry around in a string form, then parse 
it later when needed ....


IP arithmetics, and ranges would be 2 nice new datatypes for REBOL 
imo :-)
BrianH:
19-Apr-2010
These make sense in C or Python syntax, or other languages where 
assignment is a syntax thing, but I'm not sure that it works that 
well with a language with word values, and assignment that doesn't 
use =. I don't see how they'd fit in REBOL syntax. That is not to 
say that the functions that these operators represent wouldn't be 
useful to have - just that they would fit in better in prefix form. 
Just an opinion though.
Gregg:
17-May-2010
I've never tried, but I imagine you would have to form them for /any 
to work.
Sunanda:
17-May-2010
Or using strings:
     to-integer form first next find form dec "."
    == 6
Pekr:
17-May-2010
Is there any other way of how to put word in, instead of 1 1 value? 
Quote? Hmm, probably not ... I don't like the form ....
Pekr:
10-Jun-2010
Maybe Ladislav or someone else could took over the improved DLL interface 
in the form of extension? There's still 450 USD floating, and Max 
did not deliver yet :-) ... and although having dyncall would be 
nice, having simpler but improved DLL interface might be still helpful 
:-)
Maxim:
10-Jun-2010
the specific is that 

a: 'z      and     a: to-lit-word 'z

are not equal expressions.

so why should evaluating a also evaluate z in the second form.
Maxim:
10-Jun-2010
since it will in the first form.
Ladislav:
20-Jun-2010
just BTW, an expression like

    is-email-addr: get bind load "email?" bind? 'system

can be expressed using a shorter form

    is-email-addr: get bind load "email?" 'system
Gregg:
6-Jul-2010
REBOL []

do %../library-dialect/lib-dialect.r

make-routines [
    lib %kernel32.dll
    def-rtn-type long
    ; returns available drive flags as a bitset (in a long)
    get-logical-drives "GetLogicalDrives"
    get-logical-drive-strings "GetLogicalDriveStringsA" [
        buff-len [integer!]
        buffer   [string!]
    ]
    get-drive-type [drive [string!]] "GetDriveTypeA"
]


drive-types: [
    Unknown     ; 0 We don't know what kind of drive it is
    NoRootDir   ; 1 Probably not a valid drive if there's no
                ;   root directory
    Removable   ; 2 It's a removable drive
    Fixed       ; 3 It's a fixed disk
    Remote      ; 4 It's out there on the network somewhere
    CDROM       ; 5 It's a CD ROM drive
    RAMDisk     ; 6 It's not a real drive, but a RAM drive.
]

drive-type?: func [drive /word /local res] [
    res: get-drive-type join first trim/with form drive "/" ":"
    either word [pick drive-types add res 1] [res]
]

get-drive-strings: func [
    /trim "Return only the drive letters, no extra chars"
    /local len buff res
][

    ; Call it once, with 0, to find out how much space we need in our 
    buffer
    len: get-logical-drive-strings 0 "^@"
    ; Init our buffer to the required length
    buff: head insert/dup copy "" #"^@" len
    ; Make the call for real, to get the data
    len: get-logical-drive-strings length? buff buff
    res: parse/all copy/part buff len "^@"
    if trim [foreach item res [clear at item 2]]
    res
]

;print enbase/base to binary! get-logical-drives 2
foreach id [a b "C" 'c "D" d: %E %F %/F] [
    print [mold :id tab drive-type? :id tab drive-type?/word :id]
]
print mold get-drive-strings
print mold get-drive-strings/trim
print read %/
BrianH:
14-Jul-2010
Andreas, decimal is a special case in that the regular syntax which 
can specify every value representable in memory, also can specify 
values which aren't representable, which have to be approximated. 
And since those approximated values include much of what developers 
actually use, the aproximation is undone when the value is saved 
in the form which is supposed to result in ordinary source code.
BrianH:
14-Jul-2010
Ladislav, a clarification: The DED has a semantic model, but it doesn't 
exactly match the in-memory model. And there is currently no function 
that can generate a serialized form of the in-memory model, and no 
function that can recreate the in-memory model from a serialized 
form (in this case "serialized" being used in its accepted meaning 
rather than the REBOL "serialized syntax" term). MOLD and MOLD/all 
are just approximate, as is LOAD. DO is a bit more accurate, but 
there is no function that can generate DO code from *all* in-memory 
structures, just some of them; the rest currently have to be written 
manually. So what we need is a function that does a better job of 
serializing the in-memory data model, and probably a new syntax to 
represent it.
Maxim:
14-Jul-2010
I think we could just extend the serialized form to represent just 
about everything in-memory.
BrianH:
14-Jul-2010
Maxim, we can't extend the existing serialized form to represent 
everything in memory, because binding, cycles and DAGs aren't representable 
without some kind of reference index. So even rebin wouldn't do, 
we'd need something like RIF.
Andreas:
14-Jul-2010
As a matter of fact, LOAD and SAVE/all form a far better duality 
as far as REBOL source is concerned. So Ladislav and I argued that 
making /all the default for SAVE would be a sensible thing to do.
Andreas:
14-Jul-2010
What is FORM supposed to be then?
Henrik:
15-Sep-2010
ALTER is not really useful in its current form.
Group: !RebGUI ... A lightweight alternative to VID [web-public]
Graham:
20-Apr-2007
Something like:

set 'set-text make function! [
	"Set and show a widget's text attribute."
	face [object!] "Widget"
	text [any-type!] "Text"
	/caret {insert at cursor position}
	/no-show "Don't show"
	/focus
][
	unless string? face/text [exit]
	insert either all [ caret face/caret ][
			at face/text face/caret 
	][	
		either caret [ tail face/text ][	clear face/text ] 
	] form text
	all [
		face/para
		face/para/scroll: 0x0
		all [face/type = 'area face/pane/data: 0]
	]
	face/line-list: none
	unless no-show [either focus [set-focus face] [show face]]
]
Ashley:
21-Apr-2007
Update set-text with:

	unless string? face/text [exit]
	insert either caret [
		if all [
			none? face/caret
			face = view*/focal-face
			view*/caret
		] [face/caret: index? view*/caret]
		either face/caret [at face/text face/caret] [tail face/text]
	][
		clear face/text
	] form text
Ashley:
21-Apr-2007
OK, Mk III

	unless string? face/text [exit]
	either caret [
		if all [
			face = view*/focal-face
			view*/caret
		] [face/caret: index? view*/caret]
		either face/caret [
			insert at face/text face/caret form text
			view*/caret: at face/text face/caret + length? form text
			face/caret: index? view*/caret
		] [insert tail face/text form text]
	] [insert clear face/text form text]
Graham:
22-Apr-2007
so, this way I guess I'll have to add to the user's form the do block
Anton:
11-May-2007
You want to be able to connect the widget to your original data, 
without expecting it in any format, but also provide the widget with 
a function which maps the desired cells from each row into the form 
the widget likes (for its "view" of the data).
Ashley:
21-May-2007
re: area scrolling. Try the following:

	display "" [
		a: area (form system/locale/colors)
		button [insert tail a/text join newline now show a]
		button [a/pane/1/data: 1.0 show a]
	]
Graham:
10-Jun-2007
New error for me ..


An error has occurred.  If this occurred with an upgrade, please 
revert to the older version for the meantime, and report the error 
message as documented below.

make object! [
    code: 501
    type: 'access
    id: 'not-open
    arg1: "Port"
    arg2: none
    arg3: none
    near: [repeat i p/cols [
            line/pane/:i/offset/x: col-offset 
            line/pane/:i/size/x: p/widths/:i - sizes/cell 
            all [
                p/pane/2/show? 
                i = p/cols 

                line/pane/:i/size/x: line/pane/:i/size/x + (p/size/x - p/pane/2/size/x 
                - (line/pane/:i/offset/x + line/pane/:i/size/x))
            ] 

            line/pane/:i/text: replace/all form pick p/data index - 1 * cols 
            + i "^/" "¶" 

            line/pane/:i/font/color: either find p/options 'no-action [
                black
            ] [
                either find picked index [white] [black]
            ] 
            col-offset: col-offset + pick widths i
        ]]
    where: 'confirm
]
Louis:
22-Oct-2007
In the following script I would like to be able to click on a row 
of the table to populate the data entry fields, so that I can edit 
the data for the record displayed in that row. How do I do that? 
 

rebol []
do %sqlite.r
do %rebgui.r
unless value? 'ctx-rebgui [

    either exists? %rebgui-ctx.r [do %rebgui-ctx.r] [do %rebgui.r]
]
set-colors
tab-size: 120x55

fonts: reduce [font-sans-serif font-fixed font-serif "Courier New"]
if not exists? %id.txt [write %id.txt 1]
either not exists? %indodex.db [
    CONNECT/create %indodex.db

    SQL "create table base (ID, Title, Nama, Alamat, Kota, Propinsi, 
    Telefon, Handfon, Fax, Email, URL, Tgl_Nikah, Nota)"

    SQL "create table birthdays (ID, Nama, Jenis, Hubungan, Tgl_Lahir, 
    Agama, Nota)"
][
    CONNECT/flat %indodex.db
]

do show-cc: make function! [] [
set-colors
(i: to-integer read %id.txt)
label-width: 19
f-width: 59
display "IndoDex Ver. 1.0.1" compose/only [
            button-size 16x8
            margin 1x1
            space 1x1
            ;image %roladex.jpg 
            ;return
            label 7 "ID:" id: text (to-string i) 7
            pad 17
            ;label 13 "Nama:" 

            title: drop-list 30 #W "Pak" data ["Pak" "Ibu" "Sdr." "Sdri." "Drs." 
            "Dr." "Tuan" "Nyonya" "Nona" "Pdt."] 17x5
            nama: field f-width
            label label-width "Telefon:" 
            telefon: field f-width
            label label-width "Handfon:" 
            handfon: field f-width
            return
            pad 31
            label label-width "Fax:" 
            fax: fax: field f-width
            label label-width "E-Mail:" 
            email: field f-width
            label label-width "URL:" 
            url: field f-width
            return
            pad 31
            label label-width "Alamat:" 
            alamat: field f-width
            label label-width "Kota:"
            kota: field f-width
            label label-width "Propinsi:"
            propinsi: field f-width
            return
            pad 31
            label label-width "TglNikah:" 
            tgl_nikah: field f-width
            label label-width "Nota:" 
            nota: field 139
            return
            return

            t: table options ["ID" left .03 "Title" left .04 "Nama" left .2 "Telefon" 
            left .16 "Handfon" left .14 "Fax" left .14 "E-mail" left .15 "URL" 
            left .15] data (sql "select id, title, nama, telefon, handfon, fax, 
            email, url from base") 270x150 
            return
            button "Add" [
                either all [nama/text <> "" nama/text <> none][

                    SQL reduce ["insert into base values (?, ?, ?, ?, ?, ?, ?, ?, ?, 
                    ?, ?, ?, ?)" id/text title/text nama/text alamat/text kota/text propinsi/text 
                    telefon/text handfon/text fax/text email/text URL/text tgl_nikah/text 
                    nota/text]

                    insert t/data SQL "select id title nama alamat kota propinsi telefon 
                    handfon fax email URL tgl_nikah nota from base"

                    ;a: sql/flat "select id/text title/text nama/text alamat/text kota/text 
                    propinsi/text telefon/text handfon/text fax/text email/text URL/text 
                    tgl_nikah/text nota/text from base"
                    ;sql reduce [insert table/data a]
                    id/text: form i: i + 1
                    save %id.txt i
                    clear-text nama
                    clear-text alamat
                    clear-text kota
                    clear-text propinsi
                    clear-text telefon
                    clear-text handfon
                    clear-text fax
                    clear-text email
                    clear-text url
                    clear-text tgl_nikah
                    clear-text nota
                    ;show id
                    t/redraw
                    return
                ][
                    alert {Cannot save if "Nama" field is empty.}
                ]
            ]
            button "Update" []
            button "GUI Info" [

                print [id/text " " title/text " " nama/text " " alamat/text newline]
            ]
            button "DB Info" [
                print [TABLES newline]
                SQLite/col-info?: true
                newline
                print [SQL "select * from base" newline]
                print [SQLite/columns newline]
                print [ROWS "base" newline]
            ]
            button "Halt" [
                halt
            ]
            button "Quit" [
                quit
            ]
]
]
do-events
Ashley:
5-Dec-2007
Also, replace:

	info-area/text: rejoin make block! head info-area-list

with:

	info-area/text: form rejoin make block! head info-area-list
Robert:
11-Dec-2007
Ashley, what's this free-form BUTTON keyword inside a display block? 
Never saw this.
Ashley:
24-Dec-2007
I've had to do something similar and you really need pixel-level 
precision with a domain specific app (or widget). Isn't that hard 
as the number of form elements is limited. The version I was doing 
was trying to automatically place and size fields after filtering 
the form to create a B&W image (for element placement purposes). 
Another approach might be to create a widget that lets you easily 
move and size boxes, then save the face offsets and sizes and apply 
them to a RebGUI display that has the same number of widgets in the 
same order.


I'll take a look at check, led and radio-group sizing later this 
week. All these widgets *should* be able to scale without a problem 
(much like symbol does). In fact I was contemplating using webding 
symbols (for the tick and cross) in lieu of draw.
Graham:
18-Feb-2008
I've got a value of .004 that is being displayed in scientific notation, 
and so I want to use Gabriele's form-decimal on it at display time.
Ashley:
19-Feb-2008
I've got a value of .004 ...

 ... best way is to pre-format the data by poking the string form 
 you wish to present it in.
Ashley:
20-Feb-2008
The problem's a bit more general than table data then ... what happens 
when this decimal value appears in other widgets (e.g. text, field, 
drop-list, etc) ... fix needs to be at the native level ... perhaps 
we need to patch 'form as an interim measure? Is this a windows only 
issue?
Graham:
20-Feb-2008
Actually it's a wine issue.  I store the data in the table/data so 
am reluctant to form it there as I use the data for various calculations. 
 Oh well, I have now formed it into text.
Robert:
16-Mar-2008
Idea: I'm not a big fan of menus, tabs etc. to switch through an 
application. Looking at all these new GUIs from Apple styles (when 
viewing photos where it's like a fan and the middle photo zoomed) 
or the piclens stuff I had the idea how to use this for an app.


How about having a way where I can see a miniatur screen of every 
data-form in a 2D grid moving in 3D space, where I can scroll left 
/ right to the right picture, click it and get the data-form?
BrettH:
18-Jul-2008
I'm trying to do some 'field navigation' within a rebgui form and 
cannot figure out how to get teh filed cursor to 'goto field'
BrettH:
20-Jul-2008
While tab ordering is a useful feature, in this case I'm trying to 
tab order by testing field content, I'm surprised that its considered 
a bit unusual :-)  In my data entry program I want the user to be 
able to set the work flow somewhat. , ie: on mass data entry they 
should not have to tab over the row of function buttons I have arranged 
along the bottom of the form, but when they tab 'out' of the last 
data entry field, the program saves the data, clears the form, replaces 
some common data and then return to the first entry field -- all 
without using the mouse. Not true key board navigation but very pleasent 
for the user. The user uses teh mouse to get to the buttons. This 
I am currently doing using VID.  Graham's usage is a very typical 
form interaction senario, one I was soon to try !
Graham:
15-Aug-2008
Because you can't tab to a table, a table blocks the tab sequence 
across a form.
Graham:
6-Oct-2008
that looks wrong
set-text m_joueur_age (now/year - date_naissance/year)
perhaps
set-text m_joueur_age (form now/year - date_naissance/year)
Graham:
7-Oct-2008
As I mentioned above, set-text only takes a string .. so you need 
to form dates, and numbers before using it.
Claude:
7-Oct-2008
hi, i retry to modifiy all my set-text by  set-text face form data 
but i have again the same probleme   if you want to try go to http://users.skynet.be/fc078613/carte.rip
Claude:
9-Oct-2008
but i would like to use it form a menu
Graham:
24-Apr-2009
Ashley, why is double click here producing two windows?

do %/c/rebgui9/rebgui/rebgui.r

nw: func [ ][

 view/new/offset layout compose [ label text (form now/precise) ] 
 to-pair reduce [ random 400 random 400 ]
]

display "Double Click Test" [
	table 40x40 options [ "Dbl Click me" left .9 ] data [ "one" ] 
	on-click [ nw ]
	on-dbl-click [ ]
]

do-events
Graham:
24-Apr-2009
this illustrates the problem.


do %/c/rebgui9/rebgui/rebgui.r
do http://www.fm.tul.cz/~ladislav/rebol/default.r
do http://www.fm.tul.cz/~ladislav/rebol/closure.r

nw: func [ /local lab ][
	view/new/offset layout compose [
		below 
		lab: text (form now/precise)
		button "show" [ probe lab/text ]  
	] to-pair reduce [ random 400 random 400 ]
]

nw2: closure [ /local lab ][
	view/new/offset layout compose [
		below 
		lab: text (form now/precise)
		button "show" [ probe lab/text ]  
	] to-pair reduce [ random 400 random 400 ]
] 

display "Double Click Test" [

 table 40x40 options [ "Func Dbl Click me" left .9 ] data [ "one" 
 ] 
	on-click [ nw ]
	on-dbl-click [ ]

 table 40x40 options [ "Closure Dbl Click me" left .9 ] data [ "two" 
 ] 
	on-click [ nw2 ]
	on-dbl-click [ ]
]

do-events
Pekr:
10-May-2009
OK, here we go:

- full keyboard navigation

- virtual-data-system - ability to hide/show columns, without the 
need to reorganise original data block (virtual columns)
- the same for rows
- programmable navigation (goto)
- buttons, checkboxes - simply layout elements in cells
- tri-state columns - sorted, unsorted, original

missing  (it was supposed to be done as an update):
- column resizing
- saving the configured state for particular form
Anton:
30-Jul-2009
The tree data could be in the form [ A [ B [p] B [q r] B [s t u] 
]

and so the user could differentiate between the different B's by 
examining their contents.
Pekr:
24-Aug-2009
RebDOC crashes even separately:


** Script Error: length? expected series argument of type: series 
port tuple bitset struct
** Where: layout
** Near: form length? functions
>>
Graham:
3-Jan-2010
I often have the need to set a date on a field ... and use a symbol 
to invoke the request-date .. .but this usually means I have to name 
the date field like this


datefld: field 25 symbol data 'look on-click [ use [d][ if d: request-date 
[ set-text datefld form d ]]]


To avoid naming the datefield, I have this function which returns 
the prior face


get-prior-widget: func [ f
    /local pane priorface
][
    pane: f/parent-face/pane
    priorface: pick pane -1 + index? find pane f
]

and here's a request date that uses it


request-date-priorface: func [ f /local d ]
[
    if d: request-date [
        set-text get-prior-widget f form d
    ]
]

so we can now do:


 field 25 symbol data 'look on-click [  request-date-priorface face 
 ]
Awi:
17-Feb-2011
I just want to share my modifications of the chat widget in b177, 
I needed a slimmer chat. It should also fix the resize issue:
REBOL []
slim-chat: make baseface [
	options: {
		USAGE:

   chat2 120 data ["Bob" blue "My comment." yello 14-Apr-2007/10:58]

		DESCRIPTION:
			Three column chat display as found in IM apps such as AltME.
			Messages are appended, with those exceeding 'limit not shown.

		OPTIONS:

   [limit n] where n specifies number of messages to show (default 100)
			[id n] where n specifies id column width (default 10)
			[user n] where n specifies user column width (default 15)
			[date n] where n specifies date column width (default 25)
	}
	size: 200x100
	pane: []
	data: []
	edge: default-edge
	action: make default-action [
		on-resize: make function! [face] [

   poke face/pane/2/para/tabs 2 face/pane/1/size/x - sizes/slider - 
   (sizes/cell * any [select face/options 'date 25])
			face/redraw/no-show
		]
	]


 height: 0 ; actual pixel height of all messages (-1 ensures first 
 message is offset to hide it's edge
	rows: 0 ; number of messages
	limit: none ; last n messages to display

	append-message: make function! [
		user [string!]
		user-color [tuple! word! none!]
		msg [string!]
		msg-color [tuple! word! none!]
		date [date!]
		/no-show row
		/local p y t1 t2 t3
	] [
		;	cache current tab stops
		p: self
		t1: pick pane/2/para/tabs 1

  t2: pane/1/size/x - sizes/slider - (sizes/cell * any [select p/options 
  'date 25])

		p: self
		;	get height of message
		y: max sizes/line 4 + second size-text make baseface [
			size: as-pair p/size/x - sizes/slider + 1 10000
			text: msg
			font: default-font
			para: para-wrap
		]

		

		insert tail pane/1/pane reduce [
			make baseface [
				offset: as-pair -1 height - 1
				size: as-pair t2 21
				span: all [p/span find p/span #W #W]
				text: user
				edge: make default-edge [size: 0x1]

    font: make font-top [color: either word? user-color [get user-color] 
    [user-color] style: 'bold]
				color: either word? msg-color [get msg-color] [msg-color]
			]
			make baseface [
				offset: as-pair -1 height - 1 + 20
				size: as-pair p/size/x - sizes/slider + 1 y
				text: form msg
				color: either word? msg-color [get msg-color] [msg-color]
				edge: make default-edge [size: 0x1]
				font: default-font
				para: para-wrap
			]
			make baseface [
				offset: as-pair t2 - 1 height - 1

    size: as-pair (sizes/cell * any [select p/options 'date 25]) + sizes/slider 
    + 1 21
				span: all [p/span find p/span #W #X]

    text: form either now/date = date/date [date/time] [date/date]
				edge: make default-edge [size: 0x1]
				font: make font-top [style: 'bold align: 'right]
				color: either word? msg-color [get msg-color] [msg-color]
			]
		]
		height: height + y - 1 + 20
		if ((length? pane/1/pane) / 3) > limit [
			y: pane/1/pane/2/size/y + pane/1/pane/1/size/y - 2
			remove/part pane/1/pane 3
			foreach [u m d] pane/1/pane [
				u/offset/y: u/offset/y - y
				m/offset/y: m/offset/y - y
				d/offset/y: d/offset/y - y
			]
			height: height - y
		]
		unless no-show [
			insert tail data reduce [user user-color msg msg-color date]
			pane/1/size/y: height
			pane/3/ratio: pane/3/size/y / height
			show p
		]

  show pane/1 ; !!! this cleans up artifacts but "eats" other widgets 
  redraw events !!!
	]


 set-user-color: make function! [id [integer!] color [tuple! word! 
 none!] /local idx] [
		if any [zero? id id > rows] [exit]
		poke data id * 5 - 3 color
		if limit > (rows - id) [

   idx: either rows > limit [(id + limit - rows) * 3 - 2] [id * 3 - 
   2]

   pane/1/pane/:idx/font/color: either word? color [get color] [color]
			show pane/1/pane/:idx
		]
	]


 set-message-text: make function! [id [integer!] string [string!] 
 /local idx] [
		if any [zero? id id > rows] [exit]
		poke data id * 5 - 2 string
		if limit > (rows - id) [

   idx: either rows > limit [(id + limit - rows) * 3 - 1] [id * 3 - 
   1]
			insert clear pane/1/pane/:idx/text string
			redraw
		]
	]


 set-message-color: make function! [id [integer!] color [tuple! word! 
 none!] /local idx] [
		if any [zero? id id > rows] [exit]
		poke data id * 5 - 1 color
		if limit > (rows - id) [

   idx: either rows > limit [(id + limit - rows) * 3 - 1] [id * 3 - 
   1]
			pane/1/pane/:idx/color: either word? color [get color] [color]
			show pane/1/pane/:idx
		]
	]

	redraw: make function! [/no-show /local row] [
		clear pane/1/pane
		height: 0
		rows: (length? data) / 5
		row: max 0 rows - limit: any [select options 'limit 100]

  foreach [user user-color msg msg-color date] skip data row * 5 [

   append-message/no-show user user-color msg msg-color date row: row 
   + 1
		]
		pane/1/size/y: height
		pane/3/ratio: either zero? height [1] [pane/3/size/y / height]
		unless no-show [show self]
	]

	init: make function! [/local p] [
		unless options [options: copy []]
		p: self
		limit: any [select options 'limit 100]
		; chat pane (1)
		insert pane make baseface [
			offset: as-pair 0 sizes/line
			size: p/size - as-pair sizes/slider sizes/line
			span: all [p/span find p/span #W #W]
			pane: []
		]
		;	heading (2)
		insert tail pane make gradface [
			offset: -1x-1
			size: as-pair p/size/x sizes/line
			text: "Chat"
			span: all [p/span find p/span #W #W]
			font: make font-button [align: 'left]
			para: make default-para [tabs: [0 0]]
		]
		;	set header tabs

  poke pane/2/para/tabs 1 sizes/cell * (any [select options 'user 15])

  poke pane/2/para/tabs 2 size/x - sizes/slider - (sizes/cell * any 
  [select options 'date 25])
		;	vertical scroller
		insert tail pane make slider [
			offset: as-pair p/size/x - sizes/slider sizes/line - 2
			size: as-pair sizes/slider p/size/y - sizes/line + 2
			span: case [
				none? p/span [none]
				all [find p/span #H find p/span #W] [#XH]
				find p/span #H [#H]
				find p/span #W [#X]
			]
			action: make default-action [
				on-click: make function! [face] [
					if height > face/size/y [

      face/parent-face/pane/1/offset/y: (height - face/size/y * negate 
      face/data) + sizes/line
						show face/parent-face
					]
				]
			]
		]
		pane/3/init
		action/on-resize self
	]
]
Group: !REBOL3-OLD1 ... [web-public]
sqlab:
2-Jun-2009
load form  [[1][2][3]]
== [1 2 3
]
Pekr:
3-Jun-2009
Henrik probably wanted to introduce new form to REBOL's parser: 100[m 
/s]
Pekr:
3-Jun-2009
Will something like that work with user types? Can I define its "lexical 
form" (?) so that REBOL parser would accept that?
BrianH:
3-Jun-2009
Ladislav, if you think that I am saying that the lexical form #[...] 
is a function call, you are wrong. I am saying that the processing 
of that lexical form is handled by an internal function call that 
constructs a value of a particular datatype. That is what I have 
always beenn saying.
BrianH:
3-Jun-2009
Well, the function "somewhere else" is all that I have been talking 
about, not the lexical form.
Janko:
3-Jun-2009
aha, yes that I agree fully .. that's why I was hoping the makers 
would think about some form of lighter runtime threads/processes 
whatever they are :)
Maxim:
3-Jun-2009
we are talking about representing the lexical form of unit-like values 
here steeve, not the custom datatypes.
Pekr:
10-Jun-2009
What I hated about R2 was EEE format usage, especially when you needed 
to mold/print into something user-friendly. If R3 has some form/format 
function, which will handle that, then I don't mind using IEEE notation 
in console. I am not able to answer 1) - would it make any possible 
harm to our code, its reflectivity or ability to save/load molded 
values and getting exactly the same results?
BrianH:
13-Jun-2009
Works for me: 

>> write %mod1.r to-binary "rebol [type: module] print 1" 
>> write %mod2.r to-binary "rebol [type: module] print 2" 

>> write %mod.r to-binary "rebol [needs: [%mod1.r]] import %mod2.r 
print 3" 
>> do %mod.r 
1 
Script: "Untitled" Version: none Date: none 
2 
3 


Note that if you specify your Needs in file form, system/options/module-paths 
won't be searched. Any relative filename will be resolved relative 
to the path of the importing script. Does this affect you?
Robert:
18-Jun-2009
Regarding MATH stuff.I alway need functions to convert from scientific 
to human readable form including thousand seperators, using "," instead 
of "." etc. How about adding this to the CORE? IMO a very high frequent 
function.
Henrik:
18-Jun-2009
Gabriele's FORM-DECIMAL function has always worked solidly for me. 
It could be considered as a mezz.
Henrik:
18-Jun-2009
as long as it's not too complex. form-decimal is a rather complex 
mezzanine.
Geomol:
6-Jul-2009
Ladislav, I've tested random some more. The equal sign, =, is used 
to test in the end of RANDOM, if the result should be changed to 
0.0. This will change more values, than if =? was used. I use =? 
in my test. My test goes like this:

REBOL [
	Title:		"Random distribution test"
	Author:		"John Niclasen"
]

random/seed now
dist: clear []	; distribution
tt62: to integer! 2 ** 62
a: tt62 - 1024
loops: 100000
loop loops [
	i: random 1024
	if i > 512 [i: i + a]	; test close to 0.0 and close to 1.0
	y: i - 1 / tt62 * 1.0
	if y =? 1.0 [y: 0.0]	; the result of random 1.0
	y: form y
	either find dist y [
		dist/:y: dist/:y + 1
	][
		repend dist [y 1]
	]
]
while [not tail? dist] [
	dist/1: load dist/1		; change strings back to decimals
	dist: skip dist 2
]
dist: head dist
sort/skip dist 2	; sorting distribution
print dist
mean: 0.0
foreach [value count] dist [
	mean: value * count + mean
]
mean: mean / loops	; calculating the mean value
print mean	; this should be 0.5


The test is testing values close to 0.0 and close to 1.0. Notice 
the high count of 0.0 result compared to other low values. Also notice, 
how the mean value is close to 0.25, where it should be 0.5. Try 
out-comment the change of y to 0.0. Then the result will be much 
better.
PatrickP61:
14-Jul-2009
Thanks Brian,  I had changed the APPEND2 to REPEND with the proper 
[ ] which seems to do the same thing as APPEND APPEND.
				repend blk ['label ajoin ["Field " n]]
				repend blk ['field form first+ fields]
				repend blk ['button "Change"]
Thanks!
Pekr:
16-Jul-2009
Because historically I am far from being alone, who finds current 
R2 working as being complete mess. How can anyone defend it? I can 
easily tell you, where it comes from. I am far from good at wrapping 
libraries, but I wrapped some functionality in the end. I can often 
see constants like:

0x0010

Which are for me equivalent to:

#0010  ; which I can get via to-hex or to-issue 16

#{0010} ; to-binary 16 = #{3136} .... and this is big WTF? Now at 
least R3 gets it correctly, although padded by full of zeros to form 
64  bit value


So, as you can see, my thought pattern came from not easy way of 
how to convert between integer and binary representation. I created 
my own crazy 2-binary function :-)


to-binary*: func [value [integer!]][load rejoin ["#{" to-string copy/part 
at to-hex value 7 2 "}"]]
BrianH:
22-Jul-2009
As for why it might be misguided, that is because the stated purpose 
of that request - recovering the module in serialized form - is definitely 
impossible, and would be a major security hole if it were possible 
(which is part of why it is not).
Reichart:
5-Aug-2009
http://tlt.its.psu.edu/suggestions/international/bylanguage/japanese.html


To elaborate on what Gabrielle said, in most languages, there is 
a large and small version of letters for use usually in sentence 
case, and also for abbreviations, etc.  Over time these began to 
be written differently, so the large and small actually look different.


But in Japanese, small letters have a completely separate meaning, 
sometimes used to elongate a sound, or form a subtle guttural stop.

Here is a sample, it is VERY subtle.


http://christopherfield.com/translation/images/hashiriame/story_a.gif


In this image look for all the symbols that look like a backwards 
letter "C" (or letter "U" that fell to the left).

Sentence 1 - 3rd from the right.
Sentence 6 - 3rd from the left.

Notice they are very subtle different sizes.

That is an example.

Bottom line, as stated, don't mess with caps with Japanese.

(it was hard to find a GOOD example of this in the same image).
Graham:
8-Aug-2009
Henrik, I had forgotten about to-itime, but it looks quite inefficient


>> t1: now/precise loop 10000 [ copy/part join next form 100:00 + 
t ":00" 8 ] difference now/precise t1
== 0:00:00.073

>> t1: now/precise loop 10000 [ to-itime t ] difference now/precise 
t1
== 0:00:00.32
Gabriele:
9-Aug-2009
Graham, you're actually asking for mold and form to always include 
seconds... which is something i think i agree with, though, it would 
be much better to finally have FORMAT for all these things.
Anton:
9-Aug-2009
I would suggest, for R3:

 foreach word words-of system/contexts/user [if "my-word" = form word 
 [break/return word]] ; <-- untested.
1101 / 157312345...1011[12] 13141516