home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / acorn / tech / 598 < prev    next >
Encoding:
Internet Message Format  |  1992-11-12  |  4.5 KB

  1. Path: sparky!uunet!mcsun!uknet!acorn!aglover
  2. From: aglover@acorn.co.uk (Alan Glover)
  3. Newsgroups: comp.sys.acorn.tech
  4. Subject: Re: New Iconizer
  5. Message-ID: <20087@acorn.co.uk>
  6. Date: 12 Nov 92 10:19:08 GMT
  7. References: <1992Nov9.124617.28025@dcs.warwick.ac.uk>
  8. Sender: aglover@acorn.co.uk
  9. Organization: Acorn Computers Ltd, Cambridge, England
  10. Lines: 127
  11.  
  12. In article <1992Nov9.124617.28025@dcs.warwick.ac.uk> ahersee@dcs.warwick.ac.uk (Andrew Hersee) writes:
  13.  
  14. >> Below is an extract from my code which basically shows you what I am
  15. >> initialising the task with and the message I am broadcasting. Can
  16. >> anyone out there explain what I am doing wrong? Why won't Pinboard
  17. >> open all it's iconized windows and then let me claim any
  18. >> message_windowinfo messages?
  19.  
  20. It is the the size of the message you send which Pinboard acts upon,
  21. and it should be 24 bytes only since there is no other data in the
  22. message.
  23.  
  24. >>  message_iconize=&400CA
  25. >>  message_windowinfo=&400CB
  26. >>  message_windowclosed=&400CC
  27.  
  28. Wrong! The draft PRM's which were available at the BBC Acorn User show
  29. the correct numbers, ie:
  30.  
  31.     Message_Iconize             &400CA
  32.     Message_WindowClosed        &400CB
  33.     Message_WindowInfo          &400CC
  34.     
  35. They have been wrongly printed in some earlier drafts.    
  36.  
  37. >>  mess%!0=17
  38. >>  mess%!4=18
  39. >>  mess%!8=&400C8
  40. >>  mess%!12=&400C9
  41. >>  mess%!16=&400CA
  42. >>  mess%!20=&400CB
  43. >>  mess%!24=&400CC
  44. >>  mess%!32=0
  45.  
  46. This is ok since this program is running on 3.00 or later. Be careful
  47. though, if you give the message list as 0 to the Wimp_Initialise in
  48. 3.00 this means "give me no messages", but in 3.10 it means "give me
  49. all messages".
  50.  
  51. >>  SYS "Wimp_Initialise",310,&4B534154,"Iconizer",mess% TO wimp,us%     
  52.  
  53. >>  !bk%=56
  54.  
  55. This will not work since you are not sending a message of 56 bytes, only
  56. 24 bytes!  Pinboard assumes that messages greater that 24 bytes are responses
  57. to requests that it sent.
  58.  
  59. >>  bk%!12=0:bk%!16=message_windowinfo
  60. >>  bk%!20=0:bk%!24=0
  61.  
  62. This is okay.
  63.  
  64. >>  ignorewindowinfo=TRUE :So that we know not to quit when we receive it
  65. >>  SYS "Wimp_SendMessage",17,bk%,0
  66. >>  myref=bk%!8
  67. >>  
  68.  
  69. >> It looks as though I may have to write my own Pinboard which would be
  70. >> a real pain since Pinboard is quit fast at redrawing the background.
  71.  
  72. When you broadcast this message the pinboard's iconizing will stop but pins
  73. on the backdrop will still be present.
  74.  
  75. >> Thanks 
  76.  
  77. No Problem, glad to have helped, at least it's not a bug on Pinboard!!
  78.  
  79. >> Andrew Hersee 
  80.  
  81. Rupert E.D. Johnson (rjohnson@acorn.co.uk)
  82.  
  83. (Short program to illustrate getting the Pinboard to reopen windows
  84. follows. Note that this program is provided to demonstrate a specific
  85. point, rather than advocate any specific programming style.)
  86.  
  87. REM >PinOpener
  88. :
  89. message_iconize     =&400CA     :REM These are the correct Message values
  90. message_windowinfo  =&400CC     :REM that appear in the Risc OS 3
  91. message_windowclosed=&400CB     :REM PRM's.
  92. :
  93. REM Register a Risc OS 3.10 wimp task, given the message structure as 0
  94. REM ie. 'give me all messages'
  95. REM 
  96. SYS "Wimp_Initialise",310,&4B534154,"Pinboard Opener",0 TO wimp_vsn%,taskid%
  97. :
  98. DIM bk% &100                    :REM Scrap memory for Wimp, and building messages
  99. armed%=0                        :REM Arming Sequence Counter
  100. shutdown%=FALSE                 :REM TRUE if task is shutting down
  101. :
  102. SYS "OS_ReadMonotonicTime" TO oldtime%:REM Read Monotonic Timer
  103. REPEAT
  104.    SYS "OS_ReadMonotonicTime" TO newtime%
  105.    WHILE (newtime% - oldtime%) > 0:oldtime%=oldtime%+100:ENDWHILE
  106.    SYS "Wimp_PollIdle",0,bk%,oldtime% TO reason%:REM Return from Wimp every second
  107.  
  108.    CASE reason% OF
  109.       WHEN 0:                   :REM Null
  110.          CASE armed% OF
  111.             WHEN 20:            :REM Arming Sequence, 10 seconds until broadcast
  112.                bk%!0=24         :REM >24 are assumed to be from pinboard itself
  113.                bk%!12=0
  114.                bk%!16=message_windowinfo
  115.                bk%!20=0:bk%!24=0
  116.                SYS "Wimp_SendMessage",17,bk%,0:REM Send Message Block
  117.                armed%+=1
  118.                VDU7
  119.  
  120.             WHEN 30:            :REM Kill ourselves after 20 seconds
  121.                shutdown%=TRUE
  122.                armed%+=1
  123.                VDU7
  124.  
  125.             OTHERWISE
  126.                armed%+=1        :REM Increase Arming Sequence
  127.          ENDCASE
  128.  
  129.       WHEN 17:                  :REM User_Message
  130.         IF bk%!&10=0 THEN       :REM Received a Message_CloseDown
  131.            shutdown%=TRUE       :REM Yes, shutdown flags set
  132.         ENDIF
  133.  
  134.    ENDCASE
  135. UNTIL shutdown%                 :REM Have we been asked to shutdown?
  136. :
  137. SYS "Wimp_CloseDown"            :REM Closedown this task.
  138. END
  139.