APPLICATIONSDIVERS ★ MENU UTILITY ★

Menu Utility (The Amstrad User)Applications Divers
★ 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 all inputs were uppercase - this was easy with A$=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 ★

Aucun fichier de disponible:
» Vous avez des fichiers que nous ne possédons pas concernent cette page ?
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Applications » Permutations (Computing with the Amstrad)
» Applications » Char.RSX (CPC Magazin)
» Applications » WACCI PD Disc #68 - Amsdos - Utilities Disc 3
» Applications » Biorythme
» Applications » Screen Dump for KDS 8 bit printer port (Computing with the Amstrad)
» Applications » Odzyskiwanie Plików Skasowanych Omyłkowo na Dyskietce (Bajtek)
Je participe au site:
» Pour ce titre nous ne disposons de fichier executable sur CPC (Dump, Saisie du listing) , alors si vous avez ça dans vos cartons ou vous désirez usé vos petit doigts boudinés sur votre clavier faites le nous savoir.
» Vous avez des infos personnel ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 390 millisecondes et consultée 1737 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.