     Subj:  Number format                    Section: Psion Programming
       To:  All                              23 December 1996 17:42:10
     From:  Rolf Aeschbacher, 100116,3357    #268308

     I came across a problem of which I hope some of you already solved:

     OPL's handling of decimal points depends on the setting of the number
     formats (Psion-Shift-F from the system screen). If the decimal point is
     set to "comma" the instruction

     print val("123.45")

     will generate the error "invalid arguments" and

     print val("123,45")

     works as expected.

     This means that dependent on that configuration setting a certain OPL
     program will run or won't run (yes, one of my programs belongs to this
     category)! I suppose this problem can be avoided by checking for the
     number format at the start of the program, but how?

     But it comes even worse:
     A similar problem arises with the EVAL() function.
     Assuming the string a$ contains

     loc("abcd","b")

     Then,

     print eval(a$)

     with the decimal point set as "dot" gives 2 - correct.

     But with comma as the decimal point OPL throws a "Bad number" at me!
     So I get an error although there isn't even a decimal point in the
     instruction. Can this be a bug in OPL?

     Thanks in advance for any tips, Rolf

     Subj:  Number format                    Section: Psion Programming
       To:  Rolf Aeschbacher, 100116,3357    23 December 1996 20:40:23
     From:  Jochen Siegenthaler, 100127,3167 #268385

     Rolf,
     << I came across a problem of which I hope some of you already solved:
      >>

     I solved some in VB3 :-)

     << print val("123.45")  will generate the error "invalid arguments" and 
     >>

     You should never hard-code a decimal separator or a thousands separator
     in a program, as you do not know what the user has configured. You must
     either...
      a) see what the user uses (a CALL will do this)
      b) write your programs so that you have no separators, ie:
      print val("123"+"45/100"))

     You should thoroughly test your program with all combinations of user
     settings.

     Here's what I use to show date and time in the current user format. The
     method to get the decimal separator is similar, and the location of the
     separator is shown in the REMarks

      PROC DT:(sc&,date%,time%)
      REM Returns date and time from supplied sc&
      REM seconds in the current system format
      REM sc& = time in seconds
      REM date% = address of a date string, must be
      REM         at least 8 bytes long
      REM time% = address of a time string, must be
      REM         at least 6 bytes long
      LOCAL yr%, mo%, dy%, hr%, mn%, sc%, yrday%
      LOCAL buf%, buf%(40), sep$(1), tmp$(7)
      LOCAL regs%(12)

      REM now get the user preferences
      REM Use Fn $8B Sub $05
      REM Fills the buffer with country-specific data:
      REM  Offset  0 (word): country code (e.g. UK is 44) of locale
      REM  Offset  2 (word): current offset from GMT in minutes (+ is ahead)
      REM  Offset  4 (byte): date format (0 = MDY, 1 = DMY, 2 = YMD)
      REM  Offset  5 (byte): time format (0 = am-pm, 1 = 24 hour)
      REM  Offset  6 (byte): currency symbol position (0 = before, 1 = after)
      REM  Offset  7 (byte): currency symbol separated with space (0 = yes, 1= no)
      REM  Offset  8 (byte): currency decimal places
      REM  Offset  9 (byte): currency negative format (0 = minus, 1 = brackets)
      REM  Offset 10 (byte): currency separate thousands
      REM                    (0 = no, 1 = yes, 4 = 10000 and over)
      REM  Offset 11 (byte): thousands separator
      REM  Offset 12 (byte): decimal separator
      REM  Offset 13 (byte): date separator
      REM  Offset 14 (byte): time separator
      REM  Offset 15 to  23: zero terminated currency symbol
      REM  Offset 24 (byte): start of week (0 = Mon, 1 = Tue, ... 6 = Sun)
      REM  Offset 25 (byte): summer times group
      REM                    (1 = Home, 2 = European, 4 = Northern, 8 = Southern)
      REM  Offset 26 (byte): clock type (0 = analogue, 1 = digital)
      REM  Offset 27 (byte): number of letters in day abbreviation (0 to 6)
      REM  Offset 28 (byte): number of letters in month abbreviation (0 to 255)
      REM  Offset 29 (byte): workdays (the set bits indicate the workdays)
      REM    Bit 0: Monday
      REM    Bit 1: Tuesday
      REM    Bit 2: Wednesday
      REM    Bit 3: Thursday
      REM    Bit 4: Friday
      REM    Bit 5: Saturday
      REM    Bit 6: Sunday
      REM    Bit 7: always zero
      REM  Offset 30 (byte): units (0 = inches, 1 = centimetres)

      REM get days etc
      SECSTODATE sc&, yr%, mo%, dy%, hr%, mn%, sc%, yrday%

      REM fill buf%() with user options
      buf%=ADDR(buf%())
      CALL($58B,buf%)

      REM set time
      sep$=CHR$(PEEKB(UADD(buf%,14)))
      IF PEEKB(UADD(buf%,5))=1
       REM 24 Hour
       tmp$=cstr2$:(hr%) + sep$ + cstr2$:(mn%)
      ELSE
       REM 12 Hour am/pm
       REM get am/pm text
       REM (varies with language)
       regs%(1)=$1D00 REM Sub $1D
       regs%(2)=ADDR(tmp$)+1 REM result buffer
       IF hr%>=12
        regs%(1)=regs%(1)+1 REM add 1 for pm
       ENDIF
       OS($8B,ADDR(regs%())) REM Fun 8B, get am/pm text
       POKEB ADDR(tmp$),2 REM make it a text string
       tmp$=GEN$(MOD%:(hr%+12,12),2) + sep$ + cstr2$:(mn%) + tmp$

      ENDIF
      POKE$ time%, tmp$

      REM set date
      sep$=CHR$(PEEKB(UADD(buf%,13)))

      REM vector uses less mem then IF..ENDIF
      VECTOR PEEKB(UADD(buf%,4)) :DMY,YMD :ENDV

      REM 0 = MDY
      POKE$ date%, cstr2$:(mo%) + sep$ + cstr2$:(dy%) + sep$ + cstr2$:(yr%)
      RETURN

      REM 1 = DMY
      DMY:: :POKE$ date%, cstr2$:(dy%) + sep$ + cstr2$:(mo%) + sep$ + cstr2$:(yr%)
      RETURN

      REM 2 = YMD
      YMD:: :POKE$ date%, cstr2$:(yr%) + sep$ + cstr2$:(mo%) + sep$ + cstr2$:(dy%)

      ENDP

     Subj:  Number format                    Section: Psion Programming
       To:  Daniel Pfund, 101743,775         24 December 1996 10:01:17
     From:  Jochen Siegenthaler, 100127,3167 #268493

     << users of DPBank switch back and forth between "comma" and "dot"
     separators and of course, it crashed the program :-(  >>

     It doesn't have to. You can ensure that each display of data uses the
     current separator, and store all data in your data file as text in fixed
     format (ie: "0.00").

     But you do need to consider these points when writing the program.
      --
      http://ourworld.compuserve.com/homepages/Jochen_Siegenthaler/
      @ Auckland, New Zealand on 24/12/96 19:12


     Subj:  Finding Applications             Section: Psion Programming
       To:  Cade Roux(NewOrleans), 73733,101429 December 1996 07:11:18
     From:  Christian Netocny, 100561,503    #269367

     Cade,
     but how can the System Screen recognize, what file is currently opened
     by an application?

     (May be it's a trivial question, but until now I didn't write a file
     based application).

     Thanks, Christian

     Subj:  Finding Applications             Section: Psion Programming
       To:  Christian Netocny, 100561,503    29 December 1996 16:24:06
     From:  Cade Roux(NewOrleans), 73733,1014#269431

     There are what are referred to as EPOC reserved statics at the beginning
     of the data segment.

     0x3E is called DatUsedPathNamePtr, and is a pointer to a zero-terminated
     string which should point to a full path specification of the currently
     open file.  The example given: LOC::A:\WRD\SHOPPING.WRD becomes
     Shopping[A]

     0x3C is called DatStatusNamePtr and should point to the name to display
     in the status windows.  The example given: DIARY.AGN becomes Diary

     The System screen first looks at 0x3E then 0x3C and if both are NULL, it
     looks at the process name (p_pname).

     In the HWIF library, there are some utility functions: hCrackCommandLine
     and hSetUpStatusNames.  I'm not sure about OPL.

     Cade


     Subj:  Finding Applications             Section: Psion Programming
       To:  Christian Netocny, 100561,503    29 December 1996 08:01:04
     From:  John Boyce (Sysop), 100014,1240  #269370

     Christian
     << but how works this mechanism when opening a file within an
     application  >>

     Then the open file is closed and the new one opened - this is done by
     calls to the Operating System and it is that which does all the hard
     work - as part of the opening sequence the process data is rewritten.

     << But one can write an application that opens more than one file within
     the same instance of the program. >>

     Yes but that sort of information isn't stored in the process data - this
     is classed as internal to the application and the information isn't
     available outside of the program (e.g. opening an OPL Data file). Only
     programs launched properly using the operating system method will give
     the opened name at the previously mentioned position.

     Best wishes
     John  (United Kingdom)

     Subj:  Finding Applications             Section: Psion Programming
       To:  Christian Netocny, 100561,503    06 January 1997 20:22:20
     From:  Ali Manson [Psion], 73733,32     #271182

     >However, some things are still unclear to me. Is there a way to get an
     info when a foreign 
     >process has been finished?

     You need to log onto it using p_logona()

     All the best
     Ali


     Subj:  Series 3a or 3c                  Section: Psion Programming
       To:  Sebastian Hochstetter, 100573,353008 January 1997 05:10:26
     From:  John Boyce (Sysop), 100014,1240  #271525

     Sebastian
     Are you trying to get the OS Version number or the ROM version number?
     (CALL($8B) will give the OS, CALL($2A8B) will give the ROM).

     Best wishes
     John  (United Kingdom)


     Subj:  Exporting to Word App            Section: Psion Programming
       To:  Paul R.Law, 100411,2311          12 January 1997 10:38:11
     From:  Chris Nicholson, 100522,2324     #272586

     Message text written by Paul R.Law
     >Can anyone help with a problem I'm having. I would like to export data
     from a file I have created within an OPL program to Psion's WORD
     application. The file has text and numeric fields.

     Any help would be greatly appreciated.<

     A very simple way is to create a file using Lopen and then use lprint to
     print the necessary text and close with lclose ie

     file$=loc::m:\wrd\test.wrd"
     lopen file$
     lprint "This is a test line"
     lprint text$
     lprint text2$
     lclose

     Where you want to print numeric fields use fix$ to convert to a string,
     it also allows you to specify the number of decimal places, eg.

     lprint fix$(test%,2,10)

     This will convert c% to a string variable that is to 2 decimal places
     and a maximum of 10 charactors long.

     I hope this is of some help.

     Kind regards
     Chris Nicholson
     Hertford, UK at 10:25 am - Sunday 12 January 1997

     Subj:  Loading Word from OPL?           Section: Psion Programming
       To:  David Harris, 101660,1237        15 January 1997 14:08:18
     From:  Ali Manson [Psion], 73733,32     #273395

     Hello

     Try:

             appn$="ROM::Data.APP"
                

     cmdl$="OData"+CHR$(0)+".DBF"+CHR$(0)+"LOC::A:\DAT\BUSINESS.DBF"+CHR$(0)
             ret%=runapp%:(appn$,cmdl$,addr(ppid%))

     where runapp%:() is:

     PROC runapp%:(appname$,cmdline$,ppid%)

       local ax%,bx%,cx%,dx%,si%,di%
       local ret%,flags%
       local cmdl$(128),img$(128)

       cmdl$=cmdline$+chr$(0)         REM must be zero terminated
       img$=appname$+chr$(0)

       REM -- first create the application --
       REM
       ax%=$0100                   REM set AH = 1 for "FilExecute" call
       bx%=addr(img$)+1            REM set BX = pointer to application name
       cx%=addr(cmdl$)             REM set CX = pointer to legth byte of command line
       di%=ppid%                   REM set DI = address to take process id
       flags%=os(135,addr(ax%))    REM call "FilExecute"
       if (flags% and 1)
         ret%=(ax% and $FF)-256    REM error returned from O/S call in AL
       else
         REM -- now run the created application --
         REM
         ax%=$0600                   REM set AH = 6 for "ProcResume" call
         bx%=peekw(ppid%)            REM set BX = process id
         flags%=os(136,addr(ax%))    REM call "ProcResume"
         if (flags% and 1)
           ret%=(ax% and $FF)-256    REM error returned from O/S call in AL
         else
           ret%=0                    REM return success
         endif
       endif
       return ret%
     ENDP

     You'll have to change the filename for a literal or a variable
     appropriate to your needs.
     
     All the best
     Ali
     
     
     Subj:  list box -> text box             Section: Psion Programming
       To:  all                              15 January 1997 19:31:11
     From:  Francis Shrago, 100277,600       #273444

     Does anyone have any suggestions as to how I can get items from a list
     box into a text box.

     I have a list box which is filled dependent on previous choices made.
     Therefore I do not the index of the item chosen. As a list box does not
     have a Text property, I do not know how to directly find out what choice
     was made.

     Any suggestions....?
     Francis Shrago

     Subj:  list box -> text box             Section: Psion Programming
       To:  Francis Shrago, 100277,600       16 January 1997 07:32:14
     From:  Jochen Siegenthaler, 100127,3167 #273561

     Francis,
     << items from a list box into a text box. >>

     You could parse the dCHOICE string and count commas until you find the
     string you want, but an easier way is to ensure your dCHOICE list box is
     made up from data in an array, like this...

     Declare an array list$(10,10). Then fill the array with your data...

          k%=1
          DO
           list$(k%)="Choice " + GEN$(k%,2)
           k%=k%+1
          UNTIL k%=10

     ..and then make a dCHOICE string from the array contents...

          k%=1
          listStr$=""
          DO
           listStr$=listStr$ + list$(k%) + ","
           k%=k%+1
          UNTIL k%=10

     ..then allow selection in a dCHOICE list...

        dINIT "Dialog title"
        dCHOICE n%,"Choose",LEFT$(listStr$,LEN(listStr$)-1)
        DIALOG

     ..then afterwards I can place the selected string in a dTEXT field...

        dINIT "Dialog title"
        dTEXT "Selected:",list$(n%)
        DIALOG

     Hope this helps, Jochen
      --
      Regards, Jochen @ Rotorua, New Zealand, 16/01/97 20:22


     Subj:  File creation date ->OPL         Section: Programming
       To:  Bob Munson, 106424,2412          26 January 1997 06:36:15
     From:  Jochen Siegenthaler, 100127,3167 #275741

     << And what about the rest of us?  If it is long, I understand but I was
     also interested. Even if I never need to use it.  >>

     It was around 6k, and I was trying to be nice to everyone (not everyone
     wants to downlod 6k of source code for something they're not interested
     in).

     However, I will post it here (as we are in  S19/Programming after all).

     Enjoy the code!
      --
      Regards, Jochen @ Zurich, Switzerland, 26/01/97 07:15

     (source code follows)

     PROC main:
      REM this lets you set the date and time stamp
      REM of a file
      LOCAL file$(128), buf%(100), off%(12)
      LOCAL date$(10), time$(12), name$(12)
      LOCAL date&, sc&, secs&
      LOCAL yr%, mo%, dy%, hr%, mn%, sc%, yrday%
      LOCAL ax%,bx%,cx%,dx%,si%,di%

      file$=LEFT$(PARSE$("\","\",off%()),off%(4)-1)+"*.*"
      DO
       dINIT "Set Date & Time Stamp"
       dFILE file$,"File:",0
       IF DIALOG=0
        BREAK
       ENDIF
       file$=file$+CHR$(0)

       DO
        ax%=$0800          REM set AX = 8 for "FileInfo" sub call
        bx%=ADDR(file$)+1  REM set BX = pointer to cstr file name
        cx%=ADDR(buf%())   REM set CX = pointer to 16 byte result buffer
        dx%=0              REM set DX = 0 (unused)
        si%=0              REM set SI = 0 (unused)
        di%=0              REM set DI = 0 (unused)
        OS($87,ADDR(ax%))  REM call Function
        IF ax%<>0 :RAISE ax% :ENDIF

        REM get date and time of file
        sc&=PEEKL(UADD(ADDR(buf%()),8))
        DT:(sc&, ADDR(date$), ADDR(time$))
        SECSTODATE sc&, yr%, mo%, dy%, hr%, mn%, sc%, yrday%
        date&=DAYS(dy%,mo%,yr%)
        secs&=hr%
        secs&=secs&*3600 + (mn%*60) + sc%

        REM get nice name format and seed off%()
        name$=PsiFile$:(PARSE$(file$,file$,off%()))

        dINIT "Set Date & Time Stamp"
        dTEXT "Path:",LEFT$(file$,off%(4)-1),0
        dTEXT "Name:", name$ ,0
        dTEXT "Size:",GEN$(PEEKL(UADD(ADDR(buf%()),4)),7) + " Bytes",0


        dTEXT "Date:",date$,0
        dTEXT "Time:",time$,$200
        dDATE date&,"New date:",0,50000
        dTIME secs&,"New time:",1,0,86399
        IF DIALOG=0
         BREAK
        ENDIF

        REM dDATE returns date since 1/1/1900,
        REM I need secs since 1/1/1970
        REM 1/1/1970-1/1/1900=25567 days
        sc&=((date&-25567)*INT(86400)) + secs&

        ax%=$1300          REM set AX = 13 for "FilSetFileDate" sub call 
                             rem bx is already set   
        bx%=ADDR(file$)+1    REM set BX = pointer to cstr file name
        cx%=PEEKW(ADDR(sc&)) REM set CX = pointer to low word of time
        si%=0                REM set SI = 0 (unused)
        di%=PEEKW(UADD(ADDR(sc&),2)) REM set DI = pointer to high word of time
        OS($87,ADDR(ax%))  REM call Function
        IF ax%<>0 :RAISE ax% :ENDIF

       UNTIL 0
      UNTIL 0 ENDP

     PROC DT:(sc&,date%,time%)
      REM Returns date and time from supplied sc&
      REM seconds in the current system format
      REM sc& = time in seconds
      REM date% = address of a date string, must be
      REM         at least 8 bytes long
      REM time% = address of a time string, must be
      REM         at least 6 bytes long
      LOCAL yr%, mo%, dy%, hr%, mn%, sc%(40),fpecific data:
      REM  Offset  0 (word): country code (e.g. UK i+ is ahead)
      REM  Offset  4 (byte): date format (0 = MDY, 1 =: time format (0 = am-pm, 1 = 24 hour)
      REM  Offset  6 (byte): currency symbol position (0 = before, 1 = after)
      Rce (0 = yes, 1 = no)
      REM  Offset  8 (byte): claces
      REM  Offset  9 (byte): currency negative format (0 = minus, 1 = brackets)
      REM , 1 = yes, 4 = 10000 and over) sOffset 14 (byte): time separator 24 (byte): start of week (0 = Mon,  Offset 25 (byte): summer times group (1 = Home, 2 = European, 4 = Northern, 8 = Southern)
      REM  Offset 26 (byte): clock= digital) Rbreviation (0 to 6)
      REM  Offset 28 (iys (the set bits indicate the workdays)
      REMM    Bit 4: Friday
      REM    Bit 5: Saturday
      REM= centimetres)

      REM get days etc f%())
      CALL($58B,buf%)

      REM set time
      sepuf%,14)))
      IF PEEKB(UADD(bu$:(hr%) + sep$ + cstr2$:(mn%) + sep$ + cstr2$:(sc%)
      ELSE
       REM 12 Hour am/pm
       REM get am/guage)
       regs%(1)=$1D00 REM M result buffer
       IF hr%>=12


        regfor pm
       ENDIF
       OS($8B,ADDR(regs%())ext
       POKEB ADD$

      ENDIF
      PEEKB(UA RN

      REM 1 = DMY
      DMY:: :POKE$ date%, cstr cstr4$:(yr%) + sep$ +
     cstr2$:(mo%RIGHT$("0"+GEN$(x%,10),2) ENDP

     PROC

     PROC PsiFile$:(f$)
      REM returns a Psion-e)+1,LEN(f$)-off%(4))) ENDP


     PROC MOD%:(a%,b%)
      REM Returns the remaa%/b%)*b% ENDP


     Subj:  Help button in dialogs           Section: Programming
       To:  ALL                              03 February 1997 23:43:04
     From:  Chris Hunter, 101714,2400        #277932

     I'm new to programming the Psion and am looking for help  - I can't find
     the answer in the programming manual.  I'm trying to detect if the HELP
     key is pressed in a dialog - the DIALOG function seems to return 0,
     similar to the escape key, and I don't seem to be able to detect the
     keypress with the KEY command.
     Can anyone come up with a method?

     Thank you (in anticipation)

     Chris Hunter


     Subj:  Help button in dialogs           Section: Programming
       To:  Chris Hunter, 101714,2400        04 February 1997 00:01:14
     From:  Ali Manson [Psion], 73733,32     #277943

     >Can anyone come up with a method?

     Nice pun (unintended I am sure) !

     Here you go. Looks ferocious but I'm sure that a couple of minutes spent
     looking at the code and running it will make clear how you can use this:

     #define O_GT_LAST_KEY  23

     /*  This method gets the last key processed by the system
         on behalf of the application  */

     PROC main:
             LOCAL   gate%  /*  Handle of the gate object  */
             LOCAL   c%  /*  Live variable fo rthe dCHOICE  */
             LOCAL   k%  /*  Variable to receive the key  */
             LOCAL   mods%  /*  Variable to receive modifiers  */
             LOCAL   pmods%  /*  Pointer to above  */

             dINIT "Test dialog"
             dCHOICE c%, "Choice", "No, Yes, Maybe"
             DIALOG  /*  Run the dialog  */

             gate% = PEEKW($38)  /*  Find the handle of the GATE object  */
             pmods% = ADDR(mods%)  /*  Point pmods% to the right place  */
             k% = ENTERSEND(gate%, O_GT_LAST_KEY, #pmods%)  /*  Send the message  */

             PRINT "Key was   =", k%
             PRINT "Mods were =", mods%
             GET

     ENDP

     The comments should be straightforward. The only other thing you need to
     know is that the modifiers written to 'pmods%' will be:

     2 for <Shift>
     4 for <Control>
     8 for <Psion>

     and these can be combined (i.e. <Psion><Shift><Help> will return 291 in
     k% and 10 in mods%)

     Bye, Ali

     Subj:  Wait for process to end          Section: Programming
       To:  All                              27 January 1997 11:46:10
     From:  Sean Legassick, 106620,154       #276102

     How do I wait for a process to end in OPL. I have the processes PID, but
     need to know what OS call will either pause until it has finished or
     check to see if it still lives.

      Cheers,
       Sean in Cape Town, South Africa on 27/01/97
      email: SeanLegassick@cyberjunkie.com


     Subj:  Wait for process to end          Section: Programming
       To:  Sean Legassick, 106620,154       27 January 1997 12:55:00
     From:  John Boyce (Sysop), 100014,1240  #276119

     Sean

     << How do I wait for a process to end in OPL.  >>

     You basically have to wait in a loop until the pid isn't current - there
     is no pause until method so you would have to use DO....UNTIL and use
     something like the OsProcNameById call until it returns an error.

     Best wishes
     John  (United Kingdom)


     Subj:  Wait for process to end          Section: Programming
       To:  Sean Legassick, 106620,154       28 January 1997 05:21:27
     From:  John Boyce (Sysop), 100014,1240  #276295

     Sean
      >> get hold of its pid by reverse translating a downloaded OPA.

     This won't give you the Pid - it is dynamically assigned by the
     operating system and will be different every time you run the program.

      >> could you give me a short code snippet.

     The call you want is done by this (assign the variables as necessary)

       ax%=$a00
       bx%=pid (you must already have this)
       di%=addr(buffer$)+1
       flag%=os($88,addr(ax%))
       if (flag% and 1)
          rem file not running any more
       endif

     This should help a little, don't forget to create all the ax%, bx%, cx%,
     dx%, si%, di% variables in one line otherwise you might crash something.

     Best wishes
     John  (United Kingdom)

     Subj:  Wait for process to end          Section: Programming
       To:  John Boyce (Sysop), 100014,1240  30 January 1997 13:47:26
     From:  Ali Manson [Psion], 73733,32     #276828

     >You basically have to wait in a loop until the pid isn't current

     I'd suggest that this is not a good approach as, apart from anything
     elese, it is not in keeping with Psion's 'classic' asynchronous event
     loop model.

     There is a C function called p_logona() which allows one to receive
     notification of a process termination asynchronously (i.e. the program
     control will continue even if the process you are logging on to has not
     yet completed).

     An OPL equivalent of this function, called PRLOGONA%: is described on
     page 4-25 of the OPL Library manual in the SIBO OPL SDK.

     I see debate of the value of the OPL SDK elsewhere and I'd suggest that
     access to this kind of information and already-written library functions
     makes the $100 SIBO OPL SDK well worth the money.

     All the best
     Ali


     Subj:  Fonts + Systemfonts              Section: Programming
       To:  K. BUNDIES, 106544,3676          11 February 1997 17:59:01
     From:  Ajai Khattri, 104127,3257        #279649

     You said:
     >I have installed Fonted and Setfont applications
     >and would like to know, whether anybody knows,
     >where I could find any *.fon files (converted
     >fonts) or how one can convert any interesting
     >fonts (from  PC programs?) to use them on the
     >Psion S3a. Thank you in advance, Klaus Bundies.

     There are one or two collections of fonts you can download. Try:

             ftp://ftp.nwt.com/s3a/graphics/

     There should be a file called fonts1.zip that contains a collection of
     font (.FON) files. There is also a shareware utility to convert Windows
     TrueType fonts to font source (.FSC) files floating about on the net
     somewhere. Check here or the London FTP site
     (ftp://src.doc.ic.ac.uk/pub/packages/psion/icdoc/).

     Regards,
     --
     Aj. (ajai@nwt.com)
     New World Technologies, Inc. - `the psion house'
     1 800 886-4967 (US) | http://www.nwt.com


     Subj:  Help - programming               Section: Programming
       To:  Don Harrison, 72046,31           08 February 1997 15:56:08
     From:  Jonathan S Forsyth, 100142,1665  #279047

     Don
     << MPG and/or MPL to two decimal places>>

     Multiply floating point variable by 100
     Convert to Integer variable
     Convert back to floating point variable 
     Divide by 100.

     It used to work in Basic, I've never tried it in OPL.

     Let me know if it works
     Jon, Leeds, UK


     Subj:  Help - programming               Section: Programming
       To:  Don Harrison, 72046,31           08 February 1997 16:29:26
     From:  Eitan Gilboa, 100135,2720        #279052

     Don,
     One solution is to use the FIX$ function of OPL which translates numbers
     to string, and takes 3 params: the value, number of decimals,& global
     length i.e. FIX$(12.345,2,5) will yield a strimg: 12.34.

     If you can, check this in the programming manual...as I am _far_ from
     mine at the moment.

      Best Wishes,
      Eitan (-USA-)    08-Feb-97 at 17:16:02 CET


     Subj:  Help wanted                      Section: Programming
       To:  Bastiaan Houtkooper, 72603,2142  16 February 1997 11:39:02
     From:  Jochen Siegenthaler, 100127,3167 #280560

     << . The free (working) memory, not the internal disk space.  >>

     Use this...

       mem&=CALL($80) REM SegFreeMemory
       mem&=mem&*16/1024 REM mem in K

     ..you must use a long integer (&). The CALL returns system memory in
     blocks of 16 bytes, so *16 will give free system memory in bytes. The

     << . The free disk space of the SSD the program is running on.  >>

     Let me look this up.....OK, found it.  You need FilStatusDevice (Fn $87, Sub $0A).

     Fn $87 Sub $0A
         AX: -> error code, zero indicates success
         BX: (cstr) device name (such as "A:" or "LOC::A:")
         CX: 64 byte buffer
         DX:
         SI:
         DI:
         CF: clear if device exists The buffer is filled in with information
     about the device:
       Offset  2 (byte): device type
         0 = unknown
         1 = floppy
         2 = hard disc
         3 = flash
         4 = ram
         5 = rom
         6 = write-protected
       Offset  3 (byte): device properties:
         Bit 3: formattable device
         Bit 4: dual density device
         Bit 5: internal device
         Bit 6: dynamically sizeable device
         Bit 7: compressible (worth compressing database files)
       Offset  4 (long): non-zero if the device contains removable media
       Offset  6 (long): total space on the device (may be wrong for M:)
       Offset 10 (long): free space on the device
       Offset 14 (cstr): volume name

     Use it like this:
      LOCAL buf%(32) REM result buffer, 64 bytes
      LOCAL dev$(10) REM device name

      dev$="LOC::A:"+CHR$(0)
      CALL($0a87,ADDR(dev$)+1,ADDR(buf%()))

      --
      Regards, Jochen @ Zurich, Switzerland, 16/02/97 11:21


     Subj:  Launching an APP...              Section: Programming
       To:  George Champlin, 74463,1520      15 February 1997 07:49:30
     From:  Jochen Siegenthaler, 100127,3167 #280371

     << Thanks, I need to launch an OPA from another OPA (\DIR\OPA2.OPA) >>

     OK, heres how.
     Launching a ROM based app:

      app$="OAgenda"+chr$(0) REM O means open
      ext$=".AGN "+chr$(0) REM extension of file
      fname$="LOC::M:\AGN\unzip.agn"+chr$(0) REM file to open
      prog$="ROM::AGENDA.APP"+chr$(0) REM name of program
      cmdl$=app$+ext$+fname$ REM command line
      ret%=CALL($0187,uadd(ADDR(prog$),1),ADDR(cmdl$),0,0,ADDR(myapp%)) REM FilExecute
      IF ret%<0
       dinit
       dtext"","Couldn't Launch App",$302
       dtext"",err$(err),2
       dbuttons "Continue",13
       dialog
      ELSE
       CALL($1a86,myapp%,0,0,0,ADDR(myword%)) REM p_logona
       CALL($0688,myapp%) REM activate app (ProcResume)
       giPRINT"App Launched"
      ENDIF

     The p_logona is optional: use it if you want to be notified when the ROM
     based app is closed. myapp% contains the process id of the app you
     launched.

     To kill the app, (which is an ungraceful way of ending the program)
     use...

     CALL(0888,myapp%) REM ProcKill

     ..or to be more graceful...

     CALL(0d88,myapp%) REM ProcTerminate

     ..which sends a termination message to the proc first.

     To launch MyApp.opa which uses a *.ggg file, use a similar method but
     you actually launch SYS$PRGO which is the program translator. This then
     loads myapp.opa, which in turn then loads the necessary file (in the
     following case file.ggg...

      app$="OMyApp"+chr$(0) REM O means open
      ext$=".GGG"+chr$(0) REM extension of file
      fname$="LOC::M:\GGG\file.ggg"+chr$(0) REM file to open
      prog$="ROM::SYS$PRGO"+chr$(0) REM name of program
      opaname$="LOC::\M\APP\myapp.opa" REM your opa file
      cmdl$=app$+ext$+fname$+opaname$ REM command line
      ret%=CALL($0187,uadd(ADDR(prog$),1),ADDR(cmdl$),0,0,ADDR(myapp%)) REM
     FilExecute

     You should always check ret% to see if an error was raised.

     Have fun,
      --
      Regards, Jochen @ Zurich, Switzerland, 15/02/97 08:47


     Subj:  Launching an APP...              Section: Programming
       To:  Jochen Siegenthaler, 100127,3167 16 February 1997 03:17:19
     From:  alan richey, 100023,543          #280507

     Hi Jochen

     >>>>Launching a ROM based app:

      app$="OAgenda"+chr$(0) REM O means open
      ext$=".AGN "+chr$(0) REM extension of file
      fname$="LOC::M:\AGN\unzip.agn"+chr$(0) REM file to open
      prog$="ROM::AGENDA.APP"+chr$(0) REM name of program
      cmdl$=app$+ext$+fname$ REM command line
      ret%=CALL($0187,uadd(ADDR(prog$),1),ADDR(cmdl$),0,0,ADDR(myapp%)) REM FilExecute

     I've been using code similar to this in my programs, and while it works
     OK with WORD, AGENDA & DATA, I cannot get it to work with SHEET.  Is
     there something special about that APP ?

     Cheers
     Al

     Subj:  Launching an APP...              Section: Programming
       To:  alan richey, 100023,543          16 February 1997 11:38:15
     From:  Jochen Siegenthaler, 100127,3167 #280558

     << it works OK with WORD, AGENDA & DATA, I cannot get it to work with
     SHEET.  Is there something special about that APP ? >>

     Yep. The app program name is ROM::SH3.APP
      --
      Regards, Jochen @ Zurich, Switzerland, 16/02/97 10:46


     Subj:  Launching an APP...              Section: Programming
       To:  George Champlin, 74463,1520      17 February 1997 20:41:08
     From:  Jochen Siegenthaler, 100127,3167 #280886

     << I'm launching an OPA that doesn't open any files on startup.  I've
     yet to get this to work, perhaps I've missed something simple, what
     changes would need to be made in this case?  >>

     Simply leave out the extension and the data file. Make sure the CHR$(0)
     is still in place though (you actually pass a 0-length string).

     For more info, get hold of the Psionics files, which is where I got all
     this from.
      --
      Regards, Jochen @ Warsaw, Poland, 17/02/97 18:41


     Subj:  Dialogs                          Section: Programming
       To:  Ali Manson [Psion], 73733,32     17 February 1997 20:43:20
     From:  Jochen Siegenthaler, 100127,3167 #280889

     << Looks ferocious but I'm sure that a couple of minutes spent looking
     at the code and running it will make clear how you can use this:  >>

     Umm, I have managed to reduce it down to...

       lastkey%=SEND(PEEKW($38),23,lstkmod%)

     ..to get the lastkey% and the l(a)stkmod(ifier)%

     Much less painfull than the full-blown C code!!


     Subj:  Dialogs                          Section: Programming
       To:  John & Isobel Bunting, 74532,255418 February 1997 21:18:15
     From:  Jochen Siegenthaler, 100127,3167 #281190

     << I am trying to find out if the keys can be re-configured so that the
     help button can have the same effect as the enter button.  >>

     Sort of - do this...

      dINIT
      ...dialog contents etc...
      ret%=ChkHelp%:(DIALOG)
      IF ret%=13
       REM user hit Enter
      ELSEIF ret%=291
       REM user hit Help
      ELSEIF ret%=27
       REM user hit Esc
      ELSEIF ret%=27
       REM user hit Esc
      ENDIF

     ..and modify the ChkHelp%: procedure so that it returns the key code...

      PROC ChkHelp%:(k%)
      LOCAL key%, etc

      REM at the end of the PROC add this...
      RETURN key%
      ENDP

     If you want to show the dialog again after Help was shown do this...

      DO
       dINIT
       REM ...dialog contents etc
       ret%=ChkHelp%:(DIALOG)
       IF ret%=13
       (etc etc)
      UNTIL ret%<>291

     ..which will loop the DO-UNTIL until the user presses any key other than
     Help.

     However, as Help and Esc both exit the dialog without storing any
     selected values, it is not possible to retain any changes made by the
     user before he pressed the help key.

     Note that in standard Psion apps, the Help key will exit a Menu, but
     will not exit a Dialog, thus the DO-UNTIL method shown above is as close
     as you can get the Help feature to a standard Psion app using OPL.

     One last note: to show the Help:Index from OPL, use -112 as the page
     number.

     Have fun with help!
      --
      Regards, Jochen @ Warsaw, Poland, 18/02/97 17:17


     Subj:  Dialogs                          Section: Programming
       To:  John & Isobel Bunting, 74532,255417 February 1997 20:43:27
     From:  Jochen Siegenthaler, 100127,3167 #280887

     << What code do I use to trap the key stokes so that the dialogue can be
     completed and yet if the HELP key (201) is pressed, the HELP: procedure
     is called ?  >>

      I use this...

      dINIT
      ...etc etc...
      ChkHelp%:(DIALOG)

     And then I have a ChkHelp PROC that goes essentially like this...

      PROC ChkHelp:(k%)
      LOCAL key%,kmod%
      key%=k%

      REM if key% is 0, check the last key pressed
      IF key%=0
       key%=SEND(PEEKW($38),23,kmod%) REM check last key and kmod
      ENDIF

      IF key%=291
       REM Help etc
      ENDIF
      --
      Regards, Jochen @ Warsaw, Poland, 17/02/97 19:08

