Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 3rd, 2007, 10:45 AM   #1
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2 rwm is on a distinguished road
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:



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!



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

Good practice!!!
rwm is offline   Reply With Quote
Old Sep 3rd, 2007, 8:08 PM   #2
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
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
__________________
Robotics @ Maryland AUV Team - Software Lead
Game_Ender is offline   Reply With Quote
Old Sep 3rd, 2007, 8:09 PM   #3
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
Basically copy Terminal.app or Gnome Terminal but be cross platform with wxWidgets.
__________________
Robotics @ Maryland AUV Team - Software Lead
Game_Ender is offline   Reply With Quote
Old Sep 3rd, 2007, 8:33 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Sep 4th, 2007, 3:22 AM   #5
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2 rwm is on a distinguished road
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!

rwm is offline   Reply With Quote
Old Sep 4th, 2007, 6:00 AM   #6
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 929
Rep Power: 4 lectricpharaoh will become famous soon enough
@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.
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp
lectricpharaoh is offline   Reply With Quote
Old Sep 4th, 2007, 6:36 AM   #7
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2 rwm is on a distinguished road
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 is offline   Reply With Quote
Old Sep 4th, 2007, 9:44 AM   #8
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2 rwm is on a distinguished road
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!

rwm is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
wxWidgets problem rwm C++ 6 May 28th, 2007 10:03 AM
Making a C app run without a console ibbrowne3 C 7 Nov 21st, 2006 12:40 PM
Manipulating the console using Windows API rup C++ 2 Nov 17th, 2006 1:04 PM
The Black Art of Video Game Console Design lostcauz Book Reviews 0 Apr 26th, 2006 7:31 PM
console output matko C++ 10 Sep 26th, 2005 2:14 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:42 PM.

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