ViewCallback::SetUpdatePostFunction(func_viewUpdate) does not work

Hi All!

I'm working on an OpenCities Map MDL (C++) Application. I have an old code, which has been operating under Bentley V8i, and now I'm migrating it to Bentley CONNECT EDITION.

I would like to automatically update a View when it is opened by the user.

Under Bentley V8i there was this callback

mdlView_setFunction     (UPDATE_POST,  func_viewUpdate );

Now I switched that to this one

ViewCallback::SetUpdatePostFunction(func_viewUpdate);

The problem is, that the new callback is never called.

Under Bentley V8i the callback is called when I open a View in the application and then I can update it.

Under OpenCities Map Connect Edition the callback is not called.

Could you help me what am I doing wrong?

I tried to handle the WINDOW_SHOWEVENT in my window event handler callback, but I got constant errors and struggling with it.

Br,

Miklos Bodi

Parents
  • Greetings Miklos,

    Would you be able to provide test cases with source code demonstrating Bentley Map V8i expected behavior and unexpected behavior on OpenCities Map CONNECT Edition platform? Please feel free to direct message me for a secure upload location if necessary.

    Regards,

    Jeff Bielefeld [Bentley]



  • Hi Jeff,

    Thanks for your response. First I would like to describe again what I want to achieve so I made a screen shot of the application.

    When I click on the button surrounded with the red circle (at the bottom of the picture) a window pops up (named: View 1, Default). Before the windows appears I want to update it. I want to refresh what to draw inside the window.

    I've made a simple program which demonstrates how I try to achieve this.

    Here it is:

    ----------------------------------------------------------------------------------------------------------

    #include    <Mstn\MdlApi\MdlApi.h>

    static int     func_viewUpdate( bool                      preUpdate,          /* => TRUE if called before update */
                                    DgnPlatform::DgnDrawMode  eraseMode,          /* => display mode */
                                    DgnModelRefListP          modelRefList,       /* => files involved in update */
                                    int                       numberRegions,      /* => number of regions */
                                    Asynch_update_view        regions[],          /* => region descriptions */
                                    ViewContextP              context,            /* => view context */
                                    int                       numCovers[],        /* => cover list sizes */
                                    MSDisplayDescr            *displayDescr[]     /* => display descriptors */
    )
    {
        mdlDialog_openInfoBox(L"view update test message");
        return true;
    }

    extern "C" DLLEXPORT  void MdlMain
    (
        int     argc,             /* => number of args in next array */
        WCharCP argv[]            /* => array of cmd line arguments */
    )
    {

        ViewCallback::SetUpdatePostFunction(func_viewUpdate);

        //in old Bentley code I used this callback, but it is not working any more
        //mdlView_setFunction     (UPDATE_POST,  func_viewUpdate );
    }

    ---------------------------------------------------------------------------------------------------------------

    I want to update the content of the View in "func_viewUpdate" function.

    I call "ViewCallback::SetUpdatePostFunction(func_viewUpdate);" inside MdlMain and I reckon that my callback should be called. But it is not called at all ever.

    When I was developing plugins for Bentley V8i I used "mdlView_setFunction     (UPDATE_POST,  func_viewUpdate );" callback. After I registered my callback under V8i my callback handler was called before the window appeared and I could update the View.

    Br,

    Miklos

  • Miklos,

    Using the provided information, I've duplicated the behavior described for MicroStation V8i and confirmed that UPDATE_POST events are triggered after a view is opened and the view updates.

    In MicroStation CE the behavior I observed is that your func_viewUpdate function is being called only after a view update (e.g. refresh, zoom in/out etc...) event occurs, but not after a view is opened which is inconsistent with MicroStation V8i behavior. I would suggest you file a service request with your findings to have the issue further investigated.

    As a temporary workaround, you might try registering a window modify event callback using...

        mdlWindow_setFunction(windowModifyFunction);

    ...with function similar to...


    static void windowModifyFunction
    (
    MSWindowP        windowP,
    WindowModifyType windowOperation,
    BSIRectCP        oldGlobalP
    )
    {
        if (!windowP)
            return;

        if (WINDOW_SHOWEVENT != windowOperation)
            return;

        int viewIndex = -1;

        if (mdlWindow_isView (&viewIndexwindowP))
            mdlDialog_openInfoBox(L"window modify message");
    }

    ...which should be called when a view is opened. 

    Regards,

    Jeff Bielefeld [Bentley]



  • Hi Jeff,

    Thanks for your response. I will go on with this workaround.

    Br,

    Miklos

  • Hi Jeff, 

    We found that in V8i if you clicked on the Wiew Area button on the View toolbar, the above callback is triggered. However it is not called in CE.

    Could you recommend another workaround for that case? I think the windowModify events are not appropriate for that?

    I've also filled a support ticket about this issue.

    SR Number:
    7001143484

    Br,

    Miklos

  • Miklos,

    I was suggesting the use of both the temporary workaround for initial view open event and your existing event handler for view refresh, zoom in/out events. Will this approach work until the underlying MicroStation CE issue is resolved?

    Regards,

    Jeff Bielefeld [Bentley]



  • Hi Jeff,

    The problem is that 

    ViewCallback::SetUpdatePostFunction(func_viewUpdate);

    is not called when I click on the Window Area button.

    The "windowModifyFunction" WINDOW_MOVEEVENT and WINDOW_SHOWEVENET, which is good if my intention is to update the view. But I can not separate the Window Area Button press event from the other window events (Move, Show, Hide etc.). So in this case it is not a good solution.

    Thanks in advace.

    Br,

    Miklos

Reply
  • Hi Jeff,

    The problem is that 

    ViewCallback::SetUpdatePostFunction(func_viewUpdate);

    is not called when I click on the Window Area button.

    The "windowModifyFunction" WINDOW_MOVEEVENT and WINDOW_SHOWEVENET, which is good if my intention is to update the view. But I can not separate the Window Area Button press event from the other window events (Move, Show, Hide etc.). So in this case it is not a good solution.

    Thanks in advace.

    Br,

    Miklos

Children
No Data