like ppe on pcboard based bbs 
Author Message
 like ppe on pcboard based bbs

Hello,
Anybody could tell me how to make a selection on a menu like the ppe on
a pcboard based bbs for those who know this style of bbs !
otherwise I would like to have the source of a program who can do in a
menu some selection

example :
MENU
1.print file
2.edit file
3.update file
4.erase file
5.quit

so, you see the menu, but i don't want to type the number of what I want
but i prefer move a lightbar on the option with the down and up arrow
keys and select with enter !
Could you please say me how to do this ?
Sorry for my bad english, I hope everybody have understood ?
Cya
--

         /)           Florky           (\

      _( (_    _                  _    _) )_  
     (((\ \>  /_>                <_\  </ /)))  
     (\\\\ \_/ /                  \ \_/ ////)
      \       /                    \       /  
       \    _/                      \_    /      
       /   /                          \   \      
      /   / http://www.*-*-*.com/ ~PING7699\   \



Wed, 18 Jun 1902 08:00:00 GMT  
 like ppe on pcboard based bbs

Quote:

>so, you see the menu, but i don't want to type the number of what I want
>but i prefer move a lightbar on the option with the down and up arrow
>keys and select with enter !
>Could you please say me how to do this ?

This should do the trick

Program Menu;
 Uses
  Crt;

Const
  MenuChoice : Array[1..5] of String[9] = ('Choice #1', 'Choice #2',
                                            'Choice #3', 'Choice #4'
                                            , 'Choice #5');
  MenuPosX = 10;  MenuPosY = 10;
  NumberChoices = 5;

Type
  keys = (ReturnKey,Up,Down,Escape);

Var
  Key : keys;
  fk : Boolean;
  ch : Char;
  x, y, CurrentChoice : Integer;

Procedure SetChoiceColor(back,Fore : Integer);
begin
  TextBackGround(back);
  TextColor(Fore);
end;

Procedure GetKey;
begin
  fk := False;
  ch := ReadKey;
  if ch = #0 then
    begin
      fk := True;
      ch := ReadKey;
    end;
  if fk then
    begin
      Case ord(ch) of
        72 : key := Up;
        80 : key := Down;
      end; end;
      if not fk then
        begin
          Case ord(ch) of
            13 : key := ReturnKey;
            27 : key := Escape;
          end;
        end;
    end;

begin
  SetChoiceColor(7,0);                  {.. reverse vid black on white

Quote:
}

  For x := 1 to NumberChoices do
    begin                               {.. Write menu options }
      GotoXY(MenuPosX,MenuPosY+x-1);
      if x > 1 then SetChoiceColor(0,7);  {..turn reverse off after }
        Write(MenuChoice[x]);               {  first option written
Quote:
}

    end;
  GotoXY(MenuPosX,MenuPosY);            {..position curosr on 1st
option }
  CurrentChoice := 1;

  Repeat
    GetKey;                               {..wait For a key to be
pressed }
    SetChoiceColor(0,7);                  {..reverse vid white on
black }
    Write(MenuChoice[CurrentChoice]);     {..un-highlight current
option }

    Case key of
      Up   : if CurrentChoice > 1 then dec(CurrentChoice)
               else CurrentChoice := NumberChoices;
      Down : if CurrentChoice < 5 then inc(CurrentChoice)
               else CurrentChoice := 1;
      end;

    SetChoiceColor(7,0);                        {..reverse vid
black/white }
    GotoXY(MenuPosX,MenuPosY+CurrentChoice-1);
    Write(MenuChoice[CurrentChoice]);           {..highlight new
option }
    GotoXY(MenuPosX,MenuPosY+CurrentChoice-1);
    Until (Key = ReturnKey) or (Key = Escape);

    SetChoiceColor(0,7);

    Case CurrentChoice of
      1 : Writeln('Helloo 1');
    end;

end.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. BBS Message Base Source

2. Base 10/Base 2 or Base 2/Base 10 conversion

3. What to do if you liked TCursors???

4. Pascal and PCBoard files

5. Req: PcBoard @X## display routines for TP7

6. Req: PCBoard @X## Display routines!

7. : tsbase13.zip Programmer's tools base: base, basecalc, scancode

8. tsbase13.zip Programmer's tools base: base, basecalc, scancode

9. base 10 to base 2

10. Programmer's BBS

11. Toronto CDAT BBS has moved

12. REQ: BBS uttils

 

 
Powered by phpBB® Forum Software