Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   console app with wxWidgets (http://www.programmingforums.org/showthread.php?t=13903)

rwm Sep 3rd, 2007 10:45 AM

console app with wxWidgets
 
Hey!

Well, i've decided the best way to learn wxWidgets is to write a test application. So i've decided to write a console app... Not quite sure what i'm gonna do next, but this is how far i've gotten:

http://www.forumsigs.com/img.cfm?img=11108

Might add functionality so the user can type commands in and get something out... I don't know?

Any suggestions as to what I should put in? Make my life hard!

:D

I probably wont keep this up for long, but who knows!

Good practice!!! :D

Game_Ender Sep 3rd, 2007 8:08 PM

What do you mean by "console app", do you mean you wish to make a Terminal Emulator? I have thought about making one, but I have never been able to figure out/find all the documentation for terminal control codes.

Here is a goal for you:
* Be able to start and talk to a simple C/C++ application that takes input from stdin and prints stuff to stdout.
* Be able to run a curses based application

Game_Ender Sep 3rd, 2007 8:09 PM

Basically copy Terminal.app or Gnome Terminal but be cross platform with wxWidgets.

DaWei Sep 3rd, 2007 8:33 PM

Terminal codes used to vary widely, though there were a number of standard ones. Once terminals were built to respond to escape sequences, things became much more standardized. If you can find the information behind the old ANSI.SYS, you'll probably be in tall cotton.

Otherwise, building a shell isn't really that difficult. You can build in some commands and handle others by launching appropriate executables.

Giving it the ability to pipe will be dependent upon the underlying OS, though, generally.

rwm Sep 4th, 2007 3:22 AM

Thanks guys! Will start working on this! Be slow going since i'm doing R&D for a feature film at the moment! Gonna be a giant pain in the ass!

Will post as soon as I have something more to show!

:D

lectricpharaoh Sep 4th, 2007 6:00 AM

@Game_Ender: To expand on DaWei's post, if you're looking for ANSI escape sequences, google for NNANSI. It's an old DOS replacement for ANSI.SYS, and included in the documentation is a list of codes. If you can't find it, I have the list kicking around somewhere, I believe.

I also might have a list of VT52 codes as well, but no guarantees there.

rwm Sep 4th, 2007 6:36 AM

Coolio!

Just been looking at it, it's gonna be hard since i have no experience with widgets... Need to read up event stuff etc

But the sample apps included are helpful!

:)

rwm Sep 4th, 2007 9:44 AM

Well, been dicking around with wxKeyEvent and wxTextCtrl...

So far just doing simple tests, got a rudimentary "expression" evaluator up and running, its just plain silly, but just testing you know!

It works something like:

:

void MainFrame::OnKey(wxKeyEvent &event)
{
    char ch = event.GetKeyCode();
    switch(ch)
    {
        case WXK_RETURN:
        {
            command.Eval();
            textCtrl->Append("\n"); //move to newline
            return;
        }
    }
    //append the char input to command and textCtrl
    command.Append(ch);
    textCtrl->Append(ch);
}


Where command is a class type Command, which reads in a command string "expression string" and parses it on request (Command::Eval()) - which then performs the appropriate action...

But it works at least!

So, I'm now trying to figure out how to get the prompt line, still trying to find out how to start std input into the textCtrl...

Anyways, back to this! I've already learnt quite a bit about wxWidgets thus far!

:D


All times are GMT -5. The time now is 9:44 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC