Hi, Boki.
I think this will not be so easy as the missing DoDeselectCell() in DeleteRow(), for example.
When I debug, I see multiple calls to UpdateHorzScrollBar() and in one of this calls, the last column`s
"Visible" property very strangely is shown as TRUE in the watches - may be this points to the root of
the bug ...
- Bergsoft Forum
- → Viewing Profile: Posts: IVO GELOV
Community Stats
- Group Members
- Active Posts 7
- Profile Views 4,554
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
0
Neutral
User Tools
Friends
IVO GELOV hasn't added any friends yet.
Latest Visitors
Posts I've Made
In Topic: Workaround for wrong horizontal scroll bar
01 May 2009 - 06:25 PM
In Topic: Bug with Inheritance
30 April 2009 - 03:46 PM
Hi, Boki.
Okay, I will explain in more detail.
I have 2 forms. The 1st is defined like this:
and the second one is defined like this:
Without the fix, we see this funny picture (
wrong.gif 10.87KB
5 downloads),
and with my fix applied - we see how it should look alike (
right.gif 9.12KB
4 downloads)
I hope this is already well described
Okay, I will explain in more detail.
I have 2 forms. The 1st is defined like this:
CODE
object baseFirma: TbaseFirma
Left = 224
Top = 600
Width = 455
Height = 230
Caption = 'baseFirma'
Color = clBtnFace
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 13
object baseGrid: TNextGrid
Left = 0
Top = 40
Width = 447
Height = 162
Align = alBottom
AppearanceOptions = [aoHighlightSlideCells]
AutoScroll = True
EnableVisualStyles = False
HeaderStyle = hsOldStyle
Options = [goDisableColumnMoving, goGrid, goHeader, goSelectFullRow]
ReadOnly = True
PopupMenu = TntPopupMenu1
TabOrder = 5
TabStop = True
object colName: TNxTextColumn
DefaultWidth = 445
Font.Charset = RUSSIAN_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Header.Caption = #1053#1072#1080#1084#1077#1085#1086#1074#1072#1085#1080#1077
Options = [coAutoSize, coCanSort, coDisableMoving, coPublicUsing, coShowTextFitHint]
ParentFont = False
Position = 0
Sorted = True
SortType = stAlphabetic
Width = 445
end
end
end
Left = 224
Top = 600
Width = 455
Height = 230
Caption = 'baseFirma'
Color = clBtnFace
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 13
object baseGrid: TNextGrid
Left = 0
Top = 40
Width = 447
Height = 162
Align = alBottom
AppearanceOptions = [aoHighlightSlideCells]
AutoScroll = True
EnableVisualStyles = False
HeaderStyle = hsOldStyle
Options = [goDisableColumnMoving, goGrid, goHeader, goSelectFullRow]
ReadOnly = True
PopupMenu = TntPopupMenu1
TabOrder = 5
TabStop = True
object colName: TNxTextColumn
DefaultWidth = 445
Font.Charset = RUSSIAN_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Header.Caption = #1053#1072#1080#1084#1077#1085#1086#1074#1072#1085#1080#1077
Options = [coAutoSize, coCanSort, coDisableMoving, coPublicUsing, coShowTextFitHint]
ParentFont = False
Position = 0
Sorted = True
SortType = stAlphabetic
Width = 445
end
end
end
and the second one is defined like this:
CODE
inherited frmUser: TfrmUser
Left = 297
Top = 365
Caption = #1057#1087#1080#1089#1098#1082' '#1089' '#1087#1086#1090#1088#1077#1073#1080#1090#1077#1083#1080#1090#1077
PixelsPerInch = 96
TextHeight = 13
inherited baseGrid: TNextGrid
inherited colName: TNxTextColumn
DefaultWidth = 285
Width = 285
end
object colRole: TNxTextColumn
Header.Caption = #1044#1083#1098#1078#1085#1086#1089#1090
MinWidth = 32
Options = [coAutoSize, coCanSort, coDisableMoving, coPublicUsing, coShowTextFitHint]
Position = 1
SortType = stAlphabetic
end
object colActive: TNxCheckBoxColumn
Alignment = taCenter
DefaultWidth = 60
Header.Caption = #1040#1082#1090#1080#1074#1077#1085
Header.Alignment = taCenter
MinWidth = 32
Options = [coAutoSize, coDisableMoving, coPublicUsing]
Position = 2
SortType = stBoolean
end
object colUser: TNxTextColumn
Header.Caption = 'Username'
Position = 3
SortType = stAlphabetic
Visible = False
end
object colPass: TNxTextColumn
Header.Caption = 'Password'
Position = 4
SortType = stAlphabetic
Visible = False
end
end
end
Left = 297
Top = 365
Caption = #1057#1087#1080#1089#1098#1082' '#1089' '#1087#1086#1090#1088#1077#1073#1080#1090#1077#1083#1080#1090#1077
PixelsPerInch = 96
TextHeight = 13
inherited baseGrid: TNextGrid
inherited colName: TNxTextColumn
DefaultWidth = 285
Width = 285
end
object colRole: TNxTextColumn
Header.Caption = #1044#1083#1098#1078#1085#1086#1089#1090
MinWidth = 32
Options = [coAutoSize, coCanSort, coDisableMoving, coPublicUsing, coShowTextFitHint]
Position = 1
SortType = stAlphabetic
end
object colActive: TNxCheckBoxColumn
Alignment = taCenter
DefaultWidth = 60
Header.Caption = #1040#1082#1090#1080#1074#1077#1085
Header.Alignment = taCenter
MinWidth = 32
Options = [coAutoSize, coDisableMoving, coPublicUsing]
Position = 2
SortType = stBoolean
end
object colUser: TNxTextColumn
Header.Caption = 'Username'
Position = 3
SortType = stAlphabetic
Visible = False
end
object colPass: TNxTextColumn
Header.Caption = 'Password'
Position = 4
SortType = stAlphabetic
Visible = False
end
end
end
Without the fix, we see this funny picture (
wrong.gif 10.87KB
5 downloads), and with my fix applied - we see how it should look alike (
right.gif 9.12KB
4 downloads)I hope this is already well described
In Topic: To Boki: Strange problem when the grid is inherited from base form
28 April 2009 - 06:11 PM
See FIX
In Topic: NextGrid doesn't work properly in a inherited form.
28 April 2009 - 06:09 PM
See FIX
In Topic: Bug with Inheritance
28 April 2009 - 06:06 PM
This wrong behaviour is caused because grid columns are implemented as child controls of the grid, instead of being members of TCollection.
So, when you have for example a base form with NextGrid and 1 text column,
and derived form with a modified NextGrid - with 2 text columns, the result is:
1. DFM streaming sees that your form has ancestor and reads the components from base form - so NextGrid now has 1 child control (single column from ancestor)
2. DFM streaming continues with description of derived form - since it is modified from the ancestor one (1 additional column), DFM contains information about the 2 columns
3. TReader class updates properties for the first column and instantiates the 2nd column. This is actually accomplished in
procedure TNxCustomColumn.ReadState(Reader: TReader); in file Sources/NextGrid/NxColumns.pas
which in turn calls
FColumns.UpdatePositionList(Self);
and here is the bug:
Without my fix - it makes fake columns and thus pissing off painting later on.
IMHO, columns would be better implemented as a Collection - like in the excellent TVirtualTree.
So, when you have for example a base form with NextGrid and 1 text column,
and derived form with a modified NextGrid - with 2 text columns, the result is:
1. DFM streaming sees that your form has ancestor and reads the components from base form - so NextGrid now has 1 child control (single column from ancestor)
2. DFM streaming continues with description of derived form - since it is modified from the ancestor one (1 additional column), DFM contains information about the 2 columns
3. TReader class updates properties for the first column and instantiates the 2nd column. This is actually accomplished in
procedure TNxCustomColumn.ReadState(Reader: TReader); in file Sources/NextGrid/NxColumns.pas
which in turn calls
FColumns.UpdatePositionList(Self);
and here is the bug:
CODE
procedure TNxColumns.UpdatePositionList(AColumn: TNxCustomColumn);
var
i: Integer;
begin
{ note: this method shift column on right position }
if FPositionItemsList.Count > 0 then
for i := 0 to FPositionItemsList.Count - 1 do
begin
// ====== fix by IVO GELOV to support VFI ========
if (AColumn.name<>'') and (AColumn.name = PositionItem[i].name) then
begin
PositionItem[i].Assign(AColumn);
Exit;
end;
// ===================================
if (AColumn.Position < PositionItem[i].Position) then
begin
FPositionItemsList.Insert(i, AColumn);
Exit;
end;
end;
FPositionItemsList.Add(AColumn);
end;
var
i: Integer;
begin
{ note: this method shift column on right position }
if FPositionItemsList.Count > 0 then
for i := 0 to FPositionItemsList.Count - 1 do
begin
// ====== fix by IVO GELOV to support VFI ========
if (AColumn.name<>'') and (AColumn.name = PositionItem[i].name) then
begin
PositionItem[i].Assign(AColumn);
Exit;
end;
// ===================================
if (AColumn.Position < PositionItem[i].Position) then
begin
FPositionItemsList.Insert(i, AColumn);
Exit;
end;
end;
FPositionItemsList.Add(AColumn);
end;
Without my fix - it makes fake columns and thus pissing off painting later on.
IMHO, columns would be better implemented as a Collection - like in the excellent TVirtualTree.
- Bergsoft Forum
- → Viewing Profile: Posts: IVO GELOV
- Privacy Policy



Find content