Hi All,

I'm working on a GUI project that involves continuously reading data (which is a waveform - like a simple sinusoid) from a file (which gets periodically updated), and displaying it as a pixel-based image. I was able to follow some tutorials online and install Allegro and successfully plot a static 2d image.

However, what I want to really do (to complete the project) is to create a decent GUI window that has some options (like radio-buttons and boxes where user can input some numbers). Something like the attachment figure.

The reason I want these features in my GUI window is that I would be reading the waveform data from a file and performing some math operations (which depend on parameters given as input by user) on the data before finally displaying it on the GUI.

I tried for over a week to find tutorials of Allegro that will allow inclusion of such buttons and boxes, but in vain. I found from a webpage (http://www.opengl.org/resources/features/fontsurvey/ ) that a GUI window like the attached pic can be done using openGL, but no details are given as to how to develop such a GUI.

Now finally, what I want is to know if any of you guys have any tutorial that shows me how to develop a GUI like the one attached, except that instead of the big text "Survey of...", I would be displaying my waveform. Please...please point me to any tutorial or any other source that will let me develop this kind of GUI (using any kind of package graphics).

Thanks,
Amar

I know that could be done with Microsoft MFC. Probably even wxWindows. You might search www.codeproject.com to see if they have anything useful. I know they have a plotting program written if MFC.

I know that could be done with Microsoft MFC. Probably even wxWindows. You might search www.codeproject.com to see if they have anything useful. I know they have a plotting program written if MFC.

wxWidgets formally known as wxWindows is a cross platform api. It cam be used for free for any kind of app (even commercial), and it is fairly fast. There are many form builders that can be used with it too. I personally use wxFormBuilder, but there are other one's such as wxGlade. Good luck with your program :)

Thank you all, for the pointers....but all this looks like I need to go digging deep into a very systematic approach using these windows programming APIs in order to create a graphic window, which is fine but it seems to take the focus off my actual project objective.

First of all I'm using Windows XP and Visual C++ 2008 Express edition. My project's basic idea is to write a c++ program which does some math computation (signal processing) on the input waveform, which is just a very large array of floats that I'm reading from a file (just for now...later on for the final step of the project I intend to read the waveform data real time from a USB port), and generate a pixel image of the math-modified waveform.

I've followed your suggestions and after googling I found some win32 windows programming examples that do generate such graphical windows with moderate programming effort, but all the tutorials I've found on windows programming describe how to do this whole thing in C not C++ . I already have written code in c++ for my signal processing part. I'm not against converting my existing piece to c equivalent to make it compatible with the C code for windows programming. But the problem is in the last step of my project I also want to do a device driver programming, which is mostly available and much easier in c++ as far as I know, in order to read the data real time from USB port and then do the signal processing on it and finally display it in pixel form in my graphics window.

Bottom line is I want to stick to C++ programming and make the "graphic-window-generation" just a part of my project's big picture...not the big picture itself. Am I crazy for doing this?


Thanks in advance,
Amar
UCLA

>>all the tutorials I've found on windows programming describe how to do this whole thing in C not C++

That's because all win32 api functions are C functions, not C++. But they can be called from c++ as well as most other programming languages.

>>I'm not against converting my existing piece to c equivalent to make it compatible with the C code for windows programming
That's not necessary. Just use the C win32 api code in your c++ programs, it will work fine with no problems whatsoever.

Thanks, I've just tried your second suggestion, with a very simple example that throws an empty window onto the screen. But still I can't seem to avoid the

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

declaration at the start of my program. Which is fine for now, but would be problematic if I start including my existing piece of code?
I'm asking this because it didn't show the usual hello world statement that is in the very beginning and directly jumped to the window invoking part. Below is the summary of the code:

#include <iostream>
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{

cout << "Amar " << endl;

/* example win32 code that throws an empty window
on to the screen */

}


And this program doesn't work if I just use the plain old int main() instead of WinMain which is expected ofcourse. But my concern is....is not executing my code and directly jumping to the windows part?

Sorry, I was talking about printing "Amar" instead of "Hello World" in the above program. The program doesn't seem to be executing that statement or atleast the output of that statement seems to be stifled by the rest of the window-generating part.

In windows program, WinMain() replaces main(), and you can't use cout or cin because windows programs are not console programs. cout and cin will compile, but will do nothing. fstream to read/write to/form the file system will work at expected.

You have to use the win32 api gui functions to write text in the window, as illustrated in this tutorial

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.