Results 1 to 10 of 10

Thread: OnShow / OnHide

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2017
    Location
    Belgium
    Posts
    245

    Default OnShow / OnHide

    In DF19.0 the OnHide event was always fired before the OnShow event (cWebView).

    It seems this has reversed in 19.1 RC1, why is this?

  2. #2

    Default Re: OnShow / OnHide

    The triggering of OnShow was changed, and broken.

    From DoShow in cWebView:

    Code:
            //  Fire OnShow (optimization, used to be fired from JavaScript)
            WebGet pbServerOnShow to bOnShow
            If (bOnShow) Begin
                Send OnShow 
            End
    This means that now OnShow is triggered way earlier than before. It is triggered before any content in the view is rendered. This makes it unusable for any kind of initialization of created components.

    DAW, would you consider reverting this change? Or can you provide an alternative event to use, that fires after the components in the view are rendered?

  3. #3
    Join Date
    Oct 2017
    Location
    Belgium
    Posts
    245

    Default Re: OnShow / OnHide

    Jakob,

    Indeed. Most of our code works fine with the "optimization" but in a few cases I had to add a timer so it would be executed after the view was rendered (like showing our custom menu).
    An alternative event would be great for this, but I doubt we will see that in the 19.1 release.. so timers it is for now.

  4. #4

    Default Re: OnShow / OnHide

    I'm thinking the point of the RC is to get feedback on what breaks, so the last bugs can be ironed out before the release.

    This "optimization" completely changes things (which means it's not an optimization) and breaks existing apps. I'm not expecting DAW to add another event now, I was merely asking if we were meant to use another existing one (I don't think there is one, but I might be mistaken). I am however hoping this "optimization" does not make it into 19.1 final.

  5. #5
    Join Date
    Feb 2009
    Location
    Hengelo (NL)
    Posts
    1,891

    Default Re: OnShow / OnHide

    event to use, that fires after the components in the view are rendered
    I've used 'OnSyncView' a bunch.
    https://docs.dataaccess.com/dataflex...OnSyncView.htm

  6. #6

    Default Re: OnShow / OnHide

    Ah yes. I should have said "fires once". It is for initialization of client-side (DOM) objects. OnShow triggers now after client-side objects are constructed, but before their "openHtml" method is called, meaning before any DOM is created. If you trigger an error in OnShow in some view in 19.1 RC1, and then navigate into that view, then the breadcrumb will be changed, but the rest of the page will still show the view from which you navigated.

    In a custom component another option is for the component itself to fire some event (we could call it "OnShow") after it has been rendered, but that was exactly what the view did in 19.0.

  7. #7
    Join Date
    Feb 2009
    Location
    Copenhagen, Denmark
    Posts
    2,005

    Default Re: OnShow / OnHide

    Why don't this hit all controls?

    -Sture

  8. #8
    Join Date
    Feb 2009
    Location
    The Netherlands
    Posts
    4,670

    Default Re: OnShow / OnHide

    I was not aware of people relying on elements to be rendered in this event. Most controls have their API's built in such a way that it doesn't matter if it is rendered or not when you change web properties or call client actions. The fact that OnShow now fires before OnHide is a bit ugly.

    The optimization was aiming to safe a round-trip and reduce 'flickering' when using this event perform finds.

    I'll undo the change and have OnShow fired in its own round-trip again. I'll add in an OnBeforeShow event on the moment where OnShow if fired in 19.1 now, that would be the place to perform finds and fill lists.

  9. #9
    Join Date
    Oct 2017
    Location
    Belgium
    Posts
    245

    Default Re: OnShow / OnHide

    Harm,

    That would be great !
    This allows us to transition all of our current OnShow procedures to the OnBeforeShow event (we barely use the OnShow event, most of the code goes into the OnNavigateForward to prevent the "flickering").

    But you're right, I've only found 2 places where this caused us trouble. And 1 of those was a cWebFloatingPanel,sending a show event to the panel in the onshow of the dashboard.

  10. #10

    Default Re: OnShow / OnHide

    That sounds good, thanks Harm.

    For the regular controls, I'm sure your initial change was not a problem. For more complicated JavaScript-based custom controls, I haven't found a good alternative for using OnShow for initialization.

    For example this could be a calendar control with a limited set of "contructor properties", but with an extensive method API. If I wanted to say, have it show next weeks calendar when the view is shown, I would have to do that in OnShow, because the client-side object needs to be rendered before I can call the (imaginary) "showNextWeek()" method.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •