dbgrid


How to refresh dbgrid without close and open dataset in delphi?

半城伤御伤魂 提交于 2020-01-02 02:48:07
问题 I need to refresh dbgrid constantly, in real time. Close and open dataset works fine, but blink the dbgrid. What can I do to avoid this? I'd like a solution like Ajax, that update only the necessary. Thanks 回答1: Have you tried to use Disable- & EnableControls ? DataSet.DisableControls; try DataSet.Close; DataSet.Open; finally DataSet.EnableControls; end; Furthermore, it should be possible to just call DataSet.Refresh instead of closing and opening to get the same result. 回答2: I use this in my

How to find the actual width of grid component with scrollbar in Delphi

元气小坏坏 提交于 2019-12-29 08:08:10
问题 I have a grid component (DBGrid) which has lots of columns on it. Because of large number of columns, a scrollbar was created, and thus some part of grid remains hidden. I need to find out what is the real width of DBGrid, including the part which is not shown due to scroll bar. But Width property gives only the width of the component itself. Anybody has any idea? 回答1: Perhaps this may be helpful. It is part of a class helper for TDBGrid that auto sizes the last column, so that the grid has

Delete and refresh a record in DBgrid where u maintain the same position

喜欢而已 提交于 2019-12-25 05:25:33
问题 I have a small database I'm using dbgo, I have a DBgrid displaying my records, I need to know how to delete a record and refresh the database where the index arrow stays in the same position or at least go to the next? but currently my index arrow jump to start form the beginning each time I refresh ! 回答1: Just keep and reset Recno var I:Integer; ....... I := Ads.Recno; Ads.Delete; Ads.Recno := I; an example implementation for usage with DBNavigator could be Procedure DeleteAndKeepRecno(Ads:

DBGrid stop current Row moving

天涯浪子 提交于 2019-12-25 03:48:23
问题 Using d5, TDBGrid, SQLite3 and ZEOS. Database has 2000 items, one Column is an "Active" as Boolean, a second Column is "ItemName" as Text, and IndexFiledNames is "ItemName' OnDblclick toggles "Active" On/Off and all works as expected for the Data . Active changes from True to False and back again. But, if I double-click on the last visible Row of the DBGrid, to toggle the Active state -- after the toggle, the DBGrid moves that item Row to the vertical center Row-position of the grid. This is

Tlistview - There is any component like Tlistview but with DB access?

↘锁芯ラ 提交于 2019-12-24 22:47:39
问题 I've been trying to make a creative thing to avoid the dbgrids , and i've found the Tlistview (using the one from alphaskins , tslistview ), and seems to be a nice way! The problem is, I don't want to code the event onclick on every tlistview to position a record/dataset according to the item I selected on the tlistview .. and I'm doing it with the tlistview item's caption .. and there could be records with the same names Here is one of the codes I want to avoid: with q_find_process do begin

How to catch scrolling event in DBGrid in Delphi

99封情书 提交于 2019-12-24 13:33:55
问题 I have a DBGrid, I need to run some code, each time the horizontal scrollbar is used. I couldn't find such event in DBGrid. Can you advise something? 回答1: Maybe this will help. It shows an example for trapping the scrolling events of a regular TStringGrid. Synchronize the Scrolling of two TStringgrids? 回答2: There is a WMHScroll procedure in TCustomGrid, but it is private. You can't use it in a DBGrid. You would have to create your own TDBGrid descendant and do your own procedure WMHScroll(var

DBGrid with read ahead capability using ADO

故事扮演 提交于 2019-12-23 20:53:19
问题 I'm working with ADO connecting to SQL Server 2005. My TADODataSet selects 1 million records. using a TDBGrid and setting the TADODataSet.CursorLocation to clUseServer works. but the TDBGrid chokes! How can I select 1 million records, avoid paging, and still be able to display records in the grid without fetching ALL records to the client side, letting the Grid read ahead as I scroll up and down? SQL enterprise manager can execute a query and select 1 million records asynchronously without

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

How to Format a DBGrid Column to Display Two Decimal Places? [duplicate]

蹲街弑〆低调 提交于 2019-12-22 05:02:00
问题 This question already has answers here : Setting a DBGrid column format in Delphi (3 answers) Closed 4 years ago . I would like to format specific cells to force two decimal places. The data is coming from an ElevateDB stored procedure and hooked into a TDataSource. EDIT: SQL Programming Note: I wasn't sure if this was just an ElevateDB issue or not. Before knowing about the Fields Editor , I attempted to format the data at the SQL level by using a CAST (NumericField as varchar(10)) statement

How to fix owner draw anomaly in DBGrid?

折月煮酒 提交于 2019-12-12 09:29:38
问题 Continuing with the project started in: How to auto fit/scale DBGrid's (or other similar) columns widths according to its contents? I used the @alzaimar answer to auto fit the columns according to their content width, but he showed me how to increase the width, but not how to decrease, so I complemented the code as shown above: procedure TRecordsBrowserFrameBase.JvDBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); var h, p, g,

工具导航Map