Capturing the UP Arrow Key Part 2


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Capturing the UP Arrow Key Part 2

  1. #1
    Join Date
    Apr 2009
    Location
    Singapore
    Posts
    13

    Unhappy Capturing the UP Arrow Key Part 2

    Dear all,

    I had posted the working codes needed to capture UP and DOWN arrow keys in the environment of using HyperTerminal VT100, TTY,etc working with Rabbit Microcontroller.

    The next issue I face now is:

    When I pressed an UP or DOWN arrow. The cursor moved one line up, the more you press, the more lines cursor will move up to.

    I placed a dummy code of displaying "This is UP ARROW" whenever an UP arrow is being pressed.

    This sentence will appear one line above my current cursor position.

    But this is not what I wanted, I wanted the UP arrow to serve as a page up page down of previously entered commands.

    Anyone has ideas on this please?

    Thanks so much!

  2. #2
    Join Date
    Dec 2007
    Posts
    401
    keep a history of the commands entered by the user. for example:
    Code:
    std::deque< std::string > command_history ;
    for every command entered by the user,
    Code:
    command_history.push_back( cmd_string ) ;
    if you want to limit the number of commands held in the history, also do something like
    Code:
    if( command_history.size() > MAX_SIZE ) command_history.pop_front() ;
    iterate over command history to support the usage of up-arrow and down-arrow to repeat previous commands.

Similar Threads

  1. Capturing the UP Arrow Key
    By liboc in forum C++
    Replies: 6
    Last Post: 04-23-2009, 05:41 AM
  2. Help: Shorcut key for a commandbutton
    By craver06 in forum VB Classic
    Replies: 10
    Last Post: 02-06-2008, 12:12 PM
  3. Replies: 0
    Last Post: 09-21-2006, 08:19 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center