tdbgrid

Delphi dbgrid continuous scrolling

a 夏天 提交于 2019-12-21 04:54:08
问题 I'm making an application that holds orders and prints invoices. I have some labels, tedits, tmemos, buttons, a datasource, an adotable, a popupmenu, and a dbgrid on my form. When I build the program and scroll down the dbgrid scrollbar, it scrolls after I release mouse button. But i want continuous scrolling. Greetings 回答1: That's called thumb tracking. Derive a new class to override scrolling behavior. Example of using an interposer class: type TDBGrid = class(DBGrids.TDBGrid) private

How do I get screen coordinates of the DBGrid cell

微笑、不失礼 提交于 2019-12-19 07:58:10
问题 I want to show popup button or fancy message (with coloured background, etc) just under right-bottom corner of particular cell of the current row. For now I only figured how to get grid coordinates: x = DBGrid.DataSource.DataSet.RecNo y = DBGrid.Columns[index] There is also TCustomGrid.CellRect, which would do what I want, but it's protected and I don't want to inherit and create another component class. One crazy workaround I can think of is to save TRect-s in onDrawColumnCell event to some

Get Column Object for DataSet Field

两盒软妹~` 提交于 2019-12-13 01:34:32
问题 Let's say, I have a set of TField objects and want to change their visibility in some DBGrid dynamically. I also want to allow users to change column order in this DBGrid, and have some fixed columns. I know proper way to hide/show columns on DBGrid, but there is a big, big design flaw in VCL: having Column object, one can travel to it's Field object, but cannot find way back. All I want is just kind of Column property inside Field object, so I can type something like this: Field.Column

Reassigning a datasource at run-time

对着背影说爱祢 提交于 2019-12-12 12:24:49
问题 I did some searching and only found more unanswered questions. :) Using D5pro. I want to reassign the DataSource to a TDBGrid at run time. I have seven identical structured DataSets and depending on a button click I want the appropriate DataSet displayed in the grid. I have tried everything and I cannot get it to show the next DataSet. It sticks with the first one assigned at start up. I am getting to overkill approaches and still nothing is working. Here's where I am at the moment. procedure

Delphi - Using DBGrid to select rows from a search

女生的网名这么多〃 提交于 2019-12-12 06:44:27
问题 I have searched a database using a query. The results of the search are displayed in a DBGrid component for the user to select the row s/he wishes to proceed with. DBGrid always sets the record pointer to the first record in the results set, so a row is always "selected" by default. I need to change this behaviour to no row being selected when the data is first presented so that I can determine if the user has actually made a selection. Is it possible to tell if no selection has been made, i

I need a DBGrid OnAfterCellClick

痴心易碎 提交于 2019-12-12 01:15:53
问题 I have three DBGrids and three Tables, and two of them are linked with Master Fields and work as expected. When the user clicks on grid-1, it shows three items in grid-2. When the user clicks on grid-2, I want to use Locate to select the Row in grid-3 Problem is that the grid-2 OnCellClick event is fired before the data has changed to the appropriate Row. e.g. Grid-2 Flowers <-- this has focus and Dirt has focus in grid-3 Weeds Trees <-- then I click here Grid-3 Dirt Water Gum <-- and using

Select Multiple Rows on Shift+Click in DBGrid

筅森魡賤 提交于 2019-12-11 19:12:19
问题 I need to write the code to select multiple rows on Shift+MouseClick, so that I am able to fill down the values. Is there any way I can do it? My DBGrid options are as follows: dbGrid1.Options = [dgEditing, dgAlwaysShowEditor, dgTitles, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit, dgMultiSelect] 回答1: I originally thought that a problem you would be likely to have with this is that Shift + Click is handled by the grid itself, so the time the Grid's OnMouseUp fires, the grid

My Time Field in my DBGrid is showing the date and time instead of time only - delphi

試著忘記壹切 提交于 2019-12-11 14:17:17
问题 I have a field in my database called 'Times', it's a date/time format and its format is set to 'short time'. In my database the date does not show, nor is it being add to the database as I know. It is only the time value. My DBGrid shows the time field with the time value and the date '12/30/1899'. How do I get rid of the date in my time field. Here is the code I used to submit to the database. Get time value: bookingtimes:= timeof(dttime.Time); Submit to Database: tblbooking.FieldByName(

ReadOnly TDBGrid/TwwDBGrid Cell in Delphi?

随声附和 提交于 2019-12-11 12:55:40
问题 is it possible to set a TDBGrid (or TwwDBGrid) cell ReadOnly in Delphi? Currently I am fiddling around with literally greying the cell and clearing it after an edit, but it's not very satisfactory. Cheers, Jamie 回答1: Specific cell or all cells in one column? You may setup a column to read only in this way: TDBGrid.Colums[IndexOfColumn].ReadOnly := True; If you want to control a specific cell then you could try to program a "protection" scheme in the OnCellClickEvent. I guess you could even

How to adjust DBGrid columns width automatically

江枫思渺然 提交于 2019-12-08 09:50:08
问题 I've been try to use this Delphi code with C++ Builder XE. I manually convert the language into C++ Builder language. This procedure was working correctly. When I try to maximize the form holding the DBGrid, this procedure successfully split the columns width according to the grid width. However, if I try to minimize the form width using mouse control at the right or left of form, this procedure weren't adjust the column width to the length of the values or length of the labels on each