Jump to content


[v5111] combobox can't be used if part of column is out of view ...


  • Please log in to reply
10 replies to this topic

#1 rond

rond
  • Members
  • 50 posts
  • Location:Lieshout, The Netherlands

Posted 16 February 2011 - 06:35 PM

I noticed that in every grid the columns would not show the combobox correctly (or at all) if part of the column was hidden from view.
All that's needed to was for part of the column to be one pixel outside of the grid.
If that happens the 'arrow'/button of the combobox would appear on the left side of the column, which makes it look like the control was drawn starting from outside the canvas area for the grid.

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 6,685 posts
  • Gender:Male

Posted 16 February 2011 - 11:42 PM

Hello Rond,

Unfortunately, InplaceEditor cannot be croped since they are controls as any other. Maybe grid can be scrolled a little bit to show cell completely.

Can you please send me a screenshot to I see in which situations this happen. Thank you.

Best regards
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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 rond

rond
  • Members
  • 50 posts
  • Location:Lieshout, The Netherlands

Posted 17 February 2011 - 11:22 AM

QUOTE (Boki (Berg) @ Feb 16 2011, 11:42 PM) <{POST_SNAPBACK}>
Hello Rond,

Unfortunately, InplaceEditor cannot be croped since they are controls as any other. Maybe grid can be scrolled a little bit to show cell completely.

Can you please send me a screenshot to I see in which situations this happen. Thank you.

Best regards


I've attached a screenshot.
As you can see the first column 'Activity' is not shown completely as the user has scrolled (the text in the grid says 'setup' in the first row and 'Filling' in the second).
The combobox should have appeared in the first cell of the first row.
As a result of this issue the combobox appears to have been placed where the indicator-column is (the black outline and 'button' are the combobox)

I think instead of trying to adjust the edit-control the column should scroll into view before entering edit-mode.

Attached Files



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 6,685 posts
  • Gender:Male

Posted 22 February 2011 - 02:01 AM

Hello Sir,

Grid should be automatically scrolled into view, after you select a cell.

If you can build me a small demo this will help to I quickly find a solution. thank you.

best regards
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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 rond

rond
  • Members
  • 50 posts
  • Location:Lieshout, The Netherlands

Posted 22 February 2011 - 11:03 AM

QUOTE (Boki (Berg) @ Feb 22 2011, 02:01 AM) <{POST_SNAPBACK}>
Hello Sir,

Grid should be automatically scrolled into view, after you select a cell.

If you can build me a small demo this will help to I quickly find a solution. thank you.

best regards

Could it be related to the fact that we've used onBeforeEdit and events to disable the editing on some cells ?

At the moment we've solved it by calling ScrollToColumn for the column in the OnBeforeEdit-event, which looks like this :
CODE

procedure TfrShiftProductActivity.NxdbgrdProductActivityBeforeEdit(
  Sender: TObject; ACol, ARow: Integer; var Accept: Boolean);
begin
  Accept := CanEditYN;
  if Accept then
    NxdbgrdProductActivity.ScrollToColumn(NxdbgrdProductActivity.Columns[aCol])
end;

Looking at the sources I only see similar things happen whenever the keyboard is used to select a cell.
Mouseclicks don't appear to trigger this.

#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 6,685 posts
  • Gender:Male

Posted 26 February 2011 - 10:11 PM

Hello Rond,

If you can tell me step by step how to reproduce this bug, I will be able to add fix into official release and you will not need to add additional code.

best regards
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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 rond

rond
  • Members
  • 50 posts
  • Location:Lieshout, The Netherlands

Posted 28 February 2011 - 10:53 AM

QUOTE (Boki (Berg) @ Feb 26 2011, 10:11 PM) <{POST_SNAPBACK}>
Hello Rond,

If you can tell me step by step how to reproduce this bug, I will be able to add fix into official release and you will not need to add additional code.

best regards

All that appears to be required is for a column that has a combo-box as the editor.
I've managed to repeat this behaviour in a NextDbGrid where the first column was a TNxLookupColumn.
I stretched one of the other columns to make sure I could scroll horizontally move that first column a bit outside of the grid.

#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 6,685 posts
  • Gender:Male

Posted 02 March 2011 - 01:45 AM

Hello Rond,

Please try to replace next code in NxCustomGridControl.pas:

CODE
procedure TNxCustomGridControl.RefreshCellEditor;
const
  RedrawEdit: array[Boolean] of DWORD = (SWP_NOREDRAW, 0);
var
  Column: TNxCustomColumn;
  EditRect, R: TRect;
begin
  Column := nil;
  if gtEdit in GridState then
    begin
      if (FEditingCell.X >= 0) and (FEditingCell.Y >= 0) then
        begin
      Column := Columns[FEditingCell.X];
        EditRect := GetCellRect(FEditingCell.X, FEditingCell.Y);
      Column.AdjustEditRect(GetRowLevel(FEditingCell.Y), EditRect);
      ExcludeGrid(EditRect); { exclude left and right grid lines }
      if not (goGrid in FOptions) then Dec(EditRect.Right);
          if EditRect.Top < GetBodyRect.Top then
            begin
            FInplaceEdit.Visible := False;
              Exit;
            end;
      if EditRect.Left < GetBodyRect.Left then EditRect.Left := GetBodyRect.Left; // <------- new line
        end;
    end else if gtInput in GridState then
  begin
    Column := Columns[FInputingColumn];
    EditRect := GetInputCellRect(FInputingColumn);
  end else Exit;

  InflateRect(EditRect, -1, -1);
  if EditRect.Left < 0 then EditRect.Left := 0;
  if EditRect.Left < GetBodyRect.Left then EditRect.Right := GetBodyRect.Left;

  with FInplaceEdit do
  begin
    ShowWindow(Handle, SW_HIDE);
        SetWindowPos(Handle, HWND_TOP, EditRect.Left, EditRect.Top,
        EditRect.Right - EditRect.Left, EditRect.Bottom - EditRect.Top,
        SWP_SHOWWINDOW or RedrawEdit[csRedrawInplaceEdit in Column.ColumnStyle]);
    Windows.SetFocus(Handle);
    R := ClientRect;
    InvalidateRect(Handle, @R, False);
  end;
end;

I hope that this helps.

Best regards
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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 rond

rond
  • Members
  • 50 posts
  • Location:Lieshout, The Netherlands

Posted 02 March 2011 - 10:46 AM

I will test modification in my next version.

#10 rond

rond
  • Members
  • 50 posts
  • Location:Lieshout, The Netherlands

Posted 02 March 2011 - 12:42 PM

That does indeed fix the initial issue.

I did notice that it still is possible for a user to hide too much of the column, which makes the selection difficult.
I guess that could be solved by setting the Listwidth to a value that makes sense. That way the list itself remains readable.

Additional testing revealed a similar issue for columns on the right hand side of the grid.
If that happens the 'dropdown button' of the combobox becomes unavailable to the user.

#11 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 6,685 posts
  • Gender:Male

Posted 23 March 2011 - 05:11 PM

Hello Rond,

Maybe you can use MinWidth property of column, to set it to number larger than 8.

Best regards
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users