Thread: GUI help

  1. #1
    z33z
    Guest

    GUI help

    I'm almost totally new to gui programming, especially with mfc, which I now use.

    Therefor I wonder how hard something like this is to do something like this: http://warblastcrew.ebw.ca/tmp/timeline.jpg I've just copied and pasted from a lot of programs, bu I want my program to look something like that.

    Now, can anyone tell me what I should thing about when trying to create this gui? For example how's the best way to do a userdrawn listbox in a tabcontrol?

    Is there any good sites, tutorials or any other help?

    And finally: How hard is gui creating in mfc, compaired to, hmm..., for example java with swing classes?

    Since I'm a real ewbe to mfc gui, please tell anything you think is relevant!

    (I know that was a really broad question, but I've got to learn it somehow... )

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    Well I don't think it'd be anywhere NEAR easy to create that... incredibly hard. Even for someone like me who's been doing WinAPI for a while now.

    Well, actually it wouldn't be too tough (except I can't figure out how to put on a slideabar or tab-list...stupid petzold's not having a big chapter on common controls!)

    You might want to pick up a book on MFC...I don't know any because I use true API, but I'm sure someone here could refer you to one...

    Lotta help I am heh, and if you're coming from Java or VB you're in for a real shocker when you start trying to create that

  3. #3
    z33z
    Guest
    As I said, every reply makes me happy!

    Well. I've just done some java and also soma vb, but most of my life i've been using c++, just not gui-prgramming, except for c++ builder, which makes it rather simple, but I don't like to use it.

    Isn't there any program which can be used to design the gui and then generate code for mfc?

    First of all: Should the controls be created in the creation of the main frame or the client area? Main frame, right?

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Its not something I would want to start with but it can be done.

    You will need to go beyond the basics to get the display right. (into HDC's, TAB and owner draw ctrls)

    I would use the resource editor in the compiler. My prefrence is for MSVC. It will also write / hide some of the code from you.

    The easiest way to do the TAB ctrl is to create small dialogs and paste them on top of the TAB sheets.

    The main display is a 'static' or 'frame' with a HDC drawn over it.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    z33z
    Guest
    ... so you mean that I should more or less give it up?

  6. #6
    No, never ever give up. If you want to do something, you have to go for it. But do it all in pieces. say now: I'm going to learn the toolbar, now the slider (Ive no idea how this damn thing work,but looks like I'm not the only one )

    It will probably take you a while before you can do something like this. But if you like programing for the GUI, then you'll have fun and learn a lot.

    I always go to planet source . you can download some source and see how they do stuff.

  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    As Maes said
    'Never give up' or in. (unless that will get you what you need)

    for sliders, in the callback use (for horizontal sliders)
    This will find the position and call for a redraw of the slider after the user has changed the position of the thumb tack.
    Code:
    case WM_HSCROLL:
    hSlider=GetDlgItem(hwnd ,IDC_SLIDER );
    nPos=SendMessage(hSlider ,TBM_GETPOS ,0 ,0 );
    if(nPos!=LastHorzPos)//changed scroll position
    {
      SendMessage(hSlider ,TBM_SETPOS ,(WPARAM)TRUE ,(LPARAM)nPos );
      LastHorzPos=nPos;
      UpdateWindow(hwnd);
    }
    break;
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  8. #8
    z33z
    Guest
    The thing I think I'll have most problem with is that tabcontrol which includes a custom drawn listbox. I can start with just a listbox, but how do I conbine controls? That's my biggest issue which I haven't understood right now...

  9. #9
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Leave the TAB out for now.

    Later add it in. Then as the user changes the TAB switches you will get a message in the callback as to which is showing. If it is the one for the list box display it on screen
    Code:
    //then set its position on top of the TAB ctrl
    GetClientRect( GetDlgItem( hwnd, IDC_TAB_CTRL) ,&ClientRect);
    SetWindowPos(GetDlgItem( hwnd, IDC_LISTBOX), HWND_TOP, 
    ClientRect.left, ClientRect.top, ClientRect.right-ClientRect.left, ClientRect.bottom-ClientRect.top, 
    SWP_SHOWWINDOW);
    UpdateWindow( GetDlgItem( hwnd, IDC_LISTBOX));//call a paint
    if not just hide it till you need it again
    ShowWindow( GetDlgItem( hwnd, IDC_LISTBOX), SW_HIDE);
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GUI Programming...
    By ShadeS_07 in forum C++ Programming
    Replies: 12
    Last Post: 12-28-2008, 04:58 PM
  2. Convert Windows GUI to Linux GUI
    By BobS0327 in forum Linux Programming
    Replies: 21
    Last Post: 11-27-2005, 04:39 AM
  3. .NET And GUI Programming :: C++
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 01-27-2002, 04:22 PM
  4. GUI Programming :: C++ Exclusive
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 01-25-2002, 03:22 PM
  5. C++: Reference Book, GUI, Networking & Beyond
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 11-10-2001, 08:03 PM