Re: Output to a task window?



Kell Gatherer wrote:
In article <1a6f295e4e.druck@xxxxxxxxxxxxxxxx>,
druck <news@xxxxxxxxxxxxxxxx> wrote:

In other words, I can see how to do it from a single-tasking program
using an Obey file: *TaskWindow <progname> -display -quit so that all
the PRINT statements appear in a task window.

Why do you want the lines displayed in a taskwindow, why not a normal
editor text window by writing to a text file and using Filer_OpenDir on
it?

Well, it was just to see what progress is going on. Printing the leafname
to an icon means progress is flickering beyond comprehension,
Filer_Run-ning a text file only shows me what's happened after the entire
process is complete. Until all files have been counted I can't calculate a
percentage for the hourglass, etc. etc. I just thought it might be useful
to see all the files wheeling past in a text window.
I've got two possible solutions one using pipes;
10 DIM blk% 255
20 SYS "Wimp_Initialise",310,&4B534154,"TaskWinPipe",0 TO ,th%
30 SYS "Wimp_StartTask","Taskwindow ""PRINT PIPE:$.TskPipe1""
-quit"
40
50 out% =OPENOUT("Pipe:$.TskPipe1")
60 SYS "OS_ChangeRedirection",-1,out% TO ,old%
70
80 PRINT "HELLO TASKWINDOW"
90 *HELP TASKWINDOW
100
110 SYS "OS_ChangeRedirection",-1,old%
120
121 REPEAT
122 SYS "OS_ReadMonotonicTime" TO t%
123 SYS "Wimp_PollIdle",,blk%,t% +100 TO r%
130
131 SYS "OS_ChangeRedirection",-1,out% TO ,old%
140 PRINT "Tick",~t%
141 SYS "OS_ChangeRedirection",-1,old%
150 UNTIL r%=17 AND blk%!16 =0
160
162 CLOSE #out%
The problem with this is that in some circumstances the pipes can be
left open, using up precious file handles, and the program can fail
through using the same filename.

The second solution is cleverer and uses wimp messages, it doesn't use
the Taskwindow module at all - just it's protocol. We're pretending to
be the taskwindow module, and sending messages to Zap/StrongEd/Edit as
if we are.
10 ON ERROR :ON ERROR OFF:ERROR ERR,REPORT$+" at line "+STR$(ERL)
20 DIM blk% 255
30 SYS "Wimp_Initialise",310,&4B534154,"TaskWinPipeMess",0 TO
,th%
40
50 TaskWindow_NewTask% =&808C5
60 TaskWindow_Ego% =&808C2
70 TaskWindow_Output% =&808C1
80
90 $(blk% +20) ="Set Return$TH "
100 blk%?33 =0
110
120 blk%!0 =36
130 PROCsend_message(17,TaskWindow_NewTask%,0)
140 REPEAT
150 SYS "Wimp_Poll",,blk%
160 SYS
"XOS_ReadVarVal","Return$TH",STRING$(255,CHR$(0)),254,0,0 TO
,read$;flags% :err% =(flags% AND 1) >0
170
180 UNTIL err% =0
190 SYS "OS_CLI","Unset Return$TH"
200
210 task_parent% =EVAL("&"+LEFT$(read$,8))
220 texth$ =MID$(read$,10,8)
230
240 blk%!0 =24
250 blk%!20 =EVAL("&"+texth$)
260 PROCsend_message(17,TaskWindow_Ego%,task_parent%)
270
290 PROCoutput("Hello!"+CHR$(&D)+CHR$(&A))
350 r% =0
360 WHILE (r%=17 AND blk%!16 =0) =FALSE
410 SYS "OS_ReadMonotonicTime" TO t%
420 PROCoutput("Tick "+STR$~t%+CHR$(&D)+CHR$(&A))
430 SYS "Wimp_PollIdle",,blk%,t% +100 TO r%
440 ENDWHILE
450 END
460
470 DEF PROCsend_message(type%,msg%,dst%)
480 blk%!12 =0
490 blk%!16 =msg%
500 SYS "Wimp_SendMessage",type%,blk%,dst%
510 ENDPROC
520
530 DEF PROCoutput(str$)
540 blk%!0 =(24 +LEN(str$) +3) AND &FC
550 blk%!20 =LEN(str$)
560 $(blk% +24) =str$
580 PROCsend_message(17,TaskWindow_Output%,task_parent%)
590 ENDPROC
With some simple changes this program could automatically re-open the
text window - if the user closes it.

To reply use James dash lampard at talk21 dot com

.



Relevant Pages

  • Re: Font_Paint background
    ... numbers, Roman letters and Greek letters (upper case omega, ... place in the window. ... SYS Font_Converttopoints%,, xos%, yos% TO, coords%!16, coords%!20 ... When the Wimp does a redraw window request, it clears the area to be ...
    (comp.sys.acorn.programmer)
  • Font_Paint background
    ... I need to plot a string into a window; ... SYS Font_Paint%, large_font%, demo$, &122, x%, y%, coords% ...
    (comp.sys.acorn.programmer)
  • Re: component transfer error
    ... | then the window saids... ...
    (microsoft.public.windowsxp.games)
  • Re: unwanted window appears when i turn on computer
    ... Scan your Sys on line at eg Trend Micro, ... Theres a distinct possibilty that your sys is infected ... When I click "Okay," or i close the window another window appears that ... reference to it in the registry." ...
    (microsoft.public.windowsxp.general)