Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Starting Programming
Index -> Programming, C++ -> C++ Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Fevian




PostPosted: Wed Feb 21, 2007 10:14 pm   Post subject: Starting Programming

Well. I just started programming not too long ago. I began with some command line C++, which I'm novice at. I'm also novice at Visual Basic. I'd really start to make some stuff though, and I'd rather be able to do all interface and everything in one language. I've looked everywhere and I can't find anything about C++ and interfaces and the like. Am I missing something? Can you even do GUIs in C++ or what? Thanks, bye.
Sponsor
Sponsor
Sponsor
sponsor
bugzpodder




PostPosted: Wed Feb 21, 2007 11:03 pm   Post subject: RE:Starting Programming

download visual c++ express edition
Fevian




PostPosted: Fri Feb 23, 2007 2:32 pm   Post subject: RE:Starting Programming

I have it. Had it for a while. Is that the only way to do it? No straight coding or anything. I'd really like to know all I can about it. The ins and outs, you might say. Once again, thanks.
rdrake




PostPosted: Fri Feb 23, 2007 3:44 pm   Post subject: RE:Starting Programming

You will want to research some GUI toolkits to make your life easier. Big ones include Fox and GTK+. There are extensive tutorials for both of those GUI toolkits on the web, and they are both cross platform as well (meaning your application can have the same GUI written once, and used on Linux, Windows, OS X, etc.).
wtd




PostPosted: Fri Feb 23, 2007 4:19 pm   Post subject: RE:Starting Programming

You can certainly write GUIs with just a text editor, and command-line compiler. However, GUI toolkits are usually either big, complex, or some combination of both.

IDEs (integrated development environments) are typically constructed to mitigate this problem.

I would, however, caution you to avoid GUIs as long as possible. In GUI applications written in C++ and/or VB, the vast majority of the code is incredibly boring boilerplate you insert just to get to the point of a blank window. GUIs sound like fun, but in practice, they are frequently tedious and boring.

Also, I would ask if you have had any really good opportunities to check your knowledge. Have you had peer review along the way to see that you're writing decent code?
PaulButler




PostPosted: Fri Feb 23, 2007 4:25 pm   Post subject: RE:Starting Programming

I don't know how it rates in terms of difficulty (I haven't programmed extensively with any GUI toolkit), but wxWindows is cross platform. The benefit is that it doesn't draw the components and windows itself, it uses the system's native components. So your application will look like a Windows app on Windows, a Linux app on Linux, and a Mac app on Mac OS. (Actually, the newer version of GTK for Windows uses a Windows theme by default, so this isn't quite as true as it once was.) This also means Windows/Mac users don't have to worry about installing GTK.
Fevian




PostPosted: Fri Feb 23, 2007 4:26 pm   Post subject: RE:Starting Programming

I debug it all myself and check it over and over until I'm sure it works. Also, my teacher and friend who is also taking the course with me tell me I'm decent for a beginner. I know how to do certain stuff and I'd like to do more. But I really wanted some info on GUI stuff before I got into it. See what programs and knowledge I needed before proceeding. Any thing else in depth you can tell me. Once again, many thanks.
wtd




PostPosted: Fri Feb 23, 2007 4:29 pm   Post subject: RE:Starting Programming

Well... here are the best tips I can share with you.

Share your code. Post some programs you've written, even if they're small and seemingly trivial. If nothing else, you'll get style tips.

Be humble. If you post your code, you will learn, but part of that process will involve people taking your code and tearing it to shreds.

Do not stop at working code. Step back for a little while, then revisit it, and see if there's anyway you could have written it better.
Sponsor
Sponsor
Sponsor
sponsor
Fevian




PostPosted: Fri Feb 23, 2007 4:42 pm   Post subject: RE:Starting Programming

Well, yeah. That's good and all. So I should keep learning all there is about Command Line interface C++ and work hard on it until I'm good. Then go to advanced programming with toolkits and GUIs. I'll be sure to put in my code and stuff here, as you guys are gonna be helping me get good by checking my work and stuff. So, once again, thanks. Please, if any more info about C++ or programming in general at all, or optional paths to go on, post here. I'll read.
wtd




PostPosted: Fri Feb 23, 2007 4:47 pm   Post subject: RE:Starting Programming

Toolkits, you have to remember, are typically designed by people who are experts in a particular language. They design their toolkits to take advantage of the most advanced features the language can provide.

Understanding a given toolkit is therefore helped immensely by simply understanding the underlying language.
Fevian




PostPosted: Fri Feb 23, 2007 4:54 pm   Post subject: RE:Starting Programming

So do what I said. More information appreciated. kthxbai

Edit: What I meant by this post is that I should do what I said and study more. More info and stuff is appreaciated. Thanks, bye.
haskell




PostPosted: Fri Feb 23, 2007 9:08 pm   Post subject: RE:Starting Programming

An IDE is not particularly needed(on Windows anyways). Your standard Win32 GUI application should be in atleast 2 parts:

- Code
- Resources

Since all of these fancy IDE with Drag and drop GUI designers are just Visual Resource Editors(many are free and very easy to get/use), it is easy to use the command-line(go nuts), your favorite editor(such as EMACS of VIM), and still have your easy to make GUI using resources and a Resource Editor.

Only thing is you need a resource compiler(not an issue at all), and then you can just link everything together in a neat little package, where the design is seperate from the code.

Doing Win32 GUI applications in this manner simplifies Win32 GUI programming to VB-like levels. Even the labels for the main GUI loop is known by their values used in the resource file(s)(if its done right), and then you just handle the messages with ease, having much less code than if you hand coded the GUI.
Fevian




PostPosted: Sat Feb 24, 2007 10:26 am   Post subject: RE:Starting Programming

Thanks a lot. Can you explain on that a little more. I'm not sure I "understood" it all.
haskell




PostPosted: Sat Feb 24, 2007 11:47 am   Post subject: RE:Starting Programming

A resource script is a sub-scripting language, which bears some similarity to QBASIC, for describing GUI elements. This includes assigning them numerical IDs, names, text, size, etc... When this design is done seperately from the implementation, it is a lot easier to implement the GUI, because all you need to do is cause the window to be drawn, and all the other elements are drawn on.

Then, in your main code, you just cause the window to be drawn, and handle the messages from GUI elements.


Example.cpp
code:
#include <windows.h>
#include <commctrl.h>
#include "Example_res.h"

LRESULT CALLBACK MainDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

HINSTANCE hInstance;

// WinMain

int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
   hInstance=hInst;
        InitCommonControls();
   DialogBox(hInstance, (LPCTSTR)IDD_MAINWINDOW, HWND_DESKTOP, (DLGPROC)MainDlgProc);

   return 0;
}

// MainDlgProc

LRESULT CALLBACK MainDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
   switch (message)
   {
      case WM_INITDIALOG:
      {
         RECT r, r2;
         GetWindowRect(hDlg,&r);
         GetWindowRect(GetDesktopWindow(),&r2);
         MoveWindow(hDlg,(r2.right/2)-((r.right-r.left)/2),(r2.bottom/2)-((r.bottom-r.top)/2),r.right-r.left,r.bottom-r.top,TRUE);
         break;
      }

      case WM_COMMAND:
      {
         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
         {
            EndDialog(hDlg, LOWORD(wParam));
            return TRUE;
         }
         break;
      }
   }
   return FALSE;
}


Example.rc
code:
// Example : Resource File

#ifndef WS_VISIBLE
#include <windows.h>
#endif

#include "Example_res.h"

IDD_MAINWINDOW DIALOGEX DISCARDABLE 20, 20, 208, 86
STYLE WS_OVERLAPPEDWINDOW
CAPTION "Example"
FONT 8, "Tahoma"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,151,7,50,14,0
    PUSHBUTTON      "Cancel",IDCANCEL,151,24,50,14,0
    LTEXT           "This is a dialog box",IDC_STATIC,10,10,100,22
END

IDI_ICON1 ICON DISCARDABLE "C:/Example/icon.ico"


Example_res.h
code:
// Example : Resource Defs

#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif

#define IDD_MAINWINDOW 1001
#define IDI_ICON1      1002


This is just a loose example, but it illustrates the point clear enough.
Fevian




PostPosted: Sun Feb 25, 2007 9:46 pm   Post subject: RE:Starting Programming

That was so beyond me, it wasn't funny.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 28 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: