arguments from/to request-font
[1/6] from: d4marcus:dtek:chalmers:se at: 21-Dec-2000 21:44
I have started writing a request-font function for View, which I think
would go nicely with the other request-* functions. But I'm not sure about
the input and output. Currently it takes no arguments, and returns a font
object, or None if canceled. This is probably not very useful in most
situations, so I'd like to hear some opinions on this.
Consider for example a text-editor (area) for which you'd like to change
the font. If there's no previous formatting, you wouldn't need to pass an
argument, so the current function (which btw remembers the current state)
would work. This hardly seems like a good example though.
Then there's the issue if it's good to return a font object. Perhaps it
would be better to return a block like [name: "times" style: none ... ].
Marcus
------------------------------------
If you find that life spits on you
calm down and pretend it's raining
[2/6] from: allenk:powerup:au at: 22-Dec-2000 7:50
Hi Marcus,
I think returning it as a font object is fine or you could look at returning
a block that
would be compatible with the set-font function.
Passing the existing face object to the function (could be as refinement),
so that the requestor can show existing settings and you can show changes to
the font object realtime in the face.
Cheers,
Allen K
[3/6] from: al:bri:xtra at: 22-Dec-2000 21:25
Marcus wrote:
> I have started writing a request-font function for View, which I think
would go nicely with the other request-* functions. But I'm not sure about
the input and output. Currently it takes no arguments, and returns a font
object, or None if canceled. This is probably not very useful in most
situations, so I'd like to hear some opinions on this.
That sounds good to me.
> Consider for example a text-editor (area) for which you'd like to change
the font. If there's no previous formatting, you wouldn't need to pass an
argument, so the current function (which btw remembers the current state)
would work. This hardly seems like a good example though.
> Then there's the issue if it's good to return a font object. Perhaps it
would be better to return a block like [name: "times" style: none ... ].
Why not a refinement to specify a existing style? Like:
request-font: func [/font font-object [object!]] [ ; etcetera.
Then in the function set up the display so that it matches passed in
font-object. If there's no changes, 'request-font returns 'none, if the user
changes, the new font-object is returned.
Just my opinion.
Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
[4/6] from: d4marcus:dtek:chalmers:se at: 27-Dec-2000 22:33
On Fri, 22 Dec 2000, Andrew Martin wrote:
> Why not a refinement to specify a existing style? Like:
> request-font: func [/font font-object [object!]] [ ; etcetera.
> Then in the function set up the display so that it matches passed in
> font-object. If there's no changes, 'request-font returns 'none, if the user
> changes, the new font-object is returned.
I've added this behaviour now. Unfortunately, it can only be called from
the console. If called from another face the face is closed, and the
request-font tries to return a value that isn't set yet. It's a little
hard to explain, so here's the code (the important parts):
req: func [
/font font-object [object!] "Existing font-object to modify"
...
view reqface
return result]
'reqface is the face where it all happens. 'result is set by functions
called by buttons in 'reqface, OK or None.
Why doesn't the 'req function wait until "view reqface" is finished? And
how do you call view so that an existing face isn't closed, without using
the 'new refinement (which would make it return immediately)?
Marcus
------------------------------------
If you find that life spits on you
calm down and pretend it's raining
[5/6] from: d4marcus:dtek:chalmers:se at: 2-Jan-2001 19:34
On Fri, 29 Dec 2000, Gabriele Santilli wrote:
> You should use INFORM instead of VIEW.
Yes it works, after a few other modifications (hide-popup instead of
unview/only reqface, and defining result outside reqface). Thanks.
Marcus
------------------------------------
If you find that life spits on you
calm down and pretend it's raining
[6/6] from: g:santilli:tiscalinet:it at: 29-Dec-2000 20:20
Hello Marcus!
On 27-Dic-00, you wrote:
MP> req: func [
MP> /font font-object [object!] "Existing font-object to
MP> modify" ...
MP> view reqface
MP> return result]
You should use INFORM instead of VIEW.
HTH,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/