LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Command Line Interface Emulator

Hi All,

 

I want a String Control on my Front Panel to emulate the behavior of a command line interface.

 

Some features might include:

- ability to cycle through previous commands using 'up' and 'down' arrow keys

- prevention of cursor moving further back than the most recent prompt

- pressing 'Enter' sends the user-entered text after the most recent prompt for processing (e.g. enqueues it for consumption by a parallel loop), and displays reponse when ready, before displaying the subsequent prompt

 

I have a few ideas about the best / cleanest way of implementing this, but it would be good to hear any suggestions.

 

Thanks!

Dan
CLD
0 Kudos
Message 1 of 3
(2,793 Views)

I'd just make an event case with both the "Key Down" and "Key Repeat" events. Store the previous commands array in the shift register.

 

VKey "Left" goes past prompt?  Wire "T" into "Discard?".  Up key?  Index previous commands array, write to value ... etc.

Message 2 of 3
(2,781 Views)

Hello,

 

I would suggest using a string indicator to prevent character insertion anywhere but the end of the string buffer. You'll use the key events to maintain a string array in a while loop that updates the indicator after various key events. Add a new end-of-line and prompt string array element when the "Return" key is detected. Discard further event processing as appropriate for certain keys. Here's a possible starting point:

Terminal.png

Feel free. Contact me for anything more,
    Pang

You too can be LabVIEW Awesome!
Message 3 of 3
(2,721 Views)