X Windows C++ examples

Can someone help me to find an example of an X-Windows graphical program written in C++ or C.
I'm looking for something like a hello world application. I'd like to see how to implement a button or some simple control.

Who is Participating?
If you want to go multi platform, you have
1) QT
2) WxWindows

Might be easier using one of these as you can switch from Unix to Windows and not worry about it.  The examples are with the sources that you download.
funkyfingerAuthor Commented:
I'm starting to realize that this is a very broad question, as I research it I'm finding that the desktop I want to use GNOME uses a x window system called sawfish. I don't know if I can write generic code for both GNOME and KDE or for any x window system.

Still looking..
funkyfingerAuthor Commented:
I'm not worried about MS Windows at all. I just want to program for any (I should say most or hopefully some) Linux distributions.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Xwindows run on almost any machine -- cygwin is pretty good (for mswindows machines).

But saying "I want to write an X window application" -- there are so many approaches:
  1) raw X
  2) toolkit (i.e. kde, wxwidgets)
  3) scripting language (i.e. tcl/tk)

All of these are viable and useful.

funkyfingerAuthor Commented:
Hmm,, maybe there is something I'm not getting. Or maybe I'm not communicating well.
I'm a pretty fair programmer, but I'm new to linux.  Normally I'd use MS's MFC to write graphical programs.  But in Linux I'm clueless.
I'd like to use C++ to write the graphical program. (by graphical program I mean a form with buttons, textboxes, checkboxes and so forth.)

I'm concerned about standard controls, for instance a clickable button. In MS Windows the space bar can be used to simulate a button click, or toggle a checkbox, also the tab key cycles though these controls. I want to keep with standard controls if they exist. I don't know if linux has standard controls like this.  I want to learn about how to go about writing this type of progam.

After I am comforable with this I  plan to go wth linux full force and get my company to adopt open source solutions.

Thanks for your help
funkyfingerAuthor Commented:
Ahh,, thanks for your help
The  beauty of Unix systems is "if you don't like something, do it your own way"

Hence a plethora of shells, window toolkits, etc.

I guess if you're talking about a "standard way"  -- like Andy Tanenbaum says "the wonderful thing about standards is there are so many of them".

The windowing system is just another application you talk to .

At the lowest level (I guess  the "standard") is X11.

Then there are lots of "toolkits" built upon them them you can use.

I would imagine there is an article aimed at exactly what you want to do...

I guess pick one and go with it...QT is fine...

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.