tdbgrid

Moving Columns in a DBGrid seems to move the attached DataSet fields

吃可爱长大的小学妹 提交于 2021-02-07 05:19:51
问题 I observed something last week that I did not expect, and will describe below. I am curious as to why this happens. Is it something internal to the TDataSet class, an artifact of the TDBGrid, or something else? The order of the fields in an open ClientDataSet changed. Specifically, I created a ClientDataSet in code by calling CreateDatatSet after defining its structure using FieldDefs. The first field in this ClientDataSet's structure was a Date field named StartOfWeek. Only moments later,

Moving Columns in a DBGrid seems to move the attached DataSet fields

回眸只為那壹抹淺笑 提交于 2021-02-07 05:18:12
问题 I observed something last week that I did not expect, and will describe below. I am curious as to why this happens. Is it something internal to the TDataSet class, an artifact of the TDBGrid, or something else? The order of the fields in an open ClientDataSet changed. Specifically, I created a ClientDataSet in code by calling CreateDatatSet after defining its structure using FieldDefs. The first field in this ClientDataSet's structure was a Date field named StartOfWeek. Only moments later,

Print a TDBGrid [duplicate]

萝らか妹 提交于 2020-02-01 05:36:39
问题 This question already has answers here : Printing a TDBGrid (4 answers) Closed 2 years ago . How can I print a DBGrid without installing or downloading components? OR How can I get a DBGrid's data into a RichEdit so that I can print it from there? 回答1: Data aware controls get their data from DataSource property, use that. You have to manually traverse it though, no instant way possible (without third party libraries / components). 回答2: You will need to be able to work out an appropriate print

Set some cells in TDbGrid to editable

好久不见. 提交于 2020-01-11 11:52:28
问题 I want only some cells editable in a TDBGrid. In a given column, some but not all cells will be editable, so I can't just set Column.ReadOnly for the entire column and then leave it that way. What events are best to use so I can get control when a cell is entered. I might use TDbGrid.ColumnEnter to catch horizontal movement and TDataSet.AfterScroll for vertical movement in the grid. Or I could perhaps use TDBGrid.DrawColumnCell (which I'm already using to change the color of some cells...)

Set some cells in TDbGrid to editable

落花浮王杯 提交于 2020-01-11 11:52:13
问题 I want only some cells editable in a TDBGrid. In a given column, some but not all cells will be editable, so I can't just set Column.ReadOnly for the entire column and then leave it that way. What events are best to use so I can get control when a cell is entered. I might use TDbGrid.ColumnEnter to catch horizontal movement and TDataSet.AfterScroll for vertical movement in the grid. Or I could perhaps use TDBGrid.DrawColumnCell (which I'm already using to change the color of some cells...)

Delphi 7 - TDBGrid style

痴心易碎 提交于 2020-01-06 08:10:39
问题 How to use stylized table in Delphi 7? For example: 回答1: If you mean which you want themed the TDbGrid component, you can use the Themed DBGrid runtime replacement from Jeremy North's and Andreas Hausladen. 回答2: I wrote and tested for you this example on Delphi 7 and Windows 8.1 Use Event DrawColumnCell to change color or something else. procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;DataCol: Integer; Column: TColumn; State: TGridDrawState); begin try if Column

How to auto fit/scale DBGrid's (or other similar) columns widths according to its contents?

烂漫一生 提交于 2019-12-30 06:13:11
问题 I am trying to make a frame with a DBGrid that will serve for more than 10 tables with half of its fields as defaults, and other fields exclusive for each table. As the space for the columns are limited and I do not want to configure each column of each table manually because it is very poor quality work, I was wondering a way to calculate the width of each column by the largest content of a row inside that column, measured by the own component or by the data set. Does anyone knows the way?

Where the TDBGrid Columns resize event was triggered

时光毁灭记忆、已成空白 提交于 2019-12-24 00:15:38
问题 I have a TDBGrid component. I need to catch the event triggered when I'm resizing a column of the grid. 回答1: the only place to get an events seems to be overriding ColWidthChanged... type TDBgrid=Class(DBGrids.TDBGrid) private FColResize:TNotifyEvent; procedure ColWidthsChanged; override; protected Property OnColResize:TNotifyEvent read FColResize Write FColResize; End; TForm1 = class(TForm) Panel1: TPanel; Button1: TButton; DBGrid1: TDBGrid; ADODataSet1: TADODataSet; DataSource1: TDataSource

Change DBGRID row color on field value in delphi

谁说我不能喝 提交于 2019-12-23 18:26:51
问题 How to change color of dbgrid rows that have the same value on a field in delphi? for example all rows that have the same teacher note: those rows are grouped, and come after each other in dbgrid thanks in advance 回答1: You can easily implement this using the DBGrids onDrawColumnCell Event : procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if Table1.FieldByName('Teacher').AsString = 'Joe' then DBGrid1

Delphi DBGrid alternate row colors for all DBGrids in the project

拈花ヽ惹草 提交于 2019-12-22 18:36:23
问题 How can I make all my grids look the same way all over my forms? I want to implement an alternate row color that must be applied on all grids of my project. Is it possible without adding the same DrawColumnCell event code for every grid? I want to avoid adding the same code for each of my grids. I have like 30 grids in my project and multiplied by 13 rows of code it just adds a lot of code lines to my project making it "unfriendly". I am looking for a solution that will only add 13 lines of