Jump to content


nosx

Member Since 07 Aug 2014
Offline Last Active Sep 09 2014 09:26 PM
-----

Topics I've Started

Setting autoscroll to false does not work.

05 September 2014 - 06:26 PM

In all of my grids I have autoscrolling set to FALSE yet the icon still show up when I click on my middle mouse button (the wheel button) which starts autoscrolling mode. How do I completly turn off this behaviour if setting autoscroll to false does not work ?

Attached File  Untitled.png   34.51KB   4 downloads

Sharing code between multiple girds.

26 August 2014 - 07:31 AM

I am working on an application that has 7 grids on it laid out in tabs. I do alot of the same actions to each of these grids often like deleting rows, Adding new news etc.. What I want to do is create a ActionList Action whereby I can simply call the action and it will know which grid I am currenly focused on and then preform the action on the gird that is selected. I want to do this without the need to write CASE statements or a bunch if If statements and infact I don't even want to ever call the grids by their names in the code at all, but rather a generic Class name that works for all grids in the application. is this possible?

To put it another way I want to eliminate the need to write my code like this

ShowMessage(NextGrid1.Cells[1,1]);

where I have to specify the name of the grid everytime and instead I want to create an action something like this

ShowMessage(CurrentlyFocusedGrid.Cells[1,1]);

and it will show the contents of Cell 1,1 for whatever gird I have focused at the time.

The point of this is to cut down on redundent code so it's easier to maintain and requires I only write the code once for all the grids I have in my application be it 2 or 200.

TIA,
Nosx

Rowcount incorrect when using filters

20 August 2014 - 01:58 AM

As the title says, when filtering rows in a dbgrid, the Rowcount property does not take this into account and returns the wrong number. For instance if a grid has 20 rows before applying a filter and applying the filter returns only 5 of the 20 rows, the Rowcount property still returns 20 when it should return 5. Anyway solutions for this issue?

color cell in column 1 based upon value in column 2

07 August 2014 - 10:20 PM

I am using the following code to set the font color of a cell based upon it's value and this works fine. What I need to do now is change the color of a cell in ANOTHER column based upon this value as well. How would I do that ?

For example, Column 2 can contain two different values (Yes, No). What I want to do is alter the code below to change the TextColor of the cells in Column 1 & Column 2 both based upon the value in Column 2. What needs to change in the code below to make this possible?

Here is the code I am using to change the font color of a cell based upon it's value.

procedure TForm1.NextDBGrid1CellFormating(Sender: TObject; ACol,
ARow: Integer; Value: WideString; var TextColor: TColor;
var FontStyle: TFontStyles; CellState: TCellState);
begin
if (ACol = 2) then

if value = 'No' then
begin
TextColor := clRed;
end;
end;

Please note, The above question may imply that I want to just change the font color for all the cells in a row and this is not what I want to do. All I want to do is change the font color of the cells in columns 1 & 2 ONLY, Any other cells in the row should not be affected by this code.

[urgent] cell formatting causes cells to be selected.

07 August 2014 - 08:19 PM

You can delete this, I fixed the problem myself