C backend whilst using wxWidgets

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Dead1nside
In need of some credit
In need of some credit
Posts: 3
Joined: Mon Sep 18, 2006 10:32 am
Location: UK, Bucks.
Contact:

C backend whilst using wxWidgets

Post by Dead1nside » Mon Sep 18, 2006 10:34 am

Hi,

I'm planning on using C for a project of mine, but need a cross platform GUI so wxWidgets seems to be a good one. Can I code the backend seperatley and plugin the GUI to it like that? Or does it all have to be coded together and in C++. As I barely know C yet, let alone C++.

Thanks in advance for answers.

Peterj
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Nov 14, 2005 6:48 pm
Location: Australia

Post by Peterj » Mon Sep 18, 2006 11:26 am

As you barely know C, why bother coding in it, rather go straight for learning C++ and picking up C along the way (ie where necessary). C is not a necessary pre-requisite for learning C++ (some would say a hinderance).

You will find that using the wxWidgets libraries and samples along with some good C++ tutorials, you will be able to produce something constructive while you learn.

During the learning phase you will write some horrible code, but if it works you've achieved something. Having the discipline to revise your code as your learning progresses is very valuable.

You will find that using the wxWidgets libraries shields you from a lot of learning that to start with can seem somewhat daunting.

Have fun and good luck

Peter
Using Win XP, Dev C++ 4.9.9.2 wx-beta 6.9

Dead1nside
In need of some credit
In need of some credit
Posts: 3
Joined: Mon Sep 18, 2006 10:32 am
Location: UK, Bucks.
Contact:

Post by Dead1nside » Mon Sep 18, 2006 12:22 pm

Thank-you for your comments, I'd really like to know C and I have a lot of reference material, I know how to solve my problem in C already practically. I know how to code the algorithm that is, and my sorting routines shouldn't be hard either.

I was wandering really if there is some standard way of seperating a GUI and the backend code, like variables in the commandline that the GUI will select or such. (Since I'm sure this is probably at the end of all my C books)

This way I can begin coding my solution and then learn the relevant C++ to help with coding the GUI in wxWidgets.

Thanks.

benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte » Mon Sep 18, 2006 12:39 pm

Dead1nside wrote: I was wandering really if there is some standard way of seperating a GUI and the backend code, like variables in the commandline that the GUI will select or such. (Since I'm sure this is probably at the end of all my C books)
"standard" not, but probably the most common one...

in your GUI/cmd line app, write one (or several if you think it's better) function(s) to handle the command line/graphical options.
create a class to perform your task, call it with the needed parameters (or option structure).

therefore, you can call your working class from a GUI/CLI app (even from a component-oriented container), and it just has the knowledge of its needed parameters.

of course, the working class can be replaced by a set of classes, and you can have several options structures (display options, working options, verbose/debug modes...)

Note: wxWidgets already has a command line parser class to make the arguments parsing easier. It works well. Thus, you don't need to play with argc/argv.

Dead1nside
In need of some credit
In need of some credit
Posts: 3
Joined: Mon Sep 18, 2006 10:32 am
Location: UK, Bucks.
Contact:

Post by Dead1nside » Mon Sep 18, 2006 1:40 pm

From the looks of the two responders above (thank-you very much for your replies); it looks like I should straight away look into wxWidgets first, as it provides ways around these non-standard techniques that were mentioned.

I haven't really done much OOP before so some of those terms were a bit misty in my head.

Thanks for the advice.

Post Reply