Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win



Posted on 2013-07-01
Medium Priority
Last Modified: 2013-08-15
i have a form, there is a combo box, date time picker, and a panel in the form.
In the panel two components are getting created at run time. One grid and one frame.
The frame contains one grid and the frame's parent is set to be the panel at runtime hence in my form i can see two grids at run time, say grid1(from frame) and grid2. Now grid1 is linked with grid2, hence when i scroll down grid2, the details are populated in grid1, meaning for one row selected in grid2, there could be multiple rows to be populated in grid1. Grid2 gets populated based on the date selected from the date time picker in the form and also the text of the text box.

Till this point everything looks perfect, now my problem starts with below implementation.
Now grid1 only gets populated when i click the row in grid2, but i need another screen where i need to show all details related to all the rows in grid2.
Hence in the form i shall need to take a check box eg, and when i tick the check box the new screen shall appear with all details related to grid2. when i unchek the tick box it should go back to my previous screen as it is.

I have designed another frame with a grid and trying to create multiple frames based on the rowcount of the grid2 and i am taking another scroolbox in the form, and setting these frames' parent as the scroolbox, so that when i shall tick the checkbox the scrollbox shall appear and when un-checked the panel shall appear.

How to implement this, please help with code.
Question by:AbhiJeet
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3

Author Comment

ID: 39289851
any expert comment?

Author Comment

ID: 39291841
any solution?
LVL 10

Expert Comment

ID: 39292204
If you are using data-aware grid e.g. TDBGrid then you should bind the another grid to the same dataset. If you are using stringgrid then you should use some data structure that is accessible to all related grids. e.g. you can maintain double dimensional array, or an array of record. or string list.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 39292639
i need to know what should be the best design approach for this requirement and how to implement the same?
LVL 10

Expert Comment

ID: 39292718
Use a data module; all your data should reside there. Those can be in the form of tables or other data structures. Then use a controller (a class) that creates data module and different views (i.e. screens/forms), and then establishes connections  to those different views and finally returns it to the caller.

Author Comment

ID: 39293639
i am not using any dbgrid, i am using stringgrids.
LVL 38

Expert Comment

by:Geert Gruwez
ID: 39294113
what version of delphi and what patch are you using ?
some versions have buggy TFrame implementations
LVL 10

Accepted Solution

atul_parmar earned 1500 total points
ID: 39295489
Reconsider the design I suggested, it works with string grid too. Define your data structure and store it in the data module. Following is what you can use as starting point.

unit MyData;


  SysUtils, Classes;

  TMyRecord  = class
    FName: string;
    FDOB: TDate;
    property Name: string read FName write FName;
    property DOB: TDateTime read FDOB write FDOB;

  TDataModule2 = class(TDataModule)
    FEmpData: TList; //this stores instances of TMyRecord
    procedure Add(TMyRecord);
    procedure Remove(TMyRecord);
    //navigate FEmpData using these methods.
    procedure First: TMyRecord;
    procedure Next: TMyRecord;
    procedure Last: TMyRecord;
    function Count: Integer;

  TMyViewController = class
    FData: TDataModule2;
    procedure Bind(AGrid: TStringGrid); //traverse the FData and populate the grid

Open in new window


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question