GUI application development suggestion

This is a discussion on GUI application development suggestion within the C++ Programming forums, part of the General Programming Boards category; I am new to developing a GUI application and I would appreciate if someone could suggest me the simplest possible ...

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    2

    GUI application development suggestion

    I am new to developing a GUI application and I would appreciate if someone could suggest me the simplest possible way to develop a GUI application which has the below mentioned capabilities.

    I know the basic C++ programming, But I have never used it to develop an application like in Visual C++ or something like that.So I am new to the library concepts, CLI and other.

    Task:

    1. I have a flat file database (a .txt file in the same format as that of the input file)

    eg: John
    33

    2. I have a .txt file which has some information like

    eg: John
    32

    Tom
    25



    3. I need to make a GUI to input this .txt file and compare it with the database.
    If I find John, replace his age(32) as given in the database(33).


    4. Display Tom's details(since he is not in the database). Allow to edit it manually (to make it 26).

    5. Save the newly entered details of Tom to the database. (So that it can be used later for other input file modifications with Tom#s wrong details)

    6.Generate a .txt file that has the edited details like

    eg: John
    33

    Tom
    26



    Thanks & Regards
    Lemontree

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,438
    I did a fairly large project for working with customer lists and data in csv files recently, i used FLTK, which is my preference for lighter, functional gui stuff.
    At the end of the day any of the available GUI libraries for C++ will allow you to accomplish your task, after all, from your description you will only require a few buttons for controls, and some text input widgets your main concern is with the code to handle the data itself, working with the strings, strong input validation, efficiency if data is large set, the file io, parsing and amending, appending, inserting etc. - here is a screen shot of the FLTK one i did, its a small interface but can perform a lot of variations on its basic task with only a few buttons, the only other window is a checkbox list and when the native file chooser is called for save / load.
    Last edited by rogster001; 08-05-2011 at 05:34 AM.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  3. #3
    Registered User
    Join Date
    Aug 2011
    Posts
    2
    I am just trying my luck with visual c++. is there any source where I could really get codes for different events or functionalities for each of the gui components?

    any suggestion? I tried this type of application ' windows forms application.

    Thanks & Regards

  4. #4
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,438
    I do not use visual studio so am not sure about the windows forms, i imagine that requires you coding in the winApi though, and you are not going to like that... although like i say i am not a user of vc.
    The simplest option for you really might be to code it in the VBA runtime directly within Excel. It has a simple forms developer that you can use to add control buttons and text input. And VBA coding is a lot easier than C++. It will not run as fast as a stand alone application though.

    You cannot find 'set code' as your app will have its own requirements surely? You need to understand that with the GUI programming some of the hard work is managed for you...and some isn't. Your buttons and other 'widgets' have certain default behavious, and they communicate with the main 'run' loop on a level that is not neccesarialy directly exposed to you the programmer. This means that the basic mouse event handling etc is done for you unless you modify things.
    This also means that you can click on a button and it will show visual response, but nothing will happen. In general you would need to learn how a 'callback' works, this is a function which you can 'attach' to your button and thus have your own code execute on buttonclick.

    Here is a callback from the program in the screenshot, the comments were my exisiting ones only by the way

    Code:
    void ListBuilder::SiteButtonCB_i(Fl_Widget* wgt, void* v)
    {
        Fl_Button* button = (Fl_Button*) wgt;
        string btnLabel = button->label();
        if(btnLabel == "OK")                           
        {
            GetActiveSites();  
            startBtn->activate();                //can start now as this button is only lit when a site selected
            if(bookedCust)                         //can only use publicaiton selection if not draft customer run
            allPubsChk->activate(); 
            
            button->deactivate();               //deactivate unless user again goes in and clicks a new box, in which case it will activate again.
        }
        else                                            //user cancelled custom site selection, reset the gui group
        {
            SelectAllSites();                        //otherwise select it and show all checkboxes selected.
            siteGrp->deactivate();                //grey out as all selected by default now
            startBtn->activate();                  //its ok to start as far as sites go as they all selected now
            
            if(bookedCust)                           //can only use publicaiton selection if not draft customer run
            allPubsChk->activate();                //is ok to allow custom publicatin choosing also now
            
            allSites = true;
        }
    }
    This is the callback attached to the green OK and red cancel buttons. the callback passes a widget pointer in, which in this case i cast to a button and then check the label, this lets me use logic to get more mileage out of a single callback, and makes sense as they are related functionally anyhow.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,033
    Windows Forms is C++/CLI, not native Win32 programming. That is, you are leaving the realm of C++.
    I'd just recommend Qt for your GUI programming. It's C++. In the end, no one can tell you what to use, really. It's your personal preference.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 07-03-2010, 02:18 PM
  2. UI application: suggestion of how to fix it
    By baroim in forum C++ Programming
    Replies: 9
    Last Post: 09-22-2009, 08:47 AM
  3. Undertaking Website Building Project and Application Software Development
    By Programmer168 in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-21-2009, 05:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21