Multirecord issue with or without a grid

Author: gianni.sandigliano@unifacesolutions.com (gianni)

Uniface 9.6.07 - we are facing with a recurring issue with entities showing multiple records in a non modal form either with a grid or without a grid: Example 1: 1) The user is positioned on record 1 of multiocc entity (in this case in a grid) part of a NonModal Form ($curocc("EntityName") = 1) 2) The user click on the row 8 header requesting in this way to go into details for that row 3) The ExtendedTrigger is starting this code RowHeader_LClicked: setocc "EntityName", ROWNUMBER ; ROWNUMBER is equal 8 call myLocalProc ; This local proc is starting another NonModal Form to manage row details 4) The user exit the called form; it does not matter if accepting or quitting it. Note: at this point $curocc("EntityName") = 8 5) The FormGetFocus trigger code in the calling form is started Note: during execution of all the codelines into this trigger, up to "done" instruction added from the compiler, $curocc("EntityName") is equal 8 6) After execution of FormGetFocus if the form is executing a whatever line of code, as an example OccurrenceGetFocus, $curocc("EntityName") is back to 1 instead of 8; if any action is executed at row level at this point is happening on occurrence 1 while the user and the programmer thinks/wants/hope to be on occurrence 8. We made various tests on this Uniface application and the behaviour is consistent when the component called from the external procedure at point #3 is starting its own editing session. If the proc code does not start a new editing session the $curocc("EntityName") is correctly remaining at the value defined in triggers. We have also another example (Example 2) with a small form implementing a search on a column with standard multirecords presentation (not a grid). In this case the calling form form is looked for a string defined in the called form from the user; the called form is repositioned with $setocc on an occurrence containing the searched string. When the user ask to close the search and go back to the calling form the value of the $curocc("EntityName") is automatically restored to the initial value used when the user search was started. Expectation: when active path is changed from proc code it should be maintaned from Uruntime. Any input or suggestion is welcomed. Gianni

1 Comment

  1. gianni said Uniface 9.6.07 - we are facing with a recurring issue with entities showing multiple records in a non modal form either with a grid or without a grid: Example 1: 1) The user is positioned on record 1 of multiocc entity (in this case in a grid) part of a NonModal Form ($curocc("EntityName") = 1) 2) The user click on the row 8 header requesting in this way to go into details for that row 3) The ExtendedTrigger is starting this code RowHeader_LClicked: setocc "EntityName", ROWNUMBER ; ROWNUMBER is equal 8 call myLocalProc ; This local proc is starting another NonModal Form to manage row details 4) The user exit the called form; it does not matter if accepting or quitting it. Note: at this point $curocc("EntityName") = 8 5) The FormGetFocus trigger code in the calling form is started Note: during execution of all the codelines into this trigger, up to "done" instruction added from the compiler, $curocc("EntityName") is equal 8 6) After execution of FormGetFocus if the form is executing a whatever line of code, as an example OccurrenceGetFocus, $curocc("EntityName") is back to 1 instead of 8; if any action is executed at row level at this point is happening on occurrence 1 while the user and the programmer thinks/wants/hope to be on occurrence 8. We made various tests on this Uniface application and the behaviour is consistent when the component called from the external procedure at point #3 is starting its own editing session. If the proc code does not start a new editing session the $curocc("EntityName") is correctly remaining at the value defined in triggers.

    It seems that Uniface has no time to finish the focus change, because this is interrupted by the Non-Modal Form that is started in the context of the ExtendedTrigger RowHeader_LClicked. You should get the expected result when you delay the start of the Non-Modal Form that shows the row details. You can do this by calling the Asynchronous Interrupt trigger from myLocalProc using postmessage. And in the Asynchronous Interrupt you then start the row details form. Something like this:

    ; -- Extended triggers for grid widget trigger RowHeader_LClicked params   numeric rowNumber        : in   numeric shiftKey         : in endparams setocc $entname, rowNumber postmessage $instancename, "ACTIVATE", "ROW_DETAILS_FRM" end ; trigger RowHeader_LClicked ; --- Asynchronous Interrupt selectcase $msgid   case "ACTIVATE"     activate "%%$msgdata".exec()   elsecase     ; --- do something else endselectcase
    gianni said We have also another example (Example 2) with a small form implementing a search on a column with standard multirecords presentation (not a grid). In this case the calling form form is looked for a string defined in the called form from the user; the called form is repositioned with $setocc on an occurrence containing the searched string. When the user ask to close the search and go back to the calling form the value of the $curocc("EntityName") is automatically restored to the initial value used when the user search was started.

    I could not replicate the described behavior when I use a simple test scenario: form FRM1 with a mult-occ entity and FRM2 that will call an operation of frm1 and do a setocc. When I close FRM2 then $curocc in FRM1 is on the expected occurrence. I guess my test scenario is a bit too simplistic. And maybe there's something else going on that will prevent Uniface from finishing the requested focus change properly.

    gianni said Expectation: when active path is changed from proc code it should be maintaned from Uruntime. Any input or suggestion is welcomed. Gianni

    Hope this helps. Daniel


    Author: diseli (daniel.iseli@uniface.com)