The PSION Organiser II Homepage
Forum Home Forum Home Help Help Search Search Members Members Login Login Register Register

Welcome, Guest. Please Login or Register.
Why register?
   The Psion Organiser II Forum
   User Forum
   Help
(Moderator: Mikesan)
   Disp or View without keypress??
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Disp or View without keypress??  (Read 515 times)
UnrealNeil
Member




   


Posts: 19
Disp or View without keypress??
« on: Apr 12th, 2003, 12:43pm »
Quote Quote Modify Modify

I want to display a MenuN and wait for a keypress, but also want to have a scrolling message on line 3 (LZ64)
However that means I have to have a keypress to stop the scroll and a keypress to make the menu choice?
 
m%=VIEW(3,"Plug in COMMSLink and Boot")
m%=MENUN(1,"Add,Overite,Send2PC,Boot,Quit")
Causes the message to display without the menu and  
 
m%=MENUN(1,"Add,Overite,Send2PC,Boot,Quit")
m%=VIEW(3,"Plug in COMMSLink and Boot")
causes the menu to be displayed without the message...
 
Is their any hope for me?
 
[Add Overite Send2PC ]Boot Quit
[---------------------]
[Plug in COMMSLink no]w and select Boot from the Menu
 
Thanks
Boris
Administrator




   
WWW

Posts: 552
Re: Disp or View without keypress??
« Reply #1 on: Apr 12th, 2003, 7:19pm »
Quote Quote Modify Modify

The organiser II was built at a time when multitasking was reserved to mainframe computers as big as a lorry  
 
The answer is NO, you can't have a scrolling line and a menu at the same time.
You may put a fake menu on top and use VIEW, but thats not quite the same (no selecting with left/right) and you have to select the menu item depending on the return value of VIEW.

Triholerahduliäöhh gugguh !! (tyrolean joy jodler)
Rough translation: There's a new build of Psi2Win!!
Email: boris[at]psion2[dot]org
UnrealNeil
Member




   


Posts: 19
Re: Disp or View without keypress??
« Reply #2 on: Apr 16th, 2003, 10:50am »
Quote Quote Modify Modify

thanks, I feared as much
Zac Schroff
Power Member




   
WWW

Posts: 81
Re: Disp or View without keypress??
« Reply #3 on: Apr 17th, 2003, 7:41pm »
Quote Quote Modify Modify

You *could* write on yourself.
 
It should not be too hard : do a negative delay (waits for time or keypress) and update the scrolling line on return from that.  If the result was a keypress, handle the menu appropriately.  If the keypress was enter, return from the menu; if not, loop.

Tact is for those who are not witty enough to be sarcastic.
Zac Schroff
Power Member




   
WWW

Posts: 81
Re: Disp or View without keypress??
« Reply #4 on: Apr 18th, 2003, 6:25pm »
Quote Quote Modify Modify

Unfortunately, it's actually longer than the app for which I think you wanted it.
 
Menu and scroller at once.    Just thrown together in a short while last night as an experiment.  This behaves essentially as the OPL menu commands, plus scrolls a message at the same time.  You set up the screen beforehand (separators &c) and then call it.  The function will handle varaible length messages (1 through 255 characters) and similar for menus.  Menus and messages which are shorter than 21 characters are not scrolled.  Not tested with zero byte messages/menus.  It also cleanly handles menu items which are too big for the line.
 
However, it would be possible to code it in assembly / machine, and it would actually run a bit faster (it 'feels' a bit sluggish) and perhaps not use as much memory (it requires about 280 bytes of data space plus the overhead for the code).  Some variables are included only for performance boost, and could be removed if that is not an issue.  I don't have time to work it out in asm, but would appreciate a copy of the code from anybody who actually does it.
 
It could likely be optimised for a particular purpose and made a bit faster / smaller in OPL, as it is not particularly optimised.  Even a few parts could be moved to asm for major performance boost.
 
mnuline% is the line on which the menu is to appear.
 
mnu$ is the menu string (format as per menu commands; preserves all case but first character of each item which is forced to caps).
 
mnuadd% is the address of the menu string passed in.  It's here for efficiency (otherwise it would require a local copy of the unmodified menu string, requiring an additional 256 bytes of memory to run.
 
msgline% is the line on which the message is to be displayed.
 
msg$ is the message to display.
 
returns 0 for escape/mode, current menu selection for exe.
 
MENUSCR%mnuline%,mnu$,mnuadd%,msgline%,msg$)
  local menu$(255)
  local mnuoff%,seloff%,msgoff%
  local k%,hsd%,tmp%,f%,ma%,mb%,k$(1)
  menu$=mnu$
  k%=len(menu$)
  tmp%=addr(menu$)
  ma%=mnuadd%+1
  mb%=mnuadd%-1
  mnuoff%=1
  if (len(msg$)<=20)
    msgoff%=20
  else
    msgoff%=1
  endif
  hsd%=peekw($0069)
  seloff%=1
  pokeb addr(menu$)+1,asc(upper$(left$(menu$,1)))
  while (k%>0)
    if (peekb(tmp%+k%)=%,)
 pokeb(tmp%+k%),32
 if (k%<len(menu$))
   pokeb tmp%+k%+1,asc(upper$(chr$(peekb(tmp%+k%+1))))
 endif
    endif
    k%=k%-1
  endwh
  at 1,mnuline%
  print rept$(" ",20);
  at 1,msgline%
  print rept$(" ",20);
  if (len(msg$)<21)
    at 1,msgline%
    print msg$;
  endif
  do
getmenu::
    if (len(mnu$)>20)
 at 1,mnuline%
 print mid$(menu$,mnuoff%,20);
    endif
    if (len(msg$)>20)
 at 1,msgline%
 if (msgoff%<20)
   print " ";
   at 21-msgoff%,msgline%
   print left$(msg$,msgoff%);
 else
   print mid$(msg$,msgoff%-19,20);
 endif
 if (msgoff%>len(msg$))
   print " ";
 endif
 msgoff%=msgoff%+1
 if (msgoff%>(len(msg$)+19))
   msgoff%=1
 endif
    endif
    at seloff%-mnuoff%+1,mnuline%
    cursor on
    pause -hsd%
    k%=key
    k%=asc(upper$(chr$(k%)))
    cursor off
    if (k%=3)
 rem move up
 seloff%=1
 goto chkpos::
    elseif (k%=4)
 rem move down
 seloff%=1
 k%=5
 goto moveleft::
    elseif (k%=5)
 rem move left
moveleft::
 do
   seloff%=seloff%-1
   if (seloff%<=0)
     seloff%=len(mnu$)
   elseif (seloff%=1)
     k%=-5
   elseif (peekb(mb%+seloff%)=%,)
     k%=-5
   endif
 until (k%<>5)
 goto chkpos::
    elseif (k%=6)
 rem move right
 do
   seloff%=seloff%+1
   if (seloff%>len(mnu$))
     seloff%=1
     k%=-6
   elseif (peekb(mb%+seloff%)=%,)
     k%=-6
   endif
 until (k%<>6)
 goto chkpos::
    elseif (((k%>=%A) and (k%<=%Z)) or ((k%>=%0) and (k%<=%9)))
 tmp%=seloff%
 k$=chr$(k%)
 do
   f%=0
   do
     tmp%=tmp%+1
     if (tmp%>len(mnu$))
  tmp%=1
  f%=1
     elseif (peekb(mb%+tmp%)=%,)
  f%=1
     endif
   until (f%<>0)
   if ((tmp%=seloff%) or (k%=peekb(addr(menu$)+tmp%)))
     k%=-7
   endif
 until k%=-7
 seloff%=tmp%
 goto chkpos::
    endif
  until (k%=13) or (k%=1) or (k%=2)
  if (k%=13)
    k%=1
    tmp%=1
    while (k%<seloff%)
 if (peekb(ma%+k%)=%,)
   tmp%=tmp%+1
 endif
 k%=k%+1
    endwh
    return tmp%
  else
    return 0
  endif
chkpos::
  tmp%=seloff%
  while ((tmp%<len(mnu$)) and (peekb(mnuadd%+tmp%)<>%,))
    tmp%=tmp%+1
  endwh
  if (tmp%<len(mnu$))
    tmp%=tmp%-1
  endif
  if (mnuoff%<(tmp%-19))
    mnuoff%=tmp%-19
  endif
  if (mnuoff%<1)
    mnuoff%=1
  endif
  if (seloff%<mnuoff%)
    mnuoff%=seloff%
  endif
  goto getmenu::

Tact is for those who are not witty enough to be sarcastic.
Zac Schroff
Power Member




   
WWW

Posts: 81
Re: Disp or View without keypress??
« Reply #5 on: Apr 18th, 2003, 6:29pm »
Quote Quote Modify Modify

The smiley at the beginning of the above program should be a colon followed by an open parenthesis, not a smiley.  Oops.  :-b
 
And a demo program to show it off a little...
 
TESTMENU:
  local mnu$(255)
  local msg$(255)
  local k%
  mnu$="this,is,a,test,does,the,menu,work,properly,and,as,expected"
  msg$="scrolling message should continue moving while selection is being made"
  k%=0
  at 1,2
  print "--------------------";
  at 1,4
  print "====================";
  k%=menuscr%:(1,mnu$,addr(mnu$),3,msg$)
  at 1,4
  print "selection =",k%
  get

Tact is for those who are not witty enough to be sarcastic.
UnrealNeil
Member




   


Posts: 19
Re: Disp or View without keypress??
« Reply #6 on: Apr 26th, 2003, 10:57am »
Quote Quote Modify Modify

He he he, I can't beleive you actually did that....
Yes it's much bigger than my whole app.  Still it does show that it can be done.
 
Thank You
Well DOne
 
Zac Schroff
Power Member




   
WWW

Posts: 81
Re: Disp or View without keypress??
« Reply #7 on: Apr 28th, 2003, 9:10pm »
Quote Quote Modify Modify

Just wait until I'm really bored and do it in ML.  

Tact is for those who are not witty enough to be sarcastic.
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

The Psion Organiser II Forum » Powered by YaBB 1 Gold - SP 1.1!
YaBB © 2000-2002,
Xnull. All Rights Reserved.
top