How to auto-resize objects on a form and set their appearance while not in use

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mas Juliza Alias
    New Member
    • Aug 2010
    • 67

    How to auto-resize objects on a form and set their appearance while not in use

    I have a Main Menu form (frmMainMenu) where there are frames, a table and a graph on it. Before, the table and the graph are on their own forms, but I found that there are too many forms in my program. So now they are all on the Main Menu form (see attachment). However I have some problems as follow:

    - The table contains 2 columns, Depth and Volume. To fill the table, user needs to browse the data file on a browse file dialog. How to make the MSFlexgrid appears as an empty table with the header of 'Depth' and 'Volume' before the data are filled in it?

    - The graph, MSChart, will appear when user browse data file and click the graph button on another form. How to hide the MSChart when loading the Main Menu form and replace it with "No data to display" text?

    - Main Menu form is the first form to appear in this program. Data file is selected and viewed on another form. How to code to fill the data in the table on the Main Menu form after the data is selected on the other form?

    - How to resize the objects on the form if user maximize the window?

    I hope there are solutions to these problems. Thank You in advance.
    Attached Files
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    Is it possible to attach Your program code in Bytes, so we can work on the same code?

    Comment

    • Mas Juliza Alias
      New Member
      • Aug 2010
      • 67

      #3
      This is what I got so far. User will click on File > Download/Import and a browse file dialog (dlgDownload) will appear. When the data file is entered, dlgViewContent will appear. By clicking the calculate, frmCalculate will appear. On frm calculate user can save the table in text file by click on File > Save and can generate the graph by click on Graph > Generate Elevation-Storage Graph. The problem is there are too many forms. I have copied all objects on frmCalculate and frmGraph onto frmMainMenu. What i need here is when user click button Calculate on dlgViewContent, the data will be entered in the table on the frmMainMenu. Together with the function of saving the table into text file and generating the graph. So that I can delete frmCalculate and frmGraph.

      Thank YOU for your help..
      Attached Files

      Comment

      • Guido Geurs
        Recognized Expert Contributor
        • Oct 2009
        • 767

        #4
        There are two ways:

        1st= set each view in a frame and control the size of it and the items in each frame at startup of the program i.f.o. the screen size.
        Switch between the frames with a menu or command button.

        2nd= with a tabblad: set each view on a tab and switch by selecting a tab or pressing a button.

        Preference: with a tab: no need to search in the menus!

        Which do You prefer?
        Attached Files

        Comment

        • Mas Juliza Alias
          New Member
          • Aug 2010
          • 67

          #5
          Both are OK. But for now I have the program with menus.

          Comment

          • Guido Geurs
            Recognized Expert Contributor
            • Oct 2009
            • 767

            #6
            Attached is an example how it can work with Menu and Frames.

            Because the frames can't be set next to each other, they are Cascaded and with a different colors (colors are reset at start-up with code)
            To edit the elements in the frames: click on the frame with RMB and select in the pop-up menu: "Bring To Front".
            The names are changed because there are multiple elements of the same type in the form now.
            How to name:
            Type - Which frame - function
            like : GridFraTESCalc => Grid - FraTES - Calc = grid on the frame "FrameTES" for Calculation.

            I have also added a button to set the data to the right format for "regional settings".

            The version is also automatic entered in the start-logo (just change the version numbers in the : Project - Retisro properties - Make - version number - Major, Minor and revision !).
            Attached Files

            Comment

            • Mas Juliza Alias
              New Member
              • Aug 2010
              • 67

              #7
              thank you for the modification. however there are several things I wish to change.

              - the main thing in this program is the table elevation storage and the graph. how to place it at the main menu window at start-up? because of no data is downloaded yet, both table and graph will appear blank or with the label 'no data to display'. is it possible to do that?

              - I prefer the view content frame to be a pop-up dialog as the download dialog. once the user click on calculate button (as previous coding) the table elevation-storage will be filled and the graph will be generated on the main menu window. can we do that?

              thank YOU for your continuous help...

              Comment

              • Guido Geurs
                Recognized Expert Contributor
                • Oct 2009
                • 767

                #8
                This is with a ViewContent form.
                Attached Files

                Comment

                • Mas Juliza Alias
                  New Member
                  • Aug 2010
                  • 67

                  #9
                  thank YOU! that works nicely. the codes are quite complicated to me, but I will try to understand them line by line. thanks a lot :)

                  Comment

                  • Guido Geurs
                    Recognized Expert Contributor
                    • Oct 2009
                    • 767

                    #10
                    This is the code, tidy and with some comments.
                    Attached Files

                    Comment

                    • Mas Juliza Alias
                      New Member
                      • Aug 2010
                      • 67

                      #11
                      thank you. the comments are really helpful :)

                      Comment

                      Working...