?
Solved

Grids or StringList in Delphi 6

Posted on 2005-05-06
5
Medium Priority
?
540 Views
Last Modified: 2008-03-17
I am not quite sure were this issue falls but here goes.

I am need a component with simaliar features to a grid but there are no real columns.  I trying to build an item that has four lines within 1 row.  There could be as many as 1000 rows in the item.  Inside each row are identical information.  for instance:

Name:  John Doe      Date of Dirth:   01/01/2000    Dropdown1:  list of items   Dropdown2: listofitems
Edit1: text     Edit2: text       Edit3:  text            edit4:  long text       edit5 text
Edit6: text               Edit7: text               Edit8: text                    edit9:   text
Comments:  Really long text

As you can see here is were the sort of grid comes in, but none of the fields will line up.  I would like to be able to address this like:  item[4].edit1.text := 'Some Text';  and so on.  

Thanks in advance.
0
Comment
Question by:lmcmilli
3 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 672 total points
ID: 13947404
Hi
Maybe the best thing is to put Your data into database table and use TDBCtrlGrid

mokule
0
 
LVL 13

Assisted Solution

by:BlackTigerX
BlackTigerX earned 664 total points
ID: 13948363
VirtualTreeView would do the job...
0
 

Assisted Solution

by:Metrix_
Metrix_ earned 664 total points
ID: 13953407
Create a new Frame, place all the edit. combos etc onto this frame then on the form you want to have the list of "rows" to edit add a "TScrollbox" .

Then create  a new frame per record to edit using the TScrollBox as the Owner and Parent. Adding a function to the frame to associate the record to it would be a good idea.

Here is a really simple example (It's a Form and a Frame) :

------------------- FORM CODE HERE ---------------------

unit TestMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ScrollBox1: TScrollBox;
    Button1: TButton;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses TestFrame;

{$R *.dfm}

var
  Frames : Array of TFrame2;

procedure TForm1.Button1Click(Sender: TObject);
var
  index : integer;
begin
  ScrollBox1.Visible := false;
  SetLength(Frames, 101);
  for index := 100 downto 0 do
  begin
    Frames[index] :=  TFrame2.Create(nil);

    Frames[index].Name := 'Frame' + Inttostr(index);
    Frames[index].Parent := ScrollBox1;
    Frames[index].Align := alBottom;
    //Example calle to imaginery function
    //Frames[index].AddLink(aryData[index]);
  end;
  ScrollBox1.Visible := true;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Frames[0].Edit1.Text := 'Hello';
end;

end.

------------------- FRAME CODE HERE ---------------------

unit TestFrame;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TFrame2 = class(TFrame)
    Edit1: TEdit;
    Edit2: TEdit;
    Bevel1: TBevel;
    CheckBox1: TCheckBox;
    ListBox1: TListBox;
    ComboBox1: TComboBox;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

implementation

{$R *.dfm}

end.

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

839 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