Solved

delphi6

Posted on 2013-07-01
8
254 Views
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.
0
Comment
Question by:AbhiJeet
  • 4
  • 3
8 Comments
 

Author Comment

by:AbhiJeet
Comment Utility
any expert comment?
0
 

Author Comment

by:AbhiJeet
Comment Utility
any solution?
0
 
LVL 10

Expert Comment

by:atul_parmar
Comment Utility
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.
0
 

Author Comment

by:AbhiJeet
Comment Utility
i need to know what should be the best design approach for this requirement and how to implement the same?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 10

Expert Comment

by:atul_parmar
Comment Utility
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.
0
 

Author Comment

by:AbhiJeet
Comment Utility
i am not using any dbgrid, i am using stringgrids.
0
 
LVL 36

Expert Comment

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

Accepted Solution

by:
atul_parmar earned 500 total points
Comment Utility
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;

interface

uses
  SysUtils, Classes;

type
  TMyRecord  = class
  private
    FName: string;
    FDOB: TDate;
  public
    property Name: string read FName write FName;
    property DOB: TDateTime read FDOB write FDOB;
  end;

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

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

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now