No announcement yet.

Msgbox in a Callback.

  • Filter
  • Time
  • Show
Clear All
new posts

  • Msgbox in a Callback.

    Should this be avoided?

    In my program, in a %CBN_CLOSEUP message, I have placed two calls in row to the same function(different parameters) and one call to a second function. The functions reads data from two files.

    Values collected from the files is then displayed in some controls, among them 3 listview controls. The controls is located on a one paged Tabcontrol with its own callback, and it all works fine until a Msgbox call is placed before call to the functions. Then no controls is updated with the new data values.

    Anyone any clue?

  • #2
    Question is - why CBN_CLOSEUP? MS speaks, "In general, you cannot predict the order in which notifications will be sent. In particular, a CBN_SELCHANGE notification message may occur either before or after a CBN_CLOSEUP notification message."

    So maybe when focus shifts to MSGBOX, it intercepts selection / closeup notifycations. If MSGBOX is necessary, maybe can try acting on CBN_SELCHANGE instead and see if that helps.


    • #3
      You may be experiencing a re-entry problem with MSGBOX, code not shown, LOCAL variables may be being reset on re-entry. Borje's suggestion should work, if that's the case.
      I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.


      • #4
        To Borje:
        Sorry, didn't work, but I got it to work now. To share an issue with someone always inspires to try harder.

        In addition to what explained I also had code to save existing values in the controls under %CBN_Setfocus, and as said before, loaded new values under %cbn_closeup. Saving for one weekday and load for a different one.

        The weekday variable is a static one and caused the problem.

        Now I have placed a control get text... in the %CBN_DropDown to fetch current weekday showing in the combobox(saving) and the same call before fetching the new values.

        Both saving and fetching data is now placed under the %CBN_SelEndOk message.

        Very odd that there was no problem without the Msgbox.

        Thanks for support.


        • #5
          You may be experiencing a re-entry problem with MSGBOX, code not shown, LOCAL variables may be being reset on re-entry

          If you want to add some "display information for debugging purposes" without re-entrancy issues like this you might just want to add a STDOUT function as shown in this demo:

          Simple STDOUT for PB/DLL and PB/Win 2-13-04
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]