[REBOL] Re: Question on text formatting
From: g:santilli:tiscalinet:it at: 30-Aug-2002 19:49
Hi Andy,
On Friday, August 30, 2002, 6:05:37 PM, you wrote:
AF> hate polling :-) ) Is there any way to set rebol up to trigger a call
AF> to a routine automatically if any characters are received at the port ?
You bet. :-)
port: open tcp://etc.
port/awake: func [port] [
; this is called each time you have new data in the port
; if you open the port as NO-WAIT now you can just get the
; data with COPY PORT
print copy port
; you should return TRUE or FALSE. returning TRUE makes
; REBOL exit from the wait function call, while with FALSE
; you keep waiting
]
; now you either use:
wait port
; and get your awake called when there's data, with WAIT
; returning only if your awake function returns TRUE,
; or you can:
insert tail system/ports/wait-list port
; and your port will be automatically "waited" every time
; you call WAIT, i.e. also when you show a window; this is
; probably what you are interested in.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r