Kbase P144399: New active row in UltraGrid is not highlighted after previous row is deleted
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  12/13/2010 |
|
Status: Verified
SYMPTOM(s):
New active row in UltraGrid is not highlighted after previous row is deleted
Selected property of active row is false
Behavior is the same no matter which method is used to delete the row
FACT(s) (Environment):
After a row is deleted from the binding source, the next sibling row in the UltraGrid correctly becomes the active row.
Windows
OpenEdge 10.2A
CAUSE:
The Selected property of the active row in an UltraGrid is false by default. Therefore, even if the currently active row is selected, when it is deleted the next row does not automatically become selected. This is expected behavior for the UltraGrid, but it differs from the default behavior of the browse widget in the traditional OpenEdge GUI.
FIX:
The following code will activate and select the next sibling row when a row is deleted from the UltraGrid. If no next sibling row exists, the previous sibling row will be activated and selected. If neither a next nor a previous sibling row exist, no change will be made.
Add the following lines to the definitions section of the class or procedure:
/* Row markers for the previous and next sibling rows of a row to be deleted. The
appropriate row can then be activated after the original active row has been deleted */
DEFINE VARIABLE rPrevRowFromDeleted AS UltraGridRow NO-UNDO.
DEFINE VARIABLE rNextRowFromDeleted AS UltraGridRow NO-UNDO.
Add the following lines to the gridBeforeRowsDeleted grid event procedure (add this procedure if it does not already exist):
/* Set row markers for previous and next siblings if they exist. These will be used to
activate the appropriate row after the current active row has been deleted. */
IF (cast(rSender,UltraGrid):ActiveRow:HasPrevSibling())
THEN
rPrevRowFromDeleted = cast(rSender,UltraGrid):ActiveRow:GetSibling(SiblingRow:Previous).
IF (cast(rSender,UltraGrid):ActiveRow:HasNextSibling())
THEN
rNextRowFromDeleted = cast(rSender,UltraGrid):ActiveRow:GetSibling(SiblingRow:Next).
Add the following lines to the gridAfterRowsDeleted grid event procedure (add this procedure if it does not already exist):
DEFINE INPUT PARAMETER rSender AS System.Object NO-UNDO.
DEFINE INPUT PARAMETER rEvent AS System.EventArgs NO-UNDO.
/* Activate and select the row after the deleted row if it exists */
IF (rNextRowFromDeleted <> ?)
THEN
DO:
rNextRowFromDeleted:Activate().
rNextRowFromDeleted:Selected = TRUE.
END.
ELSE
/* If there is no row after the deleted row, activate and select the row before if it exists */
IF (rPrevRowFromDeleted <> ?)
THEN
DO:
rPrevRowFromDeleted:Activate().
rPrevRowFromDeleted:Selected = TRUE.
END.
/* If the deleted row had no siblings then nothing is activated */
/* Unset row markers so they can be reused */
rPrevRowFromDeleted = ?.
rNextRowFromDeleted = ?.