Page 1 of 1

Event Routine Handling not responded to?

Posted: Wed Aug 31, 2022 10:44 pm
by adale
I hope I can explain this issue clearly enough, and one of the forum members can help explain what is happening.

I have a VL Dialog that is a list of items on an order.
When the dialog is initially displayed for a new order, there are no detail records.
I have an "Add item" button that calls the MTHROUTINE "AddNewDetail" to add new detail records to the order.
When the add detail record is complete, it triggers the signal event "ItemSaved".
In the MTHROUTINE, I have an eventroutine handling specific for the "ItemSaved" which clears the order list, prints out to the web console.log, and then calls the routine to refresh the order list and show the dialog.

Here is my issue:
When you first call the dialog with a new order, and add initial item(s), the dialog does not refresh? The write to the console.log doesn't happen? The detail items are correctly added to the order in the file, just the Event Handling of "ItemSaved" does not take place?

If you get out of the dialog, and then go back into the dialog, the item details that were added, do show correctly.

Now, upon going back into the dialog, if you add another new detail item, the dialog refreshes, the console.log gets written out, all as expected in the event handling of "ItemSaved".

Why does this not work, or respond on the initial use, but works fine on subsequence uses?

Code: Select all

* Add New Detail line record
MTHROUTINE Name(AddNewDetail)
* Call to Add New Line Detail - prompting dialog, item cat, then item.
DEFINE_COM Class(#P1MAddOrderDetail_Dialog) Name(#AddDetail)

#AddDetail.Refresh( #CENO #CELID #ORDN )

EVTROUTINE Handling(#AddDetail.Closed)
CLR_LIST Named(#ListDtl)
#COM_OWNER.ShowDetails( #CENO #CELID #ORDN #ORDNAM )
ENDROUTINE

EVTROUTINE Handling(#AddDetail.ItemSaved)
CLR_LIST Named(#ListDtl)

* Console - debug
#sys_web.Console.Log( ('LINE-#443 AddNewDetail: ' + ' - ' + #) )


#COM_OWNER.ShowDetails( #CENO #CELID #ORDN #ORDNAM )

* #SYS_WEB.Alert Caption('Item Added to Order.')
#Alert.Caption := 'Item Added to Order.'
#Alert.ShowAlert

ENDROUTINE

ENDROUTINE

Re: Event Routine Handling not responded to?

Posted: Thu Sep 01, 2022 1:55 am
by adale
To clarify:
When the Dialog is first called (presented) the dialog list is empty, and the MTHRoutine and Event Routine from the Add New is not yet triggered or executed.
Once the button is clicked to Add a new record, is the MTHRoutine (AddNewDetail) is executed.
It is in this first cycle or run of this MTHRoutine, where I am not seeing the ItemSaved event handling not responding, or not executing.
Even if multiple item records are added, as long as you do not back out of the Dialog (close button) the ItemSaved event handling does not happen.

Yet, if you close the dialog, then go back into the dialog and add an item (same MTHRoutine (AddNewDetail)) then the ItemSaved handling event triggers and executes as expected. Odd?