Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Remove Form completely destroys form

I know that sounds like what its supposed to do but...

I have a scenario where I am using setform to do exactly that.

NewWindow = Start_Window(wname) Handle = Get_Property(NewWindow, "HANDLE") Send_Message(PanelCtrl$, "OLE.SetForm", Handle, 1, 1) That all works fine.
On the close event of the window with the panel I call the remove form method
Send_Message(PanelCtrl$, "OLE.RemoveForm", 1) That seems to work too.

The problem I'm having is that if I restart the window with the panel, the same code above calling 'Start_Window' doesn't work.
Start_window just returns null to NewWindow so the panel is now empty.

I have to close OI in order for the start_window call to be successful again.

Any thoughts?

Comments

  • Should've done this before but adding a call to get_status after the call to start_window tells me that my window already exists.

    So the problem seems to be that the destroy doesn't completely destroy rather than the opposite.
    It certainly disappears from view but for whatever reason OI thinks its still there and any subsequent call won't work.

    Solution is to 'Allow multiple instances' of the window in the form designer
  • RemoveForm only removes the form from the panel, but it does not close the window. Have you tried calling Close_Window on the form after calling RemoveForm?
  • Hi Kevin,

    I did give end_window a try and that didn't seem to make an difference.
    I could try sending a close event I guess.

    I was under the impression though that the purpose of the "Destroy" flag in the removeform method was to close the window. Have I misunderstood that?
  • My apologies. I completely forgot that there was a destroy parameter. It is amazing how difficult it is to remember my own code.

    It's possible that the letting RemoveForm destroy the window for you is causing OI's Presentation Server to not be notified that the window has died. I'll have to do some more testing on my end.
  • Not that amazing. I struggle to remember what I had for breakfast.

    Thanks for checking
Sign In or Register to comment.