Jump to content


BelangerC's Content

There have been 39 items by BelangerC (Search limited from 24-April 23)


By content type

See this member's


Sort by                Order  

#21570 Converting NG5 to NG6: Event substitutions summary

Posted by BelangerC on 05 December 2023 - 05:44 PM in NextGrid v6 Component

Hi, All:

 

After a LOT OF WORK and TIME, I will be abandoning my efforts to convert the use of current NextGrid 5 use to NextGrid 6.

 

For simple projects this conversion may work and certainly for new projects, one should use NG6, but for complex grids (Treed grids which are created from a database with stored grid property data, allow the user to add rows of data, single or multiple rows at a time, popup windows in various columns), there are just too many differences between the two components to be able to program around the differences allowing the same functionality and with the same expected behavior.

 

There are weird bugs which have been very difficult to trace, sometimes intermittent which essentially crash my program and require the user to restart. The worst appear to be occurring after adding child rows during run time: the grid will redraw with parts of the grid missing; the scroll bar will be missing meaning that the added rows are not even accessible; row parents will become collapsed even though the program does not call for that behavior, i.e. the parent rows should be expanded to reveal the added child rows. On close of the grid and reopening, everything appears correctly, but this closing and reopening the grid, which recreates the grid, is just too much to expect from the user, who is typically in a clinical situation with a client.

 

I wrote the code to allow easy user selection of which NextGrid to use, so that will not be a problem to revert back to NG5.

 

I hope others can use my posts to help them make any conversions in their own programs. I was hoping to leave my program with it using the more up-to-date NG6 component as I prepare to retire in the next few months. They are moving the application to a cloud based one which makes sense for them. (Distributing databases which have common and user specific data to users is a major overhead when doing updates. A single cloud based DB will, among other issues, simplify support and maintenance. When I started this project 20 years ago, fast cloud based databases simply did not exist. At that time programs with quick response and complicated user interfaces required local databases and applications.)

 

Best regards,

Chuck




#21568 Getting "Error: -1" when Vertical Scrolling in NextGrid6

Posted by BelangerC on 01 December 2023 - 06:52 AM in NextGrid v6 Component

Hi, Boki:

 

As of the 9/2023 update this issue is still occurring and the code does not seem to have been changed. Still has the ShowMessage('Error') popup, plus getting ListIndex -1 out of bounds and requires users of my program to have to restart the program.

 

I actually did try to make a demo project for you last year but in such a simple grid, I could not get this error to happen. The grid is Treed for starters.

 

Seems to happen the most often after adding rows to the grid during execution of the program and then scrolling UP.  The above "fix" added to your code works. Could you add it to the next NextGrid6 release, so I don't have to keep re-adding it on my end?

Thank you,

Chuck




#21567 Converting NG5 to NG6: Event substitutions summary

Posted by BelangerC on 28 November 2023 - 09:13 PM in NextGrid v6 Component

Hi, All:

 

This conversion OnHeaderDblClick = Use NxReportGridView61.OnHeaderMouseDown (ssDouble) DOES NOT WORK.  As far as I can determine, there is no way to get a HeaderDblClick-like event. ssDouble does not appear to be recognized by the OnHeaderMouseDown event. I ended up having to use a right mouse event instead which is somewhat problematic because users have been using dbl click.

 

It would be nice, Boki, to add some way (i.e. have event recognize the ssDouble, or an actual DblClick event) to have a double click event for the header.

 

Thank you,

Chuck




#21512 NxComboBoxColumn6: how to get selected item into cell?

Posted by BelangerC on 25 September 2023 - 12:01 PM in NextGrid v6 Component

Thank you Boki!

 

i keep forgetting to recompile the packages after the updates. Important when you change the properties/events!

 

Chuck




#21511 Columns.Insert not actually inserting column, but adding to last position

Posted by BelangerC on 25 September 2023 - 10:43 AM in NextGrid v6 Component

Hi, Boki:

 

Tried:

 

WITH GridView2 DO
    BEGIN
 NxTableGraph6 :=  TNxIconColumn6.Create(GridView2);
     //this was not inserting new column; putting as last column
     Columns.Insert(1,NxTableGraph6);
....
end;
 
No INSERT, column added at last position.
 
Am I missing something?
 
Thank you,
Chuck Belanger



#21507 NG5 to NG6 Conversion: NG6 equivalent to TColumnType/Kind?

Posted by BelangerC on 16 September 2023 - 10:51 AM in NextGrid v6 Component

Hi, Boki:

 

Turns out that is what I tried. The problem I found is that TNxTreeColumn6 evaluates true when compared to TNxTextColumn6.

What I ended up using is Column.ClassName instead.

 

Hope that helps others with same issue.

Chuck




#21503 OnCellClick treats CheckBox click completely opposite in NG5 NG6

Posted by BelangerC on 01 September 2023 - 01:17 AM in NextGrid v6 Component

Thank you for the tip, Boki.

I tried that and it certainly seems the best event for what I was trying to do. When using it though, it actually changed the behavior of a form I pop up when clicking on a grid cell expecting a value. This form is a vernier which allows for quick visual value selection 1-1000 and it ceases to function. I have no idea why using this OnCheckedChanged event would do that, but since I got everything to function by using the OnCellClick event by simply reversing the logic test for checked state (actually cell.asBoolean), I have decided not to use your suggestion. Nor did I trace why simply changing that event, which only deals with the checked columns, not the cells for accepting a value, would affect the Vernier form. 

 

I doubt if this is a bug in NextGrid6, just some logic issue in my code.

Chuck




#21500 OnCellClick treats CheckBox click completely opposite in NG5 NG6

Posted by BelangerC on 29 August 2023 - 06:03 AM in NextGrid v6 Component

Hi, Boki and other users who wish to convert NG5 to NG6:

 

In NextGrid5 OnCellClick when used with a NxCheckBox sees the boolean state as FALSE, whereas NextGrid6 sees the CheckBox boolean state as TRUE when clicking on the cell that is visually unchecked.

 

Example from my code:

 

 IF (Columns[ACol] IS TNxCheckBoxColumn) AND
        ((Pos('INDICATED', UpperCase(Columns[ACol].Header.Caption)) > 0) OR
        (Pos('INDCT''D', UpperCase(Columns[ACol].Header.Caption)) > 0)) AND
        Cell[ACol, ARow].AsBoolean THEN
 
The intent is to then delete all cells in the row when UNCHECKING the Indicated column.
 
In NextGrid5 it works for the above code; in NextGrid6, I had to add "not" to "Cell[ACol, ARow].AsBoolean THEN" for it to work.
 
Chuck



#21499 NxTextColumn: Random, Intermittent Font.Color changes?

Posted by BelangerC on 28 August 2023 - 01:06 PM in NextGrid v6 Component

Here are 4 screen shots of one of the tables that use NG6 with the same unit to build the table from database stored properties.

The tables were opened successively, i.e. I opened the table, closed it then reopened, via a double click on the background treeview node; what you see are four different font colors (the 1st and 4th are different shades of green).

 

NG6_Table1.png NG6_Table2.png NG6_Table3.png NG6_Table4.png

 

Not sure this makes a difference, but most of the tables that rely on this unit are treed tables, i.e. the first column is a tree column.

 

Hope this helps!

Thank you for working on the other issues, too.

 

Turns out I have only a few months left to work, then I am retiring, and would like to finish this up for them. They think they are going to have their new web site program done by the end of the year and I want a final desktop version completed by then since I kind of doubt if they will be able to be done with the new program by then. As a follow up to your email, they are going a completely different direction then our current desktop program, which makes sense because they are using very different programming languages and tools. 

 

Best regards,

Chuck

 

 




#21497 NxTextColumn: Random, Intermittent Font.Color changes?

Posted by BelangerC on 27 August 2023 - 04:22 PM in NextGrid v6 Component

Hi, Boki:

 

This is a weird one!

 

I have a unit which creates grids using stored grid properties in a database. I have been converting code, properties and events from NextGrid 5 to NG6.  I am using essentially the same code as NG5 and only making changes where the properties and events change in name or functionality. I have kept all the NG5 code and simply use a new NG6 grid which I can switch between NG6 and NG5 by a menu selection then having the user reload the grid in the alternate NextGrid 5 or 6. I will keep this fail safe menu item until convinced that the NG6 grids are equally functional as the NG5 grids. Right now, the NG5 grids do not display this behavior.

 

What I am seeing is that on bringing up any grid during run time, the text font of the various columns will change from the default, clBlack, to almost any color. All text in the grid will be assigned the same non-black color. On closing the grid and reopening/recreating it, the font.color may or may not be the same, often it will go back to the default color, clBlack, but on another attempt to reopen the grid the color may change again.

 

If I continue to open various grids, a new color may be assigned or the default black color may be used. No apparent pattern.

 

As the grid is created I have a procedure, SetColProps6, which assigns the font.color based on what is stored in the database. I tried setting the font.color explicitly to clBlack with no change to this random color assignment.

 

I am using the newer (compared to NG5) event: NxTextColumn6StyleText. But if I simply exit out of this event without running the code, still I am getting the random color assignment.

 

Where this becomes a problem is when the color is something like clYellow which is very difficult to read. Thankfully, I have not seen it become clWhite yet.

 

At this point I am completely at a loss as to where this happening. Can you either suggest where this might be happening or if you can or have observed this, suggest a fix?

 

Thank you,

Chuck

 




#21496 What is the default position of AddChildRow in NG6

Posted by BelangerC on 24 August 2023 - 12:52 PM in NextGrid v6 Component

Hi, Boki:

Just wanted to give you some more feedback on this LastAddedRecord issue:

 

When creating a long grid filled with information from a database (about 1000 rows), the above hack to get LastAddedRecord by referencing INxCellsRow.AbsoluteIndex works, but is really S L O W. 

For those trees that initially all rows and child rows are created during the form creation, I found that simply using LastAddedRecord instead of AbsoluteIndex, created the grid at its usual really fast speed. (i.e. < 1 sec vs 1 min load times)

 

On the other hand, like the Scroll bar issue, if the treed grid is created then I add child rows during run time, then LastAddedRecord and AddChildRow do not sync properly, i.e. AddChildRow is added last, but LastAddedRecord refers to the topmost sibling row.

Hope that helps.

Chuck




#21495 No Vertical Scrollbar for Treed rows in grid

Posted by BelangerC on 24 August 2023 - 12:29 PM in NextGrid v6 Component

Kind of messy, but here it is. It will demo the issue for you. (Originally, I was trying to demonstrate the vertical scroll issue where getting a row out of range (-1) error, which in this simple project I could not duplicate although it continues in my program if one moves the scroll bar to far up vertically.)

 

Hope it helps,

 

Chuck

Attached Files




#21493 No Vertical Scrollbar for Treed rows in grid

Posted by BelangerC on 23 August 2023 - 09:58 PM in NextGrid v6 Component

Hi, Boki:

 

This is a real problem for me.

 

In my program I often add a row or rows to a grid, then later in code add all Child rows to any parent row which has such in a recursive routine.

 

I notice that in NG5 this adding of child rows after adding rows will properly show a vertical scroll bar when needed based on grid size and number of rows.

But, in NG6 this is not the case. No vertical scroll bar appears which means users cannot access the expanded rows that fall below the bottom of the grid.

BIG PROBLEM.

 

Now, in a simple test project, I noticed that if the treed rows and children are added as part of creating the grid and adding rows and child rows at the same time, all is well--the vertical scroll bar shows up.

 

But consistently, if I add rows then later in code add children to some or all of those rows then no vertical scroll bar becomes available when required to show the expanded grid.

 

Is this a bug or is there a way around this?

 

Later....

Ok, with experimenting, I found that if I issue Row[Index].Collapse(true) after each AddChildRow that that will allow the Vertical Scroll bar to appear. This works even if right after adding the row's children I expand all.

 

Still seems like a bug to me.

 

Thank you,

Chuck




#21492 NG5 to NG6 Conversion: NG6 equivalent to TColumnType/Kind?

Posted by BelangerC on 23 August 2023 - 08:41 PM in NextGrid v6 Component

Hi, Boki:

Trying to wrap up the NG5 to NG6 conversion but am still finding a number of differences which may kill the conversion process for me.

 

I will be asking about each as a separate topic as they come up in debugging of my program.

 

 

In NG5 you have the Grid5.Columns[ACol].ColumnType with possible property values of:

 TColumnType = (ctAutoInc, ctBoolean, ctNone, ctDate,
    ctFloat, ctGraphic, ctGuid, ctInteger, ctString, ctLookup, ctMemo, ctVirtual);
  TColumnKind = (ckTextual, ckBlob, ckNumeric, ckImage, ckComboBox,
    ckCheckBox, ckDate, ckProgress, ckRate, ckIncrement, ckHtml);
 
Do you have anything comparable to either ColumnType or ColumnKind in NG6? How do I get that information when processing events that are generic to different types of columns and their cells?
I am particularly interested in ColumnType although I could use the ColumnKind property as well.
 
Thank you,
 
Chuck
 
 



#21489 What is the default position of AddChildRow in NG6

Posted by BelangerC on 21 August 2023 - 06:56 PM in NextGrid v6 Component

Hi, Boki:

 

FYI: I tried using

 

ARow := AddChildRow(ParentRowIndex);

where ARow is INxCellsRow

Then referenced ARow.AbsoluteIndex instead of LastAddedRow. This works to properly set the rows' cell values, but I would still like to have LastAddedRow properly reference the added child row correctly since I use this A LOT in my code.

 

Here is an example of how I use LastAddedRow:

 

Cell[Columns.Count - 1, LastAddedRow].AsString :=
                'TR' + inttostrzeropad(Id, 10) + '|' + ParentStrID + '|' + 'TR'

 

Thank you,

Chuck




#21488 NG6.NxListColumn6.InsertValue same as NG5.NxListColumn.DefaultValue?

Posted by BelangerC on 21 August 2023 - 05:55 PM in NextGrid v6 Component

Hi, Boki:

Can you address my last post/question?

Thank you,

Chuck




#21487 NxComboBoxColumn6: how to get selected item into cell?

Posted by BelangerC on 21 August 2023 - 05:52 PM in NextGrid v6 Component

Hi, Boki:

As of the 8/23 update the TNxComboBoxColumn6.ImmediateAssign property is not added. Can you please add this property?

 

Thank you,

Chuck




#21486 Converting NG5 to NG6: Event substitutions summary

Posted by BelangerC on 21 August 2023 - 05:41 PM in NextGrid v6 Component

Hi, Boki:

Yes, please feel free to use this list. That was the idea of posting it for you or others facing the same conversion process.

 

Also, the code i had in my NG5 OnApplyEditText was:

 

Since there does not seem to be a Editor property for NG6, not sure how to achieve the intent in NG6. BTW, this is not a major issue if I can't do this code.

 

 WITH GridView1.Columns[ACol].Editor DO
  BEGIN
    Color := clYellow;
    Font.Color := clBlack;
    Font.Style := [fsBold];
  END;



#21485 What is the default position of AddChildRow in NG6

Posted by BelangerC on 21 August 2023 - 05:29 PM in NextGrid v6 Component

Hi, Boki:

 

Debugging the conversion of the NG5 to NG6 and found that after getting the latest NextGrid update there does not seem to be any changes to AddChildRow method.

 

The problem is that my code keeps referencing LastAddedRow and it is for my test treed grid set of child siblings, always 1, i.e. the second row after the parent row.

 

It appears that the default position of the added row is FIRST. I had assumed incorrectly that the new row would be added LAST.

 

This means my code is replacing the the cell data of that topmost child row; while all the the AddChildRow calls essentially add a blank row.

 

I tried AddChildRow(1, False) and AddChildRow(1, True). This setting IgnoreDefault does not seem to be doing anything with regards to POSITION.

 

So, my question is: Did you add a parameter like NG5's AddChildRow(Position), either crLast, crFirst. If not could you please do this soon? Otherwise, I would have to make many changes to my code to use something other than LastAddedRow. So, at this point, I am not sure that LastAddedRow is correct either for AddChildRow. Not sure, but it appears that AddChildRow is in fact adding a row LAST, but LastAddedRow keeps referencing the top sibling row and that gets updated for all the cells in my code. Seems that LastAddedRow should reference Grid.Rowcount - 1 in this use, yes? (Just tried and that does not work, because of the way I add Parent Rows then their children.)

At this point I really need LastAddedRow to be correct for AddChildRow.

 

Thank you,

Chuck




#21452 Converting NG5 to NG6: Event substitutions summary

Posted by BelangerC on 22 June 2023 - 12:42 PM in NextGrid v6 Component

Hello all:

 

Thought you might like to see a summary of what I have learned as far as the NG6 equivalent events when converting NG5 to NG6.

HTH,

Chuck

 

Grid5 to Grid6
Events:
5 = 6
OnAfterEdit = GridView2AfterEdit
OnApplyEditText = no comparable event in NG6
OnBeforeEdit = GridView2BeforeEdit
OnBeforeSelect = GridView2BeforeSelect; OnSelectQuery (allows ACCEPT)
OnCellClick = GridView2CellClick
OnCellColoring = NxReportGridView61.NxReportGridView61GetCellColor
OnCellDblClick = GridView2CellDblClick
OnCellFormating = NxTextColumn61StyleText (apply to text related/subclassed columns)
OnCellHint = NxCheckBoxCol61GetHint; (only CheckBox columns)
OnChange = OnCellChange;
OnColumnResize = Each Column has OnResize, e.g. NxTextColumn61Resize as routine for all.
OnEditText = OnAcceptEdit (best for the actual code, i.e. to catch and truncate long entries before saving to DB)
OnExpand = OnRowExpand;
OnHeaderClick = Columns.OnHeaderClick(Do not use; no Column param);instead use NxReportGridView61.OnHeaderMouseDown (ssSingle)
OnHeaderDblClick = Use NxReportGridView61.OnHeaderMouseDown (ssDouble)
OnKeyDown = GridView2KeyDown
OnKeyUp = GridView2KeyUp
OnMouseMove = GridView1MouseMove
OnSelectCell = GridView2Select
OnVerticalScroll = GridView2VerticalScroll



#21449 NxComboBoxColumn6: how to get selected item into cell?

Posted by BelangerC on 19 June 2023 - 10:50 AM in NextGrid v6 Component

Thank you, Boki, that would be great!

Chuck




#21447 What is the default position of AddChildRow in NG6

Posted by BelangerC on 17 June 2023 - 08:44 AM in NextGrid v6 Component

Hi, Boki:

In NG5 AddChildRow has the Position parameter, default cfLast. For NG6 AddChildRow does not have this parameter. So what is the default add child row position?

I am assuming it is LAST, but how would I add a row at the top of the grid?

 

Thank you,

Chuck




#21445 NG.6 GridBeforeSelect: how to have Accept = False, without Accept param?

Posted by BelangerC on 14 June 2023 - 11:49 AM in NextGrid v6 Component

Hi, Boki:

 

How do I prevent a select of a cell from happening in NG6?

Accept is not available.

 

Here I am preventing selection of a cell in the first column (tree column) if a small vernier form (a numerical scale in a form allowing a visual selection)  is already present.

 

From my comments, the issue was if the cell is active, i.e. accept is true, the vernier selection would be put into the first column, which was supposed to be un editable.

 

I was handling a bug where the user clicked on any column but the first and that popped up the vernier, then while that was open would inadvertently click on the first column (treed), which then put and vernier value into and thus write over the first column, which is supposed to be unable to edit.

 

So, the first column is an item description and all other columns to its right are various subjective measurements.

 

simple example:

 

Col 1                      Col 2 

Potential Allegen    Degree of allergy    

 

It may be there are other properties or methods to handle this situation?

 

Thank you,

Chuck

 

procedure TfrmCVTable.GridView2BeforeSelect(Sender: TObject; var ACol,
  ARow: Integer; Key: Word; Shift: TShiftState);
begin
  // 3/23/10 see OnSelect; possible for user to click off current cell onto
  // first col and then on close of vernier to replace the row text.
  // Guess what? Still
 
  // 10/2/12 check frmVernier first before checking visible
  if (ACol = 0) and Assigned(frmVernierScale) and frmVernierScale.Visible then
  begin
    Accept := False;   //no Accept in NG6.BeforeSelect < == no Accept param in NG6
    // make sure the vernier is still focused THIS WORKS
    frmVernierScale.BringToFront;
    frmVernierScale.SetFocus;
   
 
  end;
end;



#21444 NxComboBoxColumn6: how to get selected item into cell?

Posted by BelangerC on 14 June 2023 - 11:16 AM in NextGrid v6 Component

Hi, Boki:

 

Trying to convert:

 

 Boki, how do I get the selected item into the cell with a ComboBoxColumn?

 

I can see that perhaps this event may not even be necessary with NG6.

Same with the issue of reassigning font.color to the column.

 

Can you please comment on this?

 

Thank you,

Chuck

 

PROCEDURE TfrmCVTable.NxComboBoxColumn6Select(Sender: TObject);
BEGIN
  WITH GridView2 DO  //GridView2 is NG6 grid
  BEGIN
  //not sure how to do this in NG6
    Cell[SelectedCol, SelectedRow].AsString := TNxComboBoxColumn6(Sender).
      .Editor.Text; <== Boki, how do I get the selected item into the cell with a ComboBoxColumn?
 
    // having the same issue here as the other cells/columns, the color keeps
    // changing
    Columns[SelectedCol].Font.Color :=
      StringToColor(ColFontColor[SelectedCol]);
  END;
END;



#21442 NG6.OnVerticalScroll does not have Position value

Posted by BelangerC on 09 June 2023 - 11:26 AM in NextGrid v6 Component

Apparently I already figured this out in another part of my program.

Position exists as a property of VertScrollBar.

 

//Happening before this event is called.   DoGridVerticalScroll also tries to trap -1 row
if TNextGrid6(Sender).VertScrollBar.Position > -1 then
   DoGridVerticalScroll6(TNextGrid6(Sender), TNextGrid6(Sender)
    .VertScrollBar.Position)
    else
    Abort;
 
Chuck