Hey, just a few questions about arrow keys and doing the menu thing where it "highlights" a selection...
To use the arrow keys which are extended ASCII, I use this function:
FUNCTION keyread:integer;
VAR
value:integer;
BEGIN
value := ord(upcase(readkey));
IF value = 0 THEN
value := ord(readkey) + 300;
keyread := value;
END;
This works, however, I have to press the key twice before I get a result. I cant think of why it does this nor can I work out how to get rid of it =(
Do you guys use any other function to retrieve extended ASCII that works when you press the key once? lol
OK, so with that - and I guess every othe function with the same purpose - the arrow keys are 372: Up and 380: Down.
In a CASE keyread OF <value> I have an IF.
IF y > (highest menu positon) THEN
BEGIN
y = y + 1
item = item - 1
bgcolor : white
text : black
gotoxy(x{set},y)
writeln(array[item])
...
That displays the highlighted item from the array "on top" of the one that wasnt highlighted.
...
bgcolor(black)
text(white)
gotoxy(x,y-1)
writeln(array[item-1])
END
So that *should* write the previous selection in the "normal" colors, though it doesnt work 100% I really dont know why, If it can work once it can work twice right? lol wrong! =S
Of course, the down IF has y - 1 and item + 1 etc.
Besides it not working all the time, there is no way with that method to highlight the 1st item then clear it. Same with the last item. Again, I dont understand why. In theory that should work.
It could just be my tempramental Turbo Pascal (7.1) but Im not sure.
So there's the second plea: Highlighting techniques.
Sorry to be greedy just I dip in to this area of design occasionally and over a period of two years Ive still yet to come up with a solution that works! Yes, I am slow =P
Thanks for your time
~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
To use the arrow keys which are extended ASCII, I use this function:
FUNCTION keyread:integer;
VAR
value:integer;
BEGIN
value := ord(upcase(readkey));
IF value = 0 THEN
value := ord(readkey) + 300;
keyread := value;
END;
This works, however, I have to press the key twice before I get a result. I cant think of why it does this nor can I work out how to get rid of it =(
Do you guys use any other function to retrieve extended ASCII that works when you press the key once? lol
OK, so with that - and I guess every othe function with the same purpose - the arrow keys are 372: Up and 380: Down.
In a CASE keyread OF <value> I have an IF.
IF y > (highest menu positon) THEN
BEGIN
y = y + 1
item = item - 1
bgcolor : white
text : black
gotoxy(x{set},y)
writeln(array[item])
...
That displays the highlighted item from the array "on top" of the one that wasnt highlighted.
...
bgcolor(black)
text(white)
gotoxy(x,y-1)
writeln(array[item-1])
END
So that *should* write the previous selection in the "normal" colors, though it doesnt work 100% I really dont know why, If it can work once it can work twice right? lol wrong! =S
Of course, the down IF has y - 1 and item + 1 etc.
Besides it not working all the time, there is no way with that method to highlight the 1st item then clear it. Same with the last item. Again, I dont understand why. In theory that should work.
It could just be my tempramental Turbo Pascal (7.1) but Im not sure.
So there's the second plea: Highlighting techniques.
Sorry to be greedy just I dip in to this area of design occasionally and over a period of two years Ive still yet to come up with a solution that works! Yes, I am slow =P
Thanks for your time
~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."