Jump to content


Photo

Major problems with SlideStyle


  • Please log in to reply
38 replies to this topic

#1 Taifun

Taifun
  • Members
  • 27 posts

Posted 22 April 2008 - 03:29 PM

Hello,

we would like to use the NextGrid with SlideStyle in our next product, but currently the SlideStyle has too many problems.

The major problems lie within the drawing of the slides.
Some examples:
When you have SlideStyle with OnSlideColoring Event like this:
CODE
procedure TFrameMain.SlideColoring(Sender: TObject; Index: Integer; var SlideColor, GridColor: TColor; SlideState: TSlideState);
begin
  if Index mod 2 = 0 then
  begin
    SlideColor:=$00E8E8E8;
  end;
end;

Now you have more rows than fits into the visible grid and the last visible row is only partially visible.
If you now click on this last row, the grid will scroll a little bit to show the whole row. Afterwards the row will have both colors (see attachment).

Next thing:
I changed the SlideSize to 60. Now the drawing is totally off ...
Some rows are higher, some smaller. The selection has not the same rect like the slide-frame (see also attachment).

Also there is no Font-Property for the SlideCaption. It's always drawn in Gray and without other styles (like bold).
Currently I changed the font-properties directly in your sourcecode (TNxCustomGridControl.DrawSlideCaption), but now the captions are truncated (see attachment).
This change doesn't affect the above descripted problems.

Last thing:
It would be really nice to have an Event for drawing custom things on the Slide (e.g. OnCustomSlideDraw).
There you could draw lines or images directly into the rect of the slide row.

These things are really important for us.
Thanks in advance. And apart from that you're components are awesome!
Regards,
Taifun

Attached Files



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 22 April 2008 - 03:36 PM

Hello Taifun,

I will answer you in next 1 hours. To see where are problems.

Best regards
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 Taifun

Taifun
  • Members
  • 27 posts

Posted 22 April 2008 - 03:38 PM

Hello Boki,

this would be nice. Thanks!

Regards,
Taifun

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 22 April 2008 - 04:16 PM

Hello,

1st problem.

1) Set AutoScroll to False of NextGrid.

2) Open NxCustomGrid.pas file (in Sources\Next Grid sub-folder)

3) Locate part of code:

CODE
    end;
    { 6/25/07:  if click cell is partialy visible,
                we will scroll down to show it }


replace it with

CODE
    { 6/25/07:  if click cell is partialy visible,
                we will scroll down to show it }
    SelectCell(ACol, ARow, Shift, Deselect);
    case GridStyle of
      gsSlides: if GetSlideRect(ARow).Bottom > GetBodyRect.Bottom then VertScrollBar.Next;
      gsReport: if CellRect.Bottom > GetBodyRect.Bottom then ScrollToRow(ARow);
    end;
  end;


Please tell me how it works and we may continue smile.gif

Best regards
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 Taifun

Taifun
  • Members
  • 27 posts

Posted 22 April 2008 - 04:36 PM

Hello Boki,

this made the first problem a lot better.
I also needed to overwrite these two lines, right?
CODE
{ 6/25/07:  if click cell is partialy visible,
                we will scroll down to show it }
    if CellRect.Bottom > GetBodyRect.Bottom then ScrollToRow(ARow);  <-- this
    SelectCell(ACol, ARow, Shift, Deselect);                                          <-- and this


This works very well, except of one thing:
Now the Selection-Frame is sometimes not erased properly (see attachment).

Regards,
Taifun

Attached Files



#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 22 April 2008 - 04:43 PM

Hello here is a complete procedure:

CODE
  procedure BodyMouseDown;
  var
    ACol, ARow, XL, YL: Integer;
    ClickBodyRect, CellRect: TRect;
    AColumn: TNxCustomColumn;
  begin
    if (gtEdit in GridState) or (gtInput in GridState) then
    begin
      ApplyEditing;
      if gtInput in GridState then AddRowFromInput;
      EndEditing;
    end;

    ClickBodyRect := TCalcProvider.ResizeRect(GetBodyRect, 0, 0, -1, 0);
    case GridStyle of
      gsReport: InputSelected := False;
    end;

    ACol := FMouseDownCell.X;
    ARow := FMouseDownCell.Y;

    FClickOnSelected := IsSameCell(FMouseDownCell, SelectedCell);

    { 02/29/08: If multi-select is enabled and user click on already selected cell, we will exit
                to give possibility for Drag & Drop }

    if (goMultiSelect in Options)
      and (goSelectFullRow in Options) then { multi-select? }
    begin
      if RowExist(ARow) and GetSelected(ARow) and Dragging then
      begin
        Deselect := False;
        FCanDeselect := True;
      end;
    end;

    { 4/16/07:  In slides mode, column may be out-of bounds }
    if not RowExist(ARow) then Exit;
    FMouseDownRow := ARow;
    if (ARow < 0) or (ARow >= RowCount) then ARow := SelectedRow;
    if (ACol < 0) or (ACol >= Columns.Count) then ACol := SelectedColumn;

    { Column Play }
    AColumn := Columns[ACol];
    CellRect := GetCellRect(ACol, ARow);
    if Assigned(AColumn.Play) and ((coEditing in AColumn.Options)
      or (csClickable in AColumn.ColumnStyle)) then
    begin
      if (ARow >= 0) and (ARow < RowCount) then
      begin
        with CellRect do
        begin
          XL := X - Left;
          YL := Y - Top;
          if not ReadOnly and UpdateColumnPlay(ACol, ARow, CellRect) then
            Columns[ACol].Play.MouseDown(Button, Shift, XL, YL);
        end;
      end;
    end;
    { 6/25/07:  if click cell is partialy visible,
                we will scroll down to show it }
    SelectCell(ACol, ARow, Shift, Deselect);
    case GridStyle of
      gsSlides: if GetSlideRect(ARow).Bottom > GetBodyRect.Bottom then VertScrollBar.Next;
      gsReport: if CellRect.Bottom > GetBodyRect.Bottom then ScrollToRow(ARow);
    end;
  end;


I think that I have found one more bug fix for you:

Inside NxCustomGrid.pas find and replace next procedure:

CODE
procedure TNxCustomGridControl.SetSlideSize(const Value: Integer);
begin
  FSlideSize := Value;
  UpdateVertScrollBar;
  Invalidate;
end;


I hope that this helps.
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.

#7 Taifun

Taifun
  • Members
  • 27 posts

Posted 22 April 2008 - 05:08 PM

Hello Boki,

thanks again for your fast reply.

Your second idea (with TNxCustomGridControl.SetSlideSize) seems not to make any difference.
I have attached one more screenshot, in which you can see really good, how the drawing wents of.
This happens, after scrolling a while (with the mouse-scroll, or directly with the bar).
You can see how the background-rects and selection-rects are off. Some grid-lines get drawn bigger and selection-frames doesn't get redrawn.

This is really weird.
Regards,
Taifun

Attached Files



#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 22 April 2008 - 05:20 PM

Hello Taifun,

Can you please tell me does AutoScroll option of grid is turned on?

Best regards
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.

#9 Taifun

Taifun
  • Members
  • 27 posts

Posted 22 April 2008 - 05:22 PM

No, its off.
Was never on.

#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 22 April 2008 - 05:29 PM

Hello Taifun,

Can you please prepare for me one small demo project with several rows to I test it and see a difference. Unfortunatelly I can't spot them. I am sure that this will help.

Thank you.
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.

#11 Taifun

Taifun
  • Members
  • 27 posts

Posted 22 April 2008 - 05:58 PM

Hello Boki,

this was a great idea!!! While I made the test-demo I found the culprit!!!
The problem is the AppearanceOption ao3DGridLines. I set these to true some time ago and I've not seen any difference, then I forgot to turn it off again. If ao3DGridLines is true, the offsets of the slides get off.

When I turn it off, everything seems fine!!! smile.gif
(I've scrolled a while but didn't get any weird drawings)

Seems like the main two problems are solved (at least for me, dunno whats with ao3DGridLine). Thanks for that!
Now only two things remain open: Font-Property for SlideCaption and CustomDraw for Slides.

Regards,
Taifun

#12 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 22 April 2008 - 06:01 PM

Hello Taifun,

I will now enable 3d lines to see are there some drawing glitches.

I will also think about this 2 properties too.

Best regards
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.

#13 Taifun

Taifun
  • Members
  • 27 posts

Posted 23 April 2008 - 03:06 PM

Hello Boki,

the whole drawing problem is sadly not gone yet.
Our new product will run on a so called UMPC (a Windows XP system computer just a bit bigger than a PocketPC) with TouchScreen.
These UMPC have hardware buttons which normally sends a WM_KEYDOWN with the Arrow-Keys (up, down, left, right) to the focused control.
They do this in "repeated mode", means: if you hold down e.g. the arrow down button, the keystroke is send repeatedly to the control.

This produces drawing errors sad.gif

You can test this, when you add a button with the following code in OnClick:
CODE
procedure TFormMain.Button1Click(Sender: TObject);
var
  I: Integer;
begin
  for I:=0 to 3 do
  begin
    SendMessage(NextGrid1.Handle,WM_KEYDOWN,VK_DOWN,0);
  end;
end;


I hope we can find a solution for that wink.gif
Any new on the others things?
Regards,
Taifun

#14 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 23 April 2008 - 03:50 PM

Hello Taifun,

As I may see this is normal, only grid is drawn faster. In my example grid , your code select 3 rows bellow smile.gif

Best regards
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.

#15 Taifun

Taifun
  • Members
  • 27 posts

Posted 23 April 2008 - 04:26 PM

Hello Boki,

I didn't quite get what you wrote. Do you mean, that the drawing errors are normal???
If I do the same thing with a normal StringGrid, everything draws fine. The selection just moves down 3 times.

Regards,
Taifun

#16 Taifun

Taifun
  • Members
  • 27 posts

Posted 28 April 2008 - 09:45 AM

Hello Boki,

any news on the things regarding SlideStyle?

Regards,
Taifun

#17 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 28 April 2008 - 02:06 PM

Hello Taifun,

I am not sure that I understand. With your code my slide is only fastly scrolled down by 3 steps. All normal, without any drawing errors. Maybe I didn't understand where is a problem with touch device.

Best regards
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.

#18 Taifun

Taifun
  • Members
  • 27 posts

Posted 28 April 2008 - 03:08 PM

Hello Boki,

for me it looks like the screenshot that I've attached.

You need to have more rows than visible to really scroll down. Mostly it happens after the second "real" scroll down (so you need to have enough rows to scroll a while).
Maybe you also need to have different row colors to see the error.

Regards,
Taifun

Attached Files



#19 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 28 April 2008 - 03:15 PM

Hello Taifun,

Once again maybe small demo will help smile.gif

For me all worked fine. Also, maybe downloading new version may help too?

Best regards
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.

#20 Taifun

Taifun
  • Members
  • 27 posts

Posted 28 April 2008 - 03:45 PM

Hello Boki,

I have the current version: 4.4.08.1
I made a small demo app. I've also found another bug, which you can reproduce with the app.

1. Error: ScrollBug
Select a row in the grid and click 2-4 times on the Button "Scroll Down".
You should see the drawing errors.

2. Error: Hiding Rows
Select some other option in the ComboBox. This hides some rows and the drawing is totally off.

Hope this helps to find the bugs.
Regards,
Taifun

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users