Jump to content


Photo

Umstellung meiner Programme von Version 5 zu Version 6


  • Please log in to reply
4 replies to this topic

#1 Maik2

Maik2
  • Members
  • 9 posts

Posted 23 March 2025 - 11:17 AM

Hello Friends,
 
I'm finally in the process of converting my applications from NextDBGrid5 to version 6. However, I've encountered a few problems that I haven't been able to solve yet. Perhaps you have some tips and tricks for me.
 
1.) In version 5, I colored the rows of an NxDBGrid in different colors using OnCellColoring, starting with the 0th row (0 = light green / 1 = white / 2 = light green / 3 = white / 4 .......). Now I've seen that version 6 has the property AppearanceOptions - AlternatingRowColors. However, the following color sequence is selected (0 = white / 1 = light green / 2 = white / 3 = light green / 4 = white / 5 .......). Is there a way to apply the changed color starting with the first row?
 
2.) In version 5, I sorted the individual columns using OnSortColumn, and when I sorted to the 0th column, the sorting was completely reset, i.e., the sorting was disabled. How can I achieve the same behavior in version 6, i.e., deactivating the sorting, so that the NxDBGrid displays the original sorting as returned by the database? Perhaps using OnSortQuery?
 
3.) In version 5, I changed the font of a column to italics in CellFormatting due to certain values ​​in the database. I added the same behavior in version 6 using NxDBTextColumn6StyleText. The only thing I noticed is that if I move the display to the left using the horizontal scroll bar, everything is fine. Only if I then move the display relatively quickly using the mouse over the scroll bar back to the right do I see various artifacts in the selected last row. Currently, I have achieved this behavior using NextDBGrid6.Refresh; in OnHorizontalScroll? Is this the recommended approach?
 
 
Thanks for considering this suggestion!

Attached Files


Edited by Maik2, 23 March 2025 - 12:16 PM.


#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,242 posts
  • Gender:Male

Posted 23 March 2025 - 04:03 PM

Hello,

 

1) You can use OnGetCellColor event that now exists under View (e.g. NxRepoertView) class. It's work in the same way.

 

2) I think that OnSortQuery can help you. It's the same purpose.

 

3) I will try to fix it. You can at the moment turn-off focus rectangle (HideFocus set to True). But it's a bug and I will work on it.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Maik2

Maik2
  • Members
  • 9 posts

Posted 23 March 2025 - 10:33 PM

Hello Boki (Berg),
 
Thank you for your quick response to my questionssmile.png .
 
1 - Then I'm on the right track with my execution in the OnGetCellColor event. I just thought it would make sense to use the AppearanceOptions - AlternatingRowColors property for this in NextDBGrid6.
 
 
2 - As I said, I solved the problem of resetting the sorting on the first four columns in NextDBGrid5 using MySQL_DataModule.Bauvorhaben_Query.IndexFieldNames := '';. This approach doesn't seem to work in NextDBGrid6, though.
 
procedure TFormBauvorhaben.NextDBGrid1SortColumn(Sender: TObject; ACol: Integer; Ascending: Boolean);
var a:String;
begin
  if Ascending = true then a:='ASC' ELSE a:='DESC';

  if ACol < 4 then begin
    MySQL_DataModule.Bauvorhaben_Query.IndexFieldNames := '';
  end;

  if ACol = 4 then begin
    MySQL_DataModule.Bauvorhaben_Query.IndexFieldNames := 'BAUVORHABEN ' + a;
  end;

  if ACol = 5 then begin
    MySQL_DataModule.Bauvorhaben_Query.IndexFieldNames := 'PLZ ' + a;
  end;
 
  if ACol = 6 then begin
    MySQL_DataModule.Bauvorhaben_Query.IndexFieldNames := 'ORT ' + a;
  end;
end;
How can I reset the sorting in NextDBGrid 6, i.e. so that the grid displays the originally unsorted data again?
 
 
3 - Thank you for your effort. Please let me know if you find a solution.
 
 
Best Regards
Maik


#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,242 posts
  • Gender:Male

Posted 01 April 2025 - 12:59 AM

Hi Maik,

 

Unfortunately I was not able to understand the question about reseting sorting. For dynamical sorting, no reseting is required.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 Maik2

Maik2
  • Members
  • 9 posts

Posted 04 April 2025 - 08:14 PM

Hi Maik,

 

Unfortunately I was not able to understand the question about reseting sorting. For dynamical sorting, no reseting is required.

 

Hello Boki,
 
Sorry for not getting back to you sooner, but I've been away for a few days on business.
I'll try to explain my problem a little differently.
 
When I click on the header of a column to sort by that column, a small arrow appears, indicating the sorting direction
and the grid is sorted by that column as desired.
How can I make this arrow in the header disappear again to display the original database sorting in DBGrid V6?
 
For example, if I click on the header of the first four columns, as I solved it in version 5, since only NxDBIconColumns are displayed in those.
 
Thanks in advance and best regards, Maik
 

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users