H
hfghfghfg
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids;
type
myGrid = class(TCustomGrid)
end;
type
myInplaceEditList = class(TInplaceEditList)
end;
const
My_Msg_display = wm_user + 400;
type
TForm1 = class(TForm)
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ADODataSet1: TADODataSet;
ADODataSet1f1: TStringField;
ADODataSet1f2: TStringField;
procedure FormCreate(Sender: TObject);
procedure DBGrid1ColEnter(Sender: TObject);
procedure display_from_msg(var Message: TMessage); message My_Msg_display;
procedure ADODataSet1AfterScroll(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
ADODataSet1.close;
ADODataSet1.CreateDataSet;
ADODataSet1.Open;
end;
procedure TForm1.DBGrid1ColEnter(Sender: TObject);
begin
postmessage(handle, My_Msg_display, 0, 0);
end;
procedure TForm1.display_from_msg(var Message: TMessage);
var
i: integer;
begin
if TstringGrid(DBGrid1).Col = 2 then
myInplaceEditList(myGrid(DBGrid1).InplaceEditor).DropDown;
end;
procedure TForm1.ADODataSet1AfterScroll(DataSet: TDataSet);
begin
postmessage(handle, My_Msg_display, 0, 0);
end;
end.
object Form1: TForm1
Left = 192
Top = 103
Width = 676
Height = 303
ActiveControl = DBGrid1
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object DBGrid1: TDBGrid
Left = 0
Top = 156
Width = 668
Height = 120
Align = alBottom
DataSource = DataSource1
Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit]
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
OnColEnter = DBGrid1ColEnter
Columns = <
item
Expanded = False
FieldName = 'f1'
Width = 153
Visible = True
end
item
Expanded = False
FieldName = 'f2'
PickList.Strings = (
'12'
'34'
'56')
Width = 228
Visible = True
end>
end
object DataSource1: TDataSource
DataSet = ADODataSet1
Left = 120
Top = 88
end
object ADODataSet1: TADODataSet
AfterScroll = ADODataSet1AfterScroll
Parameters = <>
Left = 48
Top = 32
object ADODataSet1f1: TStringField
FieldName = 'f1'
Size = 100
end
object ADODataSet1f2: TStringField
FieldName = 'f2'
Size = 100
end
end
end
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids;
type
myGrid = class(TCustomGrid)
end;
type
myInplaceEditList = class(TInplaceEditList)
end;
const
My_Msg_display = wm_user + 400;
type
TForm1 = class(TForm)
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ADODataSet1: TADODataSet;
ADODataSet1f1: TStringField;
ADODataSet1f2: TStringField;
procedure FormCreate(Sender: TObject);
procedure DBGrid1ColEnter(Sender: TObject);
procedure display_from_msg(var Message: TMessage); message My_Msg_display;
procedure ADODataSet1AfterScroll(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
ADODataSet1.close;
ADODataSet1.CreateDataSet;
ADODataSet1.Open;
end;
procedure TForm1.DBGrid1ColEnter(Sender: TObject);
begin
postmessage(handle, My_Msg_display, 0, 0);
end;
procedure TForm1.display_from_msg(var Message: TMessage);
var
i: integer;
begin
if TstringGrid(DBGrid1).Col = 2 then
myInplaceEditList(myGrid(DBGrid1).InplaceEditor).DropDown;
end;
procedure TForm1.ADODataSet1AfterScroll(DataSet: TDataSet);
begin
postmessage(handle, My_Msg_display, 0, 0);
end;
end.
object Form1: TForm1
Left = 192
Top = 103
Width = 676
Height = 303
ActiveControl = DBGrid1
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object DBGrid1: TDBGrid
Left = 0
Top = 156
Width = 668
Height = 120
Align = alBottom
DataSource = DataSource1
Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit]
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
OnColEnter = DBGrid1ColEnter
Columns = <
item
Expanded = False
FieldName = 'f1'
Width = 153
Visible = True
end
item
Expanded = False
FieldName = 'f2'
PickList.Strings = (
'12'
'34'
'56')
Width = 228
Visible = True
end>
end
object DataSource1: TDataSource
DataSet = ADODataSet1
Left = 120
Top = 88
end
object ADODataSet1: TADODataSet
AfterScroll = ADODataSet1AfterScroll
Parameters = <>
Left = 48
Top = 32
object ADODataSet1f1: TStringField
FieldName = 'f1'
Size = 100
end
object ADODataSet1f2: TStringField
FieldName = 'f2'
Size = 100
end
end
end