Jump to content


deonvn's Content

There have been 6 items by deonvn (Search limited from 19-April 23)


By content type

See this member's

Sort by                Order  

#18464 Problem with Programmatically Selecting a Row.

Posted by deonvn on 31 March 2016 - 09:40 AM in NextGrid Component

Hi Steve

 

This has always been the case. SelectedCount returns the number of rows that are currently selected in a multi-select situation. Even if SelectedCount is greater than zero, SelectedRow might still be -1.

 

Because of this, you should always check if the row indicated by SelectedRow actually exists before using it.

if NextGrid1.RowExist(NextGrid1.SelectedRow) then
  begin
    ...
  end;

After you've indicated which rows are selected (in multi-select environment) you should then also indicate which one of the selected rows is the "currently selected" row (there can be only one).

for I := 0 to NextGrid1.RowCount -1 do
  begin
    if I mod 2 = 0 then
      NextGrid1.Row[I].Selected := True;
  end;

NextGrid1.SelectedRow := 4;

 




#18146 Where is V6 for Delphi XE?

Posted by deonvn on 31 October 2015 - 11:02 AM in General Discussion

Hi Boki

 

Thanks. I have now installed most of the packages and everything seems to be working. I still can't compile or install NxDBGrid6Dsgn (it fails with NxDesignWindow6.dcu not found) but since I don't actually use the DBGrid it's OK for now. I can carry on testing in the meantime.

 

Regards,




#18133 Where is V6 for Delphi XE?

Posted by deonvn on 30 October 2015 - 08:34 AM in General Discussion

Hi Boki

 

The first issue is the STYLE_ELEMENTS define. It looks like style elements were only introduced in XE3 - not XE2. I solved that by editing the INC file. Then it started complaining that "Never Build Package NxGridRun6 requires always build package NxStandard6". I could solve that by changing NxGridRun6 to from "Explicit Build" to "Rebuild as Needed". Then NxDBGridDesign6 wouldn't compile because it couldn't find NxWindowDesign6.dcu (or something like that). I could solve that be setting the search path for that package directly to the package output folder where the .dcu file was located. Then it started complaining that it couldn't find NxToolPalatte6 and started asking if I wanted to ignore missing properties. Around there is were I gave up :-(

 

I'll wait until you've got a working package for XE2 before trying to install it again.




#18125 Where is V6 for Delphi XE?

Posted by deonvn on 29 October 2015 - 07:18 AM in General Discussion

Hi Boki

 

Any news on when we can expect the XE2 version?




#18110 Where is V6 for Delphi XE?

Posted by deonvn on 19 October 2015 - 09:28 AM in General Discussion

Hi Boki

 

Still no packages for XE2? (The XE and XE3 packages don't work in XE2)




#17895 CalculateFooter on sum() bug

Posted by deonvn on 16 April 2015 - 10:41 AM in NextGrid Component

Hi Boki

 

Before you change anything in the ColumnSum procedure, I don't think that is the problem.

 

The ColumnSum procedure was written the way that it is because the Sum parameter will already contain the value of the first visible row passed to it from the CalculateColumn function. That is also why the "for" loop in ColumnSum starts from 1 and not from 0 - because the value of this column for the first visible row has already been passed into this procedure from the CalculateColumn function.

 

I think the real problem is here:

  function CalculateColumn(Index: Integer; FormulaKind: TFormulaKind): Double;
  var
    i: Integer;
    FormulaSum: Double;
    s: WideString;
    sl: TStringList;
  begin
    FormulaSum := 0;

    if (not VisibleOnly or RowVisible[FFirstVisibleRow])
      and (FormulaKind <> fkCount)
      and (FormulaKind <> fkCustom)
        then FormulaSum := Cell[Index, FFirstVisibleRow].AsFloat;

Why are you checking RowVisible(FFirstVisibleRow)? Won't that always return True? Also, the value of FFirstVisibleRow doesn't stay correct if you re-sort the column - the next time you call CalculateFooter, FFirstVisibleRow will be zero (even if Row 0 is not visible).

 

If this is the source of the problem, then changing the ColumnSum procedure will not fix it. You will still have the same problem for columns using fkMaximum and fkMinimum as well.

 

Perhaps it would be better to remove the:

    if (not VisibleOnly or RowVisible[FFirstVisibleRow])
      and (FormulaKind <> fkCount)
      and (FormulaKind <> fkCustom)
        then FormulaSum := Cell[Index, FFirstVisibleRow].AsFloat;

from the CalculateColumn function completely and then change the "for" loops in fkMaximum, fkMinimum and ColumnSum from:

for i := 1 to Pred(RowCount) do

to

for i := 0 to Pred(RowCount) do

so that they always loop through all rows and not skip the first visible row. (Then there will also be no more need to pass a var Parameter to ColumnSum, as the Sum will then always start from zero. In fact, ColumnSum can then be changed to a function that just returns the Sum).

 

PS: As mentioned above, there is also a bug where the value of FFirstVisibleRow is not always correct. Using NextGrid.RowVisible[0] := False will update FFirstVisibleRow the first time, but FFirstVisibleRow is then reset to zero again (when the column is sorted, I think). Using NextGrid.Row[0].Visible := False doesn't update FFirstVisibleRow at all - it will still be zero.

 

Cheers