1. Jit Sing Chan
  2. PowerBuilder
  3. Thursday, 9 December 2021 10:23 AM UTC

Hi All,

I would like to get advise on below coding which done previous developer, what does the message.returnValue = 1 actually do here ? Does it have anything to do with system event ?

FYI the coding reside inside the window object custom event, and it trigger by parentwindow.triggerevent("ue_execute") from menu object.

 

ue_execute

event_id: pbm_customs57

////////////////////////////

If Not wf_reset_sales_modified() Then
  MessageBox('Error', 'Can not modify a sales flag from system setup.')
  message.returnvalue = 1
  Rollback;
  ls_dummy_run_status = ls_dummy_run_status + ' - ' + string(now()) + ' Error'
  ll_current_row = wf_dummy_process_status(ls_dummy_run_status, ll_current_row, False)
  Return
End If

 

Thanks in advance!

 

regards,

jit sing

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 9 December 2021 17:24 PM UTC
  2. PowerBuilder
  3. # 1

Hi Jit Sing;

  For the Message.ReturnValue = ? setting, you can influence what the O/S and/or PBVM will do when control is passed back to the Message Queue handler. The value and behaviour of the Return Value is totally dependent on the O/S message being processed. You can read more about this on MSDN: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmessage

   Also, when O/S messages arrive at a PB App they fire an event. However, there are various message queues and not just the one main App queue. An example of this is the DW Control and/or DataStore that have their own MQ's. In the case of the DC/DS, the PBVM (runtime) routes messages from the main App message Queue into the DC / DS MQ where they are processed by only the DC/DS MQ handler in the PBVM ... hence the PBM_DWNxxxxx specialized events. The PBM_DWNxxxxx events are only occurring because of the DC/DS MQ handler. The DC/DS object classes often do not see the main App message queue. However, when any O/S message is processed by an object class, it has the option to chain the message back on to the MQ it got it from so that other object classes can also detect it. The PBVM normally does this by default. However, when you state message.processed = 1 in your code, you are asking the MQ handler to not chain the message back on to the MQ it got it from so that other classes can see it.

   If Message.Porcessed = 0 and the message is then "chained", the Message.Return value is available to the next object class (or O/S process) that see the MQ next. They can then determine what they should do if the Message.Return Value is not Zero. Basically, a way of sending a "status code" down the MQ processing line of execution.

  Note: the DC/DS MQ does chaining but, never chains the original message back onto the main App's MQ. Once the message is routed to the DC/DS MQ, it chains along until the end of the DS/DS MQ is reached. That is why many non-DC/DS object classes never see DS/DC messages.

Regards ... Chris

Comment
  1. Arnd Schmidt
  2. Thursday, 9 December 2021 19:03 PM UTC
Chris,

I think you are writing about "message.processed = true".

regards

Arnd

  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 9 December 2021 19:25 PM UTC
Thanks Arndt. I have amended my original response. Sorry Jit Sing ... this answer turned out to be more of a little MQ tutorial.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.