Change the Delphi DbGrid scroll behaviour - delphi

I have a TDbGrid linked to a dataset with rows displayed in this grid.
When scrolling on the grid, it moves the selected row of the dataset, which means that if I want to go at the bottom of the grid, it browse every record and the record behind the grid only appears when I am at the bottom of the grid,
The behavior I except is : I want the screen to move but not my record selected ( so the only way to change row would be to click on the row).
Have you got any idea on how to do that?
The behaviour that I except is the same as in the 'Object inspector' of the IDE delphi 10.

This is not possible, the TDBGrid is designed such that it only holds the viewable records in its data buffer. So the selected record must be one in the viewable range. This is to minimize data exchange traffic between the server and the client.

Related

Delphi 10 TMS FireMonkey grid - problem with SelectRows() and RowSelectionCount

I am using TMS FireMonkey Grid in my app and currently trying to implement the ability to select a range of rows by double-clicking on the first row and then double-clicking on the last row of the range. I use the SelectRows(StartRow,EndRow) method in the OnCellDblClick event handler. It seems to work, except for one thing: the RowSelectionCount does not get set properly (equals 1, regardless how many rows I select) until I call ShowMessage() with something random, like 'Hi!' - after that it gets set to a correct number of selected rows. I figured it has something to do with focus, so I tried to use the SetFocus to change focus to another component of the form and then back to the grid, but that didn't help. Any ideas on how to get RowSelectionCount to carry a correct value right away?
The grid's SelectionMode property is set to smDisjunctRow - according to an email I received from TMS Support, this setting should allow me to use RowSelectionCount.
Thanks in advance!

Increase/Decrease a field in OpenOffice Calc

I'm trying to count (and sum up) different (physical) items and input those counts in a spreadsheet. Is there a way to increase (or decrease) an integer in a field in OpenOffice Calc? Mouse or keyboard input.
Either a shortcut+macro combination or something along the lines of these (fictive) arrows:
i.e. pressing up would increase the field to value 43
In fact I would be happy for any suggestion for an open programme that would digitalize such input and produce some sort of csv or similar output.
Via View - Toolbars - Form Controls get the toolbar Form Controls visible.
There you have Spin Button control (see tooltips).
Insert this on the sheet by clicking it and pull the size of it with the mouse. Pull it longer than width.
Right click the control and select Control... from the context menu.
On the Data tab set the Linked cell to A3 for example.
Now switch the design mode to off by clicking the corresponding button at the toolbar Form Controls (see tooltips).

I need a DBGrid OnAfterCellClick

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 Locate in the grid-2 OnCellClick I
want it to show Gum but grid two is still
internally on Flowers and stays on Dirt
It seems that the grid does not change to the Row until after the OnCellClick event.
I need an AfterCellClick event.
Can someone please shed some light on how to go about that?
Thanks
You shouldn't be using OnCellClick. Use the TDataSet.OnAfterScroll instead. It's called automatically when the record (row) pointer is moved, after the movement is done. This means that when the grid attached to the second table is clicked and the record pointer is moved from Flowers to Trees, the second table's OnAfterScroll event will be fired after the row changes, and in that event handler you can do the appropriate Locate in the third table.

How can I restore a TDBGrid record view to the condition before a refresh? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to avoid TDbgrid scrolling when returning to a previous location
I am looking for a way to save and restore the vertical scrolling position of a Delphi TDBGrid after a refresh has occurred. Currently, the grid resets itself so that the selected record appears in the middle of the list of records.
At first, the properties LeftCol and TopRow appeared to be the solution, but only LeftCol works. The TopRow value is always 1 and never changes. It appears to be a position into the internal record buffer of the grid, which is set to the number of rows displaying in the grid. That is, it appears that FBuffers slides up and down, but TopRow remains 1 at all times.
A detailed example of what I'm seeing is:
The grid displays 11 records of a TClientDataSet, starting with record 5, displayng sequentially to record 15.
The selected record cursor is on record 15 (the last record in the view).
The dataset is refreshed through a TDataSetProvider linked to a TADODataSet. (An .Open or .Refresh call).
The dataset.Locate method is used to retain the actual selected record in the face of insertions/deletions.
The grid changes so that record 15 is in the center and it is displaying records 10 through 20.
Is there anything that can be saved/restored/performed so that the grid can be restored to its original viewing configuration showing records 5-15 with the cursor on the same selected record, wherever it appears?
The closest thing I can find in my many search attempts is an issue that was solved in Delphi 3.0 with TopRow, LeftCol, here: http://www.delphigroups.info/2/79/314206.html
Spelunking through DBGrids.pas isn't netting me a method of locating the buffer pointers relative the underlying dataset records either.
Seems that these questions should give you the answer:
How to avoid TDbgrid scrolling when returning to a previous location
Delphi - restore actual row in DBGrid
(esp. this answer)

How to reorder fields in an ORBEON Form

I understand that the layout in Orbeon Forms is grid-based, but even inside a grid of let's say 10 rows and 5 columns, If I happen to want to shift the 8th row to the 3rd row using the Visual Form Builder, how would I do that?
In general, is it possible to reorder the fields or sections within the Orbeon Designer using the MOUSE?
Currently you cannot reorder grid rows or columns, with or without a mouse (if by that you mean using drag-and-drop. But it's a great suggestion for the Orbeon Forms authors.
At this point, what you can do is this:
insert a new empty row
using the toolbox, "cut" the first control you want to move
using the toolbox, "paste" into the first cell of the new row
repeat the last 2 steps
It's painful but it will work.
Or, you can move the row directly within the source of the form, by moving the in the grid to the new place.
Note that while drag-and-drop would be great, it's not actually strictly needed: buttons and keyboard shortcuts can get you there too.

Resources