     Subj:  DYL's & 64k limits               Section: Programming
       To:  All/Psion tech support           22 February 1997 11:07:01
     From:  JOHN MURRAY, 70374,1054          #282217

     I have a number of  programs which run on HC's/Workabouts and Series 3's
     written in SiboC and have now come up against a problem. - The
     additional features are now pushing the to6tal obj size above the 64k
     code limit. The programs are traditional functional rather than Object
     oriented in style and I am finding it difficult to understand how to use
     DYL' s as one would use an overlay in C. The manual is not very helpful.
     Has anyone any ideas how to call a simple function from a DYL? Does it
     have to be expressed as a method of a public class?. If so presumably I
     would need the C++ extensions to the Topspeed C I am using?. 
     Finally does anyone know if it is possible to use any other C (other
     than JPI Topspeed which came with SIBOSDK) to construct Psion IMG's ??

     Thanks to anyone who knows!
     John Murray


     Subj:  DYL's & 64k limits               Section: Programming
       To:  JOHN MURRAY, 70374,1054          24 February 1997 04:19:12
     From:  Cade Roux (New Orleans), 73733,1014#282623

     John,
     There's a lot you can do.  Which version of the SDK do you have?  You
     want to look in Volume 3.  You don't need TopSpeed C++ - you have to
     look at how Psion implements OO in C - it's pretty easy to compare it
     to, but it's not identical to, the C++ object model.

     A little overview:

     Psion's OO system is all based on numbers.  When your program is
     running, it is made up of categories (places where classes are grouped).
      For instance, OLIB, the basic GUI and utility ROM-based classes are all
     in a single OLIB category, which the HWIF startup and probably most of
     the startup codes will link.  The HWIM category is the OO GUI
     Application Manager category which contains all the classes around which
     HWIF is a procedural shell.

     The category file is a file which contains all the information about
     every class in the category.  When you instantiate a class, you need to
     know the category number and the class number.  Your IMG is one category
     and the DYL will be another.  You'll link the DYL using p_linklib(),
     which will give you a category handle.  Your category will contain one
     flat class with little or no inheritance.  Just as in C++, the member
     functions of a class are stored as function pointers in a table.  The
     index into the table is the method number.  To call a function in a
     class, you p_send the object a method number (like Smalltalk).

     When you have a .cat file, Psion's ctran program converts this into a .c
     file of the same name which contains the definitions of the tables of
     function pointers which are constructed based on the name in the .cat
     file.  It also creates a .g file with the #defines.  So if you have a
     class a, with added method a_func, the .g file will contain #defines
     for:

      C_A, the class number for class a
      PR_A, a structure defining the total member data (property) for class a
     - including base class data structures
      PRS_A, a sub-structure defining the member data specific to class a, if
     you inherit from a, the derived classes will access a's member data
     through this substructure
      O_A_FUNC, the method number for a_func, which corresponds to the index
     of the function pointer a_a_func in a table generated in the .c file

      The .c file will contain an array of function poiinters, one of which
     will be an entry a_a_func, contructed from class name + '_' +
     method_name.

     Compile the examples and then reverse-engineer the .g and .c files which
     are generated from the .cat file.  You should be able to see that the
     p_send() function is something like this:

      p_send(PR_ROOT *pobj, INT method, args) {
         check pobj->root.cat and pobj->root.class
         find the function pointer table for cat/class
         step to index method in that table of function pointers
         call funcptr(pobj, args)
      }

     It's close to C++, but incompatible with the C++ object model, and
     without the benefit of compiler support, basically.

     Functions can take or return pointers or other numbers, but arguments
     are limited to 16-bit values (so I normally use pointers to larger state
     structures).

     Oh, and you can split category files for control, efficiency, and in bad
     cases, memory usage by CTRAN, which can run out of space when attempting
     to process them - not all classes have to be defined in the same
     category file, but they can be included - this is sort of analogous to
     .c->.obj->linker.

     Cade


     Subj:  DYL's & 64k limits               Section: Programming
       To:  Cade Roux (New Orleans), 73733,101423 February 1997 11:10:12
     From:  JOHN MURRAY, 70374,1054          #282437

     Thanks in truckloads Cade!!!
     Any other examples would be appreciated - Can I ask what might seem
     stupid questions? (I'm not familiar with the C++ classes and objects
     approach, being stuck in the functional past) 

             - I presume the dyl.cat is just a convention for putting all the
     class definitions in one source file?

             - I seem to be missing some library files in Topspeed C - I
     pesume I need a  version that deals with C++ procs,classes etc

             - In the call to the mydyl_func1() via p_send3 , why is
     mydyl_func1 prefixed as 0_Mydyl_func1??

             - Can the function return a value/pointer or anything useful to
     the calling prog??

     Thanks once again 
     John Murray


     Subj:  DYL's & 64k limits               Section: Programming
       To:  JOHN MURRAY, 70374,1054          23 February 1997 07:09:12
     From:  Cade Roux (New Orleans), 73733,1014#282387

     You need to first isolate chunks of code which can always be called out
     of the DYL and that have no static data - I have some tips for dealing
     with that if you can't figure out how to work around it.  Then you do
     something like this:

     dyl.cat

     CLASS mydyl root {
         ADD mydyl_func1 }

     dylo.c

     GLDEF_C VOID mydyl_mydyl_func1(PR_MYDYL *self, INT args) {
         // code goes here. }

     wrapper.c

     PR_MYDYL *dylptr ; // will need to be instantiated at the beginning of
     the

     VOID myfunc(VOID) {
         p_send3(dylptr, O_MYDYL_FUNC1, args) }

     Then compile dyl.cat and dylo.c and link the resulting dyl.c and dylo.c
     into dyl.dyl.

     Compile wrapper.c and link into your img.  Instantiate a singleton
     instance of C_MYDYL, and thereafter your wrapper functions call the
     functions in the DYL.

     Need more detail?
     Cade


     Subj:  Dutch Operating System           Section: Programming
       To:  All                              23 February 1997 16:35:14
     From:  alan richey, 100023,543          #282479

     Came across an interesting bug today when a Dutch user found that
     Quicken Import didn't work in his copy of S3ABANK.  Eventually traced to
     the fact that:

     VAL("2500.00")  doesn't work in Dutch machines, you have to use
     VAL("2500,00")

     My apologies if everyone already knows that or it's in the manual or
     it's been posted here before, but it was a new one on me.  It was also
     an interesting experience debugging by remote control with a user who
     had never programmed a Psion. Luckily he was a quick learner. :-)

     Cheers
     Al


     Subj:  Code to cancel alarm...          Section: Programming
       To:  All                              05 March 1997 05:49:11
     From:  George Champlin, 74463,1520      #284336

     Hi,
     Here is a short procedure that shows how to cancel an alarm via OPL!!!! 
     I pieced this together from some info that someone sent me on the
     usenet.  The first bit is straight out of the OPL programming manual
     (page 136) and the second part does the magic.  The important thing is
     that you must not IOCLOSE (unless you cancel) otherwise you'll never be
     able to cancel the alarm.  I have found no ill effects of using this
     code (so far!)
     The other thing that's important is that (according to the OPL manual)
     this must be a separate module.  Otherwise there could be problems, so
     the only thing that would change would be that h%,s% and a&(2) would
     need to be GLOBAL variables in your main app then load the alarm setting
     module, come back to your main app and (potentially) load an module that
     has the cancel section...

     Hope this helps,
     Geo


     PROC TESTALM:
     LOCAL h%,a&(2),a$(64),b$(65),d&,t&,t2&,a%,r%,s%

     dINIT "about to set alarm..."
     DIALOG

     r%=IOOPEN(h%,"ALM:",0)
     IF r%<0 :RAISE r% :ENDIF
     d&=DAYS(DAY,MONTH,YEAR)
     t&=DATETOSECS(1970,1,1,HOUR,MINUTE,0)
     a$="Hmmm....let's see!"                 REM Message that alarm will
     display
     t&=t& + 400                             REM
     offset for the alarm time
     a&(2)=86400*(a&-25567)+t&
     a&(1)=a&(2)-t2&
     b$=a$+CHR$(0)                            REM Message
     must be zero terminated string...
     IOC(h%,2,s%,a&(),#UADD(ADDR(b$),1))

     dINIT "Check to see if Alarm is there"
     DIALOG
     REM PART TWO DELETES THE PENDING ALARM

     IOW(h%,4,s%,a&(1))                     REM Deletes the alarm
     IOCLOSE(h%)                            REM
     Closes the IO handle

     dINIT "Check to see if it's been cancelled"
     DIALOG

     ENDP


     Subj:  HWIM LISTBOX Class               Section: Programming
       To:  Anyone                           14 March 1997 05:48:22
     From:  Cade Roux (New Orleans), 73733,1014#286439

     I'm using the HWIM listbox class.  I want to subclass it to display a
     list of items in columnar form.  I'm having the following problems:

     1) How do I get the listbox to default to a certain size?  If I set
     minwid = wserv_channel->conn.info.pixels.x, I get a too wide message. I
     want the box to completely fill the window.

     2) How can I get it to redraw when data changes?  If I have a dialog up
     and change the parameters for the list, when the dialog disappears, only
     the area underneath the dialog has been updated with the new data - it's
     cool - data is disjointed mid-line!  The draw method obviously restricts
     to the rectangle.  Is there a better way than just invalidating the
     entire window.  I am already setting the PR_LISTBOX_UNSTABLE.  Data can
     change based on IPC events in the background.  In particular, the list
     can become longer or shorter due to changing parameters for the dataset.
     I'd like to be able to re-initialize without destroying and re-creating
     the listbox.  I resolved this by calling
     wInvalidateWin(listbox->win.id).

     This works as long as the initial data set is large, and if it reduces
     to the point that the window is not full, everything is still OK.
     However, if the data set starts out as only two lines, say, and then the
     parameters change, after the InvalidateWin, the drawing is just clipped
     to the old window size.  Basically, if I could get the window forced to
     the full size (height and width), all the time, I wouldn't than see any
     problems.

     3) Setting listbox.vastart - currently I replace wn_init and set vastart
     to 1 so I can have a single line title and then supersend(wn_init).  Is
     this the correct way?  Setting first and last is also a bit strange. 
     And the last item never gets set by lb_inquire_last - you have to also
     set it in the wn_init.

     4) Fonts - is there any way to use different fonts to get a zooming
     effect?

     5) Can I stretch the cursor bar all the way across, as on a filelist?

     Cade

     Subj:  HWIM LISTBOX Class               Section: Programming
       To:  Cade Roux (New Orleans), 73733,101415 March 1997 01:20:19
     From:  Chris Hennings, 100010,511       #286638

     >1) How do I get the listbox to default to a certain size?
     What's wrong with LB_SIZE_WINDOW - vol4 HWIM Ref p6-9. width is
     calculated from listbox.width + left/right edges + potentially gutter.
     Note also reference to LB_SIZE_EDGE in para 2 of p6-7 discussing WN_INIT

     >2) How can I get it to redraw when data changes?
     WN_DRAW discussion on p6-8. PR_LISTBOX_UNSTABLE is cleared by the draw -
     what do you do about setting it? If the whole win contents change then
     wInvalidateWin is reasonable but this is just what WN_DRAW does if 
     PR_LISTBOX_UNSTABLE is set. Clearly the design choice of invalidate as
     opposed to explicit validate+draw is available. If content change has
     window size implications and its all under your control then
     LB_SIZE_WINDOW may be implicated.

     >3) Setting listbox.vastart
     Err - what's wrong with the init->first and init->last elements of the
     IN_LISTBOX struct ???

     >4) Fonts - is there any way to use different fonts to get a zooming
     effect?
     You would end up doing a fairly major replacement of the class methods -
     if this is the sort of thing you want to do you would probably do better
     looking at the S3c/Siena originated GRID class with which you can
     clearly implement listbox functionality and much more besides - not
     least in that you're freed from the need for all list elements to be in
     a va so which may be a restriction if you wanted say very large lists.

     >5) Can I stretch the cursor bar all the way across, as on a filelist?
     Replace LB_DRAW_EMPHASIS and away you go. Filelists do this as per
     C_PULLDOWN

     Rgds
     Chris

     Subj:  HWIM LISTBOX Class               Section: Programming
       To:  Chris Hennings, 100010,511       16 March 1997 03:36:17
     From:  Cade Roux (New Orleans), 73733,1014#286897

     Chris,
     Firstly, thanks for your helpful reply.  I found this section of the SDK
     uncharacteristically (I wonder why Virtual Access suggests
     antiecclesiastically as a better spelling for that!) cryptic with little
     in the way of an effective example.

     To give you some background, the application has two modes, list and
     graph, where the VARRAY is dynamically based on the database.  For list
     mode, I have implemented from scratch in the past, but I figured this
     time to investigate the LISTBOX.  The VARRAY is dynamically changeable
     due to IPC messages sending new data which is acquired serially (stock
     quotes via a pager) by a server process.  This application has an IPC
     server built in which handles messages for the engine which maintains an
     ISAM database.  Right now the VARRAY build query is just re-run upon any
     database addition, but that is obviously not necessary.

      << What's wrong with LB_SIZE_WINDOW >>

     The manual claims that this call also, surprisingly, creates the window,
     and is not clear about what you can and cannot do in the method, or if
     you replace the method, whether to supersend before or after your sizing
     code - after all this code doesn't even take a P_RECT...  I started off
     replacing the LB_SIZE_WINDOW method, but the more I read about the
     LB_SIZE_WINDOW method the more I wasn't sure anyone was supposed to
     replace it.  I hate to replace one of these huge multi-purpose
     functions.  I guess it would be easier if I had the HWIM source code!

      >> If content change has window size implications and its all under
     your control then LB_SIZE_WINDOW may be implicated. <<

     I'd like the window to be fixed to the full screen, with my title
     showing similar title information as is normally shown when the graph
     mode is active.  I'll try just resizing the window after init using
     WN_POSITION and WN_CALC_POSITION for the above reasons.

      >> what's wrong with the init->first and init->last elements of the
     IN_LISTBOX struct <<

     I thought that setting .last property would not be necessary since I
     already had to replace LB_INQUIRE_LAST, but it is still necessary to set
     .last for some reason (so I use the same call to VA_COUNT before
     creating the listbox, since my VA is already created - it has permanent
     life outside the list box).

      >> S3c/Siena originated GRID class with which you can clearly implement
     listbox functionality and much more besides <<
      >> a restriction if you wanted say very large lists. <<

     Not necessary for this project (since there is a reasonably small limit
     to the data set which I allow to be viewed at any given time - never
     more than a hundred), but is this to be documented in a forthcoming SDK
     (I'm still on 2.1)?  There are also a few virtual records which are
     interpolated from the actual database when the VARRAY is constructed,
     and this is easier to manage if the VARRAY is separate from the
     database.

     I'll play around with the code some more tonight and see if I can get
     something working better.

     Cade


     Subj:  HWIM LISTBOX Class               Section: Programming
       To:  Cade Roux (New Orleans), 73733,101416 March 1997 14:53:24
     From:  Chris Hennings, 100010,511       #286976

     Cade,

     The Lisbox approach to screen size is as follows:
     We want to draw a list of text items in the system font. The height of
     each text row is therefore known so the height of the screen area for
     drawing *text* is just n x row height where n is the minimum of the no
     of va entries or the maximum available on screen (set in
     DatGate->gate.x.ninlb). The width of area for drawing text is determined
     from the entries in the va or as set by the user. The *total* window
     width/height is the text draw area *plus* the space needed for borders,
     scroll symbols gutters etc. Once this is determined, the tl.x, tl.y are
     calulated to centre the listbox window on screen. All this is done
     inside O_LB_SIZE_WINDOW called from O_WN_INIT if
     (init->flags&IN_LISTBOX_AUTO_SIZE)

     Your problem is that the window size is effectively set at O_WN_INIT but
     both width and height dimensions may vary if the no of va entries at
     init is less than DatGate->gate.x.ninlb but become greater than this
     value subsequently. The other issue that may have implication is if your
     app involves dynamic decrementing of the number of va entries eg:
     suppose we have 3 entries in the list and one is deleted from the va -
     well you can tell it to redraw but off hand it will just gPrintBoxText
     items 0 and 1 potentially leaving the pixels set with the no
     non-existant item 2 showing - ie it doesn't know to do a clear rect.

     Clearly, the most common use of ListBox design is with non-dynamic vas -
     but ISTM you can get it to do what you want without quite simply from
     the WN_INIT as follows:

     1/ Forcing max width

     Basically we're going to set the IN_LISTBOX_FIXED_WIDTH |
     IN_LISTBOX_FORCE_WIDE | IN_LISTBOX_AUTO_SIZE and reverse out an
     appropriate value for init->minwid as:

     physical_screen_width - (LISTBOX_LEFT_EDGE+LISTBOX_RIGHT_EDGE) -
     LISTBOX_SCROLL_GUTTER. 

     Note the need to use (XLISTBOX_LEFT_EDGE+XLISTBOX_RIGHT_EDGE) instead if
     PR_LISTBOX_PLAQUE is set.

     2/ Forcing max height

     O_LB_SIZE_WINDOW calls O_LB_INQUIRE_LAST to determine the number text
     rows and this returns either listbox.last if this value is non-zero or
     the result of a O_VA_COUNT - 1 otherwise. So all we need to achieve is
     that for the 1st time O_LB_INQUIRE_LAST is called (from
     O_LB_SIZE_WINDOW) it returns a suitably large value independent of the
     va and otherwise behaves normally with IN_LISTBOX_LAST_SET not set so
     listbox.last == 0 (ie it does the VA_COUNT).
     A minimal intervention might be:

     METHOD INT mylistbox_lb_inquire_last(PR_MYLISTBOX *self)
         {
         if (self->mylistbox.not_first_time)
             return(p_supersend2(self,O_LB_INQUIRE_LAST));
         else
             {
             self->mylistbox.not_first_time=TRUE;


             return(DatGate->gate.x.ninlb);
             }
         }

     3/ Handling deletion

     If the number of va entries drops below the number of displayable text
     rows - what about : after va_delete, append a null string entry to the
     va, do a draw and then delete the null entry.

     Rgds
     Chris


     Subj:  HWIM LISTBOX Class               Section: Programming
       To:  Chris Hennings, 100010,511       16 March 1997 23:47:01
     From:  Cade Roux (New Orleans), 73733,1014#287093

     Chris,

     This is what I came up with (doing some of WN_INIT's work for it):
     To create the listbox (so LB_SIZE_WINDOW never gets called):

         initlb.flags = IN_LISTBOX_KEEP_ARRAY
                             | IN_LISTBOX_FORCE_WIDE ;
         initlb.array = (PR_VAROOT *) self->quotcm.pChart ;

         pList = f_newsend(  CAT_QUOTES_QUOTES,
                             C_QUOTLB,
                             O_WN_INIT,
                             &initlb ) ;

     METHOD VOID quotlb_wn_init(PR_QUOTLB *self, IN_LISTBOX *plb) {
         W_WINDATA   windata ;

         self->listbox.vastart = self->listbox.first = self->listbox.top = 1 ;
         self->listbox.last = p_send2(plb->array, O_VA_COUNT) - 1 + self->listbox.first ;

         p_supersend3(self, O_WN_INIT, plb) ;

         self->win.flags = PR_BWIN_CUSHION | PR_WIN_EMPHASISED ;

         windata.extent.tl.x = 0 ;
         windata.extent.tl.y = 20 ;
         windata.extent.height = wserv_channel->conn.info.pixels.y - windata.extent.tl.y ;
         windata.extent.width = wserv_channel->conn.info.pixels.x ;

         self->listbox.width = windata.extent.width
                                 - LISTBOX_LEFT_EDGE
                                 - LISTBOX_RIGHT_EDGE
                                 - LISTBOX_SCROLL_GUTTER ;

         p_send5(    self,
                     O_WN_CONNECT,
                     NULL,
                     W_WIN_EXTENT,
                     &windata ) ;

         hInitVis(self) ;

     }

     METHOD VOID quotlb_lb_draw_emphasis(PR_QUOTLB *self, INT index, P_RECT *prect, INT on) {
         P_EXTENT        ob ;

         ob.tl = prect->tl ;
         ob.width = prect->br.x - prect->tl.x ;
         ob.height = prect->br.y - prect->tl.y ;
         gInvObloid(&ob) ;
     }

     METHOD INT quotlb_lb_inquire_last(PR_QUOTLB *self) {


         return(p_send2(self->listbox.va, O_VA_COUNT) - 1 + 
     self->listbox.first) ;
     }

     METHOD TEXT *quotlb_lb_inquire_item(PR_QUOTLB *self, INT index) {
         QUOTE_DATA *        pData ;
         P_DAYSEC            ds ;
         P_DATE              dt ;

         if ( index < self->listbox.vastart ) {
             // Do title stuff
         }
         else {
             pData = (QUOTE_DATA *) p_send3(self->listbox.va, 
             O_VA_PREC, index - self->listbox.vastart) ;
             // Do regular stuff
         }

         return(self->quotlb.buffer) ;
     }

     The only problem I have remaining now is that you'll notice that the 
     window does not start at the top left.  I shifted it down because I 
     could not get it to display more than 9 total lines (this is probably 
     restricted by Gate) - BUT it looked like there was plenty of room on the
     screen.

     Cade


     Subj:  WORD Format                      Section: Programming
       To:  sysop                            11 March 1997 13:51:26
     From:  Simon Berridge, 106633,3263      #285833

     I am writing a program that needs to create a Word file as output.

     So far I can produce a file in the form that I want but am stuck with
     the opening screen (in Word) not being the way I am trying to format it.
     I am getting the smallest zoom state and the smallest system window.
     What I want is middle zoom and no window.

     The Psion document on Word format talks about the options record. There
     are three fields within this record that appear to be pertinent to my
     problem:

       UBYTE  symbols  show screen symbols
       UBYTE  statzoom  ***
       UBYTE  style         TRUE to show style bar

     *** This seems to be the field that I want but no matter what I set it
     to (other than 0) I get the same result. However, if I set it to
     non-zero I gety the style bar showing.

     Setting the symbols field to non-zero does take away the system window,
     but I cannot get the zoom right.

     Please.......... some help!!!

     Simon.


     Subj:  WORD Format                      Section: Programming
       To:  Simon Berridge, 106633,3263      11 March 1997 14:24:02
     From:  John Boyce (Sysop), 100014,1240  #285835

     Simon
     Why don't you create a Word file in the format you require and then look
     at the appropriate record and copy the data from that?

     Best wishes
     John  (United Kingdom)


     Subj:  WORD Format                      Section: Programming
       To:  Simon Berridge, 106633,3263      11 March 1997 20:23:12
     From:  Jochen Siegenthaler, 100127,3167 #285918

     << I had thought of that but have been put off by the amount of
     programming required, I have only done the one way (so far!).  >>

     No programming is required, just look at a Word file with a hex viewer
     (such as HexView). HexView also allows you to edit a file (and System
     memory!) in Hex. Very powerful, and potentially very dangerous :-)

      --
      Regards, Jochen @ Madrid, Spain, 11/03/97 19:39


     Subj:  WORD Format                      Section: Programming
       To:  Simon Berridge, 106633,3263      11 March 1997 18:34:15
     From:  Chris Hennings, 100010,511       #285893

     >  UBYTE  statzoom
     The UBYTE indicates an unsigned 8 bit value, the top 4 bits of which
     indicate the current zoom state (0=smallest font) and the bottom 4 bits
     control the status window size (0=Off,,2=Big). Thus a value in this byte
     of 0x02 would indicate smallest font and a big status window.

     The fact that you're getting interactions with the other items makes me
     wonder if you are in fact writing 16bit values ?

     Rgds
     Chris


     Subj:  WORD Format                      Section: Programming
       To:  Chris Hennings, 100010,511       18 March 1997 12:16:12
     From:  Simon Berridge, 106633,3263      #287466

     Chris
     Yup, I think you are right.

     I created a Word file and was able to review it with a Hex viewer and
     found the appropriate bytes. Writing them exactly as I saw produced the
     right file but there is definately something weird going on! It could be
     as you suggested but I am not going to waste any more time on the
     subject getting the 'perfect' answer as I now have a generic module
     produced that does everything I want and is customisable at all stages.
     The fact that I still don't understand why it works is not relevant
     now!!

     Thanks to everybody for your contribution.
     Simon.


     Subj:  Embedding PICs in OPAs           Section: Programming
       To:  Sysop / All                      13 March 1997 08:03:04
     From:  Mark Barnett, 106026,1727        #286238

     Dear All,
      I found the following code for the Psion 3 in the libraries here, and
     would like to integrate it into my own program. It allows the OPA to use
     a larger picture file (hidden behind the icon) without the need for
     _separate_ picture files. Trouble is, since it's for the Psion 3 there
     is no grey, all (my) efforts to add it have failed with various amusing
     results. I think it lies in the *Wserve* Call line, but since this is so
     sparsely documented I have not been able to make it work. And .... yes
     .... the bitmap I'm using does have a grey plane. <G> There now follows
     the code;

      App PicShow 
        icon "m:\Pic\mupcar.pic"     REM load the pic file 
      Enda

     PROC pic:
      local id%,wi%,ht%,id1%
      local f$(128),buf%(100)
      local h%,l%,o%
      top::
      gGrey 2 REM I put this bit in but it doesn't do anything
      f$=cmd$(1)
      l%=ioopen(h%,f$,$400)                    REM Open this opa, sharing mode
      if l% :goto cl2 :endif
      l%=ioread(h%,addr(buf%(1)),200)          REM read file, dump 200 bytes into buffer
      if l%<=140 :goto cl :endif               REM at least 140 bytes
      if buf%(1)<>%O+(%P*256) :goto cl :endif  REM if top of file<>OPLO, quit
      if buf%(2)<>%L+(%O*256) :goto cl :endif
      o%=23+(buf%(11) and $ff)
      l%=peekw(addr(buf%(1))+o%)               REM look for PIC stamp
      if l%<>%P+(%I*256) :goto cl :endif       REM identify PI from "PIC"
      if l%=0 :goto cl :endif
      call($5f8d,1,o%,0,0,0)                   REM Wserve Opcode
      cl::
      ioclose(h%)                              REM close file
      cl2::
      id%=gLoadBit(f$)                         REM load image
      wi%=gWidth :ht%=gHeight                  REM get width and heighth
      gUse 1                                   REM use main window
      gCopy id%,0,0,wi%,ht%,3                  REM draw new graphic
      get
      gClose id% ENDP

      Any help is very gratefully received!

      TIA, Muppet at home, Weybridge , United Kingdom


     Subj:  Embedding PICs in OPAs           Section: Programming
       To:  Mark Barnett, 106026,1727        13 March 1997 11:08:07
     From:  John Boyce (Sysop), 100014,1240  #286262

     Muppet

     The System call you are querying is associated with gLOADBIT and all it
     does is modify the place where gLOADBIT starts to look for the picture
     (i.e. it sets the offset within the file of where the start is). It does
     nothing with greys or blacks or whites <g>.

     Look elsewhere for your problem (remembering that grey is another
     picture, so you need to look at the picture heading to see if there is a
     grey plane and then load it separately if there is).

     Best wishes

     John  (United Kingdom)


     Subj:  Embedding PICs in OPAs           Section: Programming
       To:  Mark Barnett, 106026,1727        14 March 1997 01:25:28
     From:  Konstantin Saliy, 106062,203     #286417


     Mark,
     << Thanks - I can see that the grey _is_ another plane and I therefore
     need to load two pictures. >>

     Save the value of the offset of your bitmap and make that CALL to WServe
     again before gLOADBIT for grey plane.

     This call sets the file offset *only* for the next gLOADBIT.

      Regards
      Konstantin @ MOCKBA 14/03/97 03:48


     Subj:  Embedding PICs in OPAs           Section: Programming
       To:  Mark Barnett, 106026,1727        14 March 1997 21:18:23
     From:  Konstantin Saliy, 106062,203     #286588

     Mark,
     << are you using someone else's account? <G> >>

     You might mention that the address is the same! <g>

     <<  How do I save the offset?  >>

     I meant, keep the value of the offset (start of PIC inside OPA file)
     between calls to WServer, i.e. do not destroy the value of o% (if I
     remember that piece of code). I have deleted that ytour message, so if
     this explanation is not still clear, send me (by private mail) that code
     fragment and I'll modify it for both planes.

     << bring up both grey and black and copy it to all black  >>

     Use gGREY 1 before copying grey part of bitmap. Then don't forget to use
     either gGREY 0 or gGREY 2 to draw only on the black plane or on both.

     << Sorry to be thick, but I'm not quite as well-versed in OPL as I'd
     like to be.  >>

     Don't sorry when you ask - this section is exactly for that. <g>

      Best wishes
      Konstantin @ MOCKBA 14/03/97 23:46


     Subj:  Embedding PICs in OPAs           Section: Programming
       To:  Konstantin Saliy, 106062,203     15 March 1997 13:02:24
     From:  Mark Barnett, 106026,1727        #286706

     Konstantin,
      << You might mention that the address is the same! <g> >>

      Weeeell..... a man of your capabilities I'm sure everything is
     possible. ;^)

      << I meant, keep the value of the offset (start of PIC inside OPA file)
     between calls to WServer, i.e. do not destroy the value of o% >>

     I think I understand. A the moment the offset is determined by
     o%=23+(buf%(11) and $ff) and the Wserve call which will be the same
     when I run the program again to look for the grey; I'll just find the
     black. Is this correct?

     Later ... OK, it works fine. (Yippee!) Now I just have one simple
     question; How do I make two bitmaps (say, an icon and a picture) into
     the same file? I could do it on a PC with WSPCX, but can it be done on
     the Psion? Since I no longer have a PC at home, I've pasted the Icon
     into the picture with a draw program. Unfortunately, this has made the
     icon appear in the system screen as a S3 icon instead of a S3a.

      thanks again,
      Muppet at home, Weybridge , United Kingdom


     Subj:  Embedding PICs in OPAs           Section: Programming
       To:  Mark Barnett, 106026,1727        15 March 1997 18:40:10
     From:  Konstantin Saliy, 106062,203     #286780

     Mark,
     << How do I make two bitmaps (say, an icon and a picture) into the same
     file? >>

     You may write this program by yourself <g> If you need I can mail you
     description of PIC file format.

     << Unfortunately, this has made the icon appear in the system screen as
     a S3   >>

     I just tried to use 14-bitmaps PIC file as an icon in OPA. Yes, it
     appears with only first bitmap in S3 mode :-( though this bitmap is from
     an application. I only may say that System handles icons in OPA and APP
     different way :-( I mean by APP and application written in C, just
     renaming does not help.

      Best wishes
      Konstantin @ MOCKBA 15/03/97 18:55


     Subj:  Embedding PICs in OPAs           Section: Programming
       To:  Mark Barnett, 106026,1727        13 March 1997 20:10:10
     From:  Chris Hennings, 100010,511       #286343

     > id%=gLoadBit(f$)   
     You need to specify which image/plane to load as in:
      id%=gLoadBit(f$,0,n%)
     n%=0 : Icon/black
     n%=1 : Icon/grey
     n%=2 : 1st additional .pic/black
     n%=3 : 1st additional .pic/grey
     etc.

     Rgds
     Chris

