APPLICATIONSDIVERS ★ MENU UTILITY ★

Intelligence Menu|The Amstrad User)Menu Utility|The Amstrad User)
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

The following two modules can be used whenever you need a menu for any program. They evolved because I am currently writing business application packages. I wanted all any menus to have only alpha-key selection, as I dislike saving menus with 1, 2, 3 etc.

I wanted to be able to use the command "ON A GOSUB 1000, 2000, 3000 " etc. but this only works with numeric inputs. So the problem was that I needed to convert alpha inputs to numeric codes. Hence the line A-(ASC(A$)-64, lis converts alpha inputs to numeric inputs..

The ASCII code for Capital A is 65, so when you hit "A" le program takes it as 65, subtracts 64 and leaves it as 1, input B as 2 etc.

I had to ensure that ail inputs were uppercase - this was easy with AS=UPPER$(A$). With that problem solved, I wanted the cursor flashing on-screen when waiting for an input. This was solved with a simple little sub-routine which locates where you want the cursor to appear, prints the cursor, drops to the delay sub-routine, returns, prints CHR$(8) which brings the print position back one space en prints CHR$(16) which blanks out the cursor, the program then drops to the delay sub-routine again, and turns to the line that starts the process over again, The line IF A$<>"" THEN RETURN, ensures that the subb-routine keeps looping until an input is detected. When a input is detected it returns to the routine that handles the put.

I have written three routines (two are presented in this article), "MENU/10" for MODE 1 with a menu for 10 options. The next "MENU/13" for MODE 2 with a menu for 13 options. I've included quite a few REM statements to hopefully explain what is happening throughout.

I have set myself up with a complete bank of these routines, when I need a menu with anything from 2 to 20 options I just MERGE them from tape, (soon to be disk).

I have used CHR$(224) for my cursor, I plan on using this cursor as a feature of all my packages so 1 would appreciate it if other writers choose another character. I hope someone can use these little routines, I enjoyed writing them a great deal. I am still refining them as I am trying to get the response delay a little shorter, maybe someone else has got some ideas.

By the way, I didn't invent the flashing cursor sub-routine, part of it came from "AMSTRAD COMPUTING" by Ian Sinclair. This is a top book, I cannot recommend it highly enough.

NOTES

  1. When modifying these routines for your own programs you can either add or delete the option lines, depending on the number of options you need. Where I have "OPTION 1" etc. you can just type in what your options are.
  2. In the line IF A12, just change the last number to the number of options your menu has. This ensures that the program only recognises input within the menu limits.
  3. The "Quit" option always returns to MODE 2,1 did this so during development I could list more on the screens.
I haven't included a commentary, I think the REM statements in each listing will suffice. If you have more than one menu in a program you could use the same flashing cursor sub-routine, as long as you want the cursor at the same co-ordinates each time.

TAU

★ PUBLISHER: The Amstrad User (Australia)
★ YEAR: 1985
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LICENCE: LISTING
★ AUTHOR: REUBEN CARLSEN

★ AMSTRAD CPC ★ DOWNLOAD ★

Je participe au site:
» Newfile(s) upload/Envoye de fichier(s)
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Applications » Screen Compress (Amstrad Computer User)
» Applications » RSX - Tort
» Applications » Architek v7.2
» Applications » Compilation : Demon PD - PD 49 - Demos #8
» Applications » PowerSpell
» Applications » Amstitre (Microstrad)

QUE DIT LA LOI FRANÇAISE:

L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!

CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 203 millisecondes et consultée 804 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.