Hi, Boki:
In NG5 there is a OnEditText event that I have been using with this grid. From what I can see there is an OnCellChange event. Would that work for this event conversion? Or would another work better?
Thank you.
Posted 06 July 2018 - 10:07 AM
Hi, Boki:
In NG5 there is a OnEditText event that I have been using with this grid. From what I can see there is an OnCellChange event. Would that work for this event conversion? Or would another work better?
Thank you.
Posted 06 July 2018 - 10:50 AM
Hi, Boki:
From my post in March, 2018:
a. OnCellFormatting; this really needs to be at the grid wide level; OnSetCell at the column level just does not work for my application.
This is my notes on it:
OnCellFormating = Columns.OnSetCell procedure TForm1.NxTreeColumn61SetCell(Sender: TObject; ACol, ARow: Integer; Cell: INxBaseCell); THE PROBLEM IS THAT CELL does not have Font settings! Need to reference the Columns(ACol).Font
If I remember correctly, whether a Cell has font settings is determined by the type of column. It is so much cleaner to have a grid wide event which takes care of setting all column font settings.
I would really appreciate it if you can add back a grid level event to act like the NG5 OnCellFormatting.
Thank you,
Chuck
I am using OnCellFormatting in the single NG5 grid conversion. Here is how I am using it:
WITH Grid DO
Posted 06 July 2018 - 11:02 AM
Hi, Boki:
Here are the final items, as far as I can tell without actually running the program with a NG6 grid:
Need Grid.GetLastChild method.
How do I get RowHeight of a particular row? In NG5, RowHeight[aRow].
I am pretty sure this is everything that I need for this grid conversion.
Thank you!
Chuck
Posted 09 July 2018 - 03:51 PM
Hi, Boki:
Thank you for your response. I will look at that and let you know if I have further questions.
Here is another:
Missing Grid.GetCellTop.
In a routine called by OnCellDblClick, I create a panel which lays over the grid's cell. Here is the routine to show the use of GetCellTop in context: Thank you for your help in either adding this method or pointing me to another that would give me what I need.
Chuck
With Grid do
begin
WITH WizTableCellPanel DO
BEGIN
// 0th col, thus only left side of cell
// PanelStart := GridSpace[TGridLinePosition(lpLeft)];
PanelStart := 0;
Parent := Grid;
Align := alNone;
BevelOuter := bvRaised;
// 3/26/08 do not make wider but make longer for larger fonts. Similar
// in principle to WizAddRTFtoLabel, but in multiple units of row height
// 10/22/08 make it the same height as the Row for now
// Below height is arbitrary and reset below RTF creation to match the actual text
Height := Trunc(1.5 * RowHeight[SelRow]);
// RowSize; is the general setting; not specific row
// add width of indicator
// Left := Trunc((Gridview1.Width-GridView1.InnerWidth)/2) + PanelStart;
//2/20/18 ActiveView now
CellRect := ActiveView.GetCellRect(SelCol, SelRow);
Left := CellRect.Left;
Name := 'plTableCell';
// Top := HeaderSize + GridSpace[TGridLinePosition(lpTop)];
Top := GetCellTop(SelCol, SelRow);
Width := Columns[SelCol].Width;
Visible := True;
Caption := '';
END; // WizTableCellPanel
End;
Posted 09 July 2018 - 03:58 PM
Hi, Boki:
Could you please direct me to an alternative to how I have been using Grid.GetLevel? Thank you!
Here is another apparent missing method:
Grid.GetLevel
In an OnDragOver event I have the following code to show the context of how I use GetLevel:
var
GridSource, GridSender : TNextGrid6;
SourceRow, SenderLevel : Integer;
begin
// need this to determine if source and sender agree for application and
// for Drag/Drop to even work
// This event affects dragging intitiated by the grid itself, i.e. in setting row index
// Restrictions: must be to itself; must be a visible row; must be at the same level
// as the selected row
// Reason: you would have to update the Parent_ID in the table; it doesn't make
// much sense; and this way you can rely on the close session to call the reset index
// routine which sets the table to the new index
//2/27/18 In order to cast ActiveView, I need to disconnect the Grid from the phrase
//Thus all this code to isolate the grids
if (Sender is TNextGrid6) and (Source is TNextGrid6) then
begin
GridSource := Source;
GridSender := Sender;
with GridSource do
begin
SourceRow := TNxReportGridView6(ActiveView).GetItemAtPos(x,y);
end;
with GridSender do
begin
SenderLevel := GetLevel(TNxReportGridView6(ActiveView).GetItemAtPos(X, Y));
end;
end;
if (SourceRow > -1) and (SenderLevel = Wizard.RowLevelBeingDragged ) then
//(TNextGrid6(Source).GetRowAtPos(X, Y) > -1) and
//(TNextGrid6(Sender).GetLevel(TNextGrid6(Sender).TNxReportGridView6(ActiveView).GetItemAtPos(X, Y))
// = Wizard.RowLevelBeingDragged) then
Accept := True
else
Accept := FALSE;
Posted 09 July 2018 - 03:59 PM
Hi, Boki:
Here are the final items, as far as I can tell without actually running the program with a NG6 grid:
Need Grid.GetLastChild method.
How do I get RowHeight of a particular row? In NG5, RowHeight[aRow].
I am pretty sure this is everything that I need for this grid conversion.
Thank you!
Chuck
Posted 09 July 2018 - 05:09 PM
Hi,
You can use GetItemTop event of ActiveView. But I think now that I will return GetRowTop function to the Grid itself too.
Hi, Boki:
GetItemTop is not available for ReportGridView which is what I have been using exclusively. It is only available for List or Slides. Either needs to be included for Reports or as you say added to the Grid. Thank you.
Posted 09 July 2018 - 05:26 PM
You can access Row array property and then simply inspect Level sub-property.
I am trying to replace:
SenderLevel := GetLevel(TNxReportGridView6(ActiveView).GetItemAtPos(X, Y));
When I use
SenderLevel := Row[TNxReportGridView6(ActiveView).GetItemAtPos(X,Y)].Level does not exist, yet I see the property in NxCells6.pas.
How do I access Row[].Level?
Thank you,
Chuck
Posted 09 July 2018 - 05:30 PM
Hi, Boki:
GetItemTop is not available for ReportGridView which is what I have been using exclusively. It is only available for List or Slides. Either needs to be included for Reports or as you say added to the Grid. Thank you.
Posted 09 July 2018 - 05:31 PM
When I use
SenderLevel := Row[TNxReportGridView6(ActiveView).GetItemAtPos(X,Y)].Level does not exist, yet I see the property in NxCells6.pas.
How do I access Row[].Level?
Thank you,
Chuck
MyLevel := NextGrid61.Row[4].Level;
Posted 09 July 2018 - 07:22 PM
Posted 10 July 2018 - 12:08 AM
Hi,
NextGrid include Row property. You only need to give Index. For example:
MyLevel := NextGrid61.Row[4].Level;Thank you. Turns out in my actual code I typed Row(<expression>), not Row[<expression>]. That worked with LEVEL.
Posted 10 July 2018 - 12:29 AM
Hi,
ReportView is inherited from ListView. You should see this method.
For example NxReportGridView61.GetItemRect or GetItemTop
Hi, Boki:
I can access ActiveView (as NxReportGridView6).GetItemRect, but not GetItemTop.
Earlier in code I got the cell rectangle and just used CellRect.Top. I am thinking that should work.
So, I notice that both of these statements are allowed. Are they the same?
Posted 10 July 2018 - 02:40 AM
Posted 10 July 2018 - 04:00 AM
Hi, Boki:
Can you tell me the status of the following recent questions:
1. Getting Grid.OnCellFormatting event back (vs. Columns.OnSetCell which is much more tedious to use and cannot be globally set for entire grid; only certain columns can set Cell Formatting).
2. OnVertical/HorizontalScroll: getting back the Position var.
3. Is OnCellChange (ng6) the same as NG5 OnEditText?
These are the only things stopping me from converting this single NG5 grid at this point.
Thank you,
Chuck
Posted 10 July 2018 - 06:05 PM
Posted 11 July 2018 - 03:15 PM
1) There is a OnStyleText event, again for column. But you can easily link several columns to one event handler.
In NG5:OnColumnFormatting I am trying to set the font as black and the fontstyle as bold for any selected row/col; if not a selected row, then whatever the font settings are.
The problem with OnStyleText (or OnSetCell) is that not every column has this event (e.g. CheckBox columns) and thus there will not be a consistent bold and black font across a selected row. So, maybe the better question is what is the best way to achieve this selected row look? I see the Grid6 has SelectionTextColor, but not SelectionFontStyle. Thus my request for a Grid wide event to handle this, such as OnCellFormatting. Thank you.
Posted 12 July 2018 - 02:31 PM
Posted 12 July 2018 - 04:07 PM
Hi, Boki:
Thank you.
Attached is the screen shot of the grid that I have selected to convert in my program. This is the previous version using NG5.
I notice that the check box does not become font style BOLD in the old grid either.
I did check and NG6 combo box and number columns do become bold (these are the other column types beside Tree and Text which I use mostly).
The yellow cell is the selected cell. The bold/black text is also used for mouse over movement.
BTW, this is the NG5 grid that I originally mentioned that for whatever reason redraws with parts of the screen embedded in its image. To overcome this I REPAINT in almost every interaction with the grid. Even then sometimes it still repaints either as completely black, i.e. no image of the grid, or with pieces of the screen other than the grid.
Chuck
Posted 12 July 2018 - 11:35 PM
0 members, 1 guests, 0 anonymous users