I'm trying to implement a command-line interface inside of a Windows Forms form. I've looked into PDCurses, but I'm not sure if that's where I want to be. What should I do?
-
2You want a console window INSIDE a windows form or just say textboxes set up to display and intput to a cmd shell or simply a separate window?Blam– Blam2010-10-13 22:21:21 +00:00Commented Oct 13, 2010 at 22:21
-
yes, that is correct, INSIDE. And I want it formatted, colors, positioning, etc..Dalton Conley– Dalton Conley2010-10-13 22:33:37 +00:00Commented Oct 13, 2010 at 22:33
Add a comment
|
1 Answer
There are two basic approaches, though I'm not sure which goal you're aiming for:
If you want to have an actual command window inside your app:
- Create a text box. Let them type whatever they want.
- When the user hits ENTER, read the current line and use the System.Diagnostic.Process classes to execute that line and retrieve the resulting text.
- Display the resulting text in your textbox.
- Optional: Prevent the textbox from getting too large by throwing away lines from the top when it gets too big.
If you want to simply create a custom command-processing window:
- Find a way to parse the input and provide syntax errors.
- Create an object model that corresponds to the features your app will make available to your console.
- Connect the parser/interpreter to your object model.