Catching layout face events
[1/7] from: greggirwin:mindspring at: 21-Jan-2002 14:13
Hi All,
Is there any way, aside from using insert-event-func, to catch events for a
main layout face (i.e. window events like 'resize and 'close)?
Yes, I *can* use insert-event-func, but if there's a better way, I'd love to
know about it. :)
Thanks!
--Gregg
[2/7] from: brett:codeconscious at: 22-Jan-2002 10:28
Hi Gregg,
> Is there any way, aside from using insert-event-func, to catch events for
a
> main layout face (i.e. window events like 'resize and 'close)?
Have a look at section 6 of http://www.rebol.com/how-to/feel.html
particularly subsection 6.2.
The detect function as it stands handles the shortcut key functionality (who
knows what in the the future). Maybe this is why the documentation suggests
using insert-event-func.
> Yes, I *can* use insert-event-func, but if there's a better way, I'd love
to
> know about it. :)
Well, the doco suggests using insert-event-func - so I guess the method
above is not a better way. :)
I'm curious, do you have any problems / preferences against
insert-event-func - or just looking at alternatives?
Brett.
[3/7] from: greggirwin:mindspring at: 21-Jan-2002 22:24
Thanks Brett,
<< I'm curious, do you have any problems / preferences against
insert-event-func - or just looking at alternatives? >>
Just looking for alternatives really, and thinking about how best to set
things up in cases where you have multiple layouts to deal with. I.e. do you
handle these things locally, in each layout, do you have a general function
you use with insert-event-func and check the face, or do you set up unique
functions for each layout and insert them all with insert-event-func? That
kind of stuff.
--Gregg
[4/7] from: brett:codeconscious at: 22-Jan-2002 21:17
> Just looking for alternatives really, and thinking about how best to set
> things up in cases where you have multiple layouts to deal with. I.e. do
you
> handle these things locally, in each layout, do you have a general
function
> you use with insert-event-func and check the face, or do you set up unique
> functions for each layout and insert them all with insert-event-func? That
> kind of stuff.
I see what you mean. I'm guessing that, with your reference to resize, that
the
things you refer to are things you want to do over and over again. Similar
thoughts occurred to me when I was thinking about what a View gui
development framework could look like.
I like the concept of "delegation". It is where the thing that needs some
functionality delegates the workload to another. Pretty obvious eh?
Anyways...
Feel objects demonstrate an elegant way to reuse behaviour through
delegation. For example FIELD and TEXT both use the same feel (that living
in ctx-text/swipe). [You can see the feel identified (where it lives) and
the code that defines it for each style if you right click on the style in
my vid-ancestry program (rebsite: Code C. / Docs / VIDAncestry).]
I've worked with Powerbuilder's PFC framework. It uses a service based
architecture. Reusable behaviour is put into a delegation class (object) or
service class. It works really well. PFC has a "Resize" service too. Now
Rebol is not constrained by brittle old compiled classes, but I think the
service based architecture idea is powerful.
Sounds pretty good to me. All that's left is to work out how a service based
architecture can work on top of View. Might go and have a play now :)
Brett.
[5/7] from: nitsch-lists:netcologne at: 22-Jan-2002 22:00
RE: [REBOL] Re: Catching layout face events
[greggirwin--mindspring--com] wrote:
> Thanks Brett,
> << I'm curious, do you have any problems / preferences against
<<quoted lines omitted: 5>>
> functions for each layout and insert them all with insert-event-func? That
> kind of stuff.
I stay with 'insert-event-func and 'flag-face now.
the problem with a window-feel is, 'view replaces it.
you can work around this by using
;method from ctx-edit
view/new lay ;sets standard feel..
lay/feel: my-feel
if 1 = length? system/view/screen-face/pane [do-events]
but thats not exactly like view does
(replacing main window when only one, and returning, hotkeys..).
i remove func before inserting.
with a customized -event-func (comparing with mold or some marker in body)
if i need to have scripts redoable.
[6/7] from: bkalef::sympatico::ca at: 23-Jan-2002 10:46
Brett,
You said, " Well, the doco suggests using insert-event-func - so I guess the method above
is not a better way. :)"
I was wondering what documentation you were refering to as I have yet to find an explanation
of insert-event-func and would love to find more on event handling.
Brock
[7/7] from: brett:codeconscious at: 24-Jan-2002 3:07
Hi Brock,
insert-event-func is mentioned in these two official documents:
http://www.rebol.com/docs/view-guide.html
http://www.rebol.com/how-to/feel.html
Thats probably quite a bit already.
There is a promis in one of them that insert-event-func "will be discussed
separately". Unfortunately
it hasn't been so far (as far as I know). So I tried to figure it out
myself. If you're game there is my unofficial notes on view and vid (which
is eclectic and not guaranteed to be correct).
See it using Rebol/View under:
Sites / Code. C / Docs / Vid-notes
Section "Global Level Event Handlers"
Cheers,
Brett.
----- Original Message -----
From: <[bkalef--sympatico--ca]>
To: <[rebol-list--rebol--com]>
Sent: Thursday, January 24, 2002 2:46 AM
Subject: [REBOL] Re: Catching layout face events
> Brett,
> You said, " Well, the doco suggests using insert-event-func - so I guess
the method above is not a better way. :)"
> I was wondering what documentation you were refering to as I have yet to
find an explanation of insert-event-func and would love to find more on
event handling.
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted