none
SB IDE ++ IOForms Threading RRS feed

  • Question

  • There is something about using SB IDE ++ with IOForms and threading that I don't understand.  I can setup a form using IOForms by putting some controls on it.  Then I can setup events for the added controls and that works OK.  What I am having trouble with is trying to do other actions right after the IOForms.InitializeForm() function.  If I put anything right after it doesn't execute until I close the form.  I'm sure it has to do with threading, but why doesn't it work and how should it be done. 

    Below the TextWindow.Writeline won't execute unless I close the form.  Here's an example of the code:

    'Auto-generated by IOForm Designer --- do not modify!'
    Sub InitializeComponent
    EndSub
    'End of IOForm Designer code'


    IOForms.Setup()
    InitializeComponent()
    IOForms.WindowWidth = 400
    IOForms.WindowHeight = 400
    IOForms.AddWindow("New Window")
    IOForms.ShowWindow("New Window")
    IOForms.InitializeForm()

    TextWindow.Writeline("Here")


    JR

    Wednesday, November 6, 2013 8:50 PM
    Answerer

Answers

  • I did get a reply from Gungan37 for this issue.  Here's a copy of his reply:

    This is by design (you can find a note in the extension
    documentation.)

    To start a WinForm you have to start its
    message pump (which takes in all outside messages: e.g a mouse click sends a
    WM_LBUTTONDOWN message) which is a thread-locking operation. Until the pump is
    closed (when the window is destroyed), the pump has full control of the
    thread.

    However, you can still use code in events
    as they are not restricted the the locked thread.

    Here is a thorough explanation of the
    message-passing system: http://msdn.microsoft.com/en-us/library/windows/desktop/ms644927(v=vs.85).aspx


    JR

    Friday, November 15, 2013 8:19 PM
    Answerer

All replies

  • Any suggestions?
    Friday, November 15, 2013 6:47 PM
    Moderator
  • I've got no idea. Sorry. If there's nothing in the help and you don't get help here then you could report it as a bug (via the help menu, or email the developer). That way it may be included in the FAQs or help.

     

    Friday, November 15, 2013 7:45 PM
    Moderator
  • Maybe there might be a similarity to a situation I had with Shapes in SB.

    GraphicsWindow.Hide()
    
    box = Shapes.AddRectangle(3,3)
    
    GraphicsWindow.Show()
    
    Shapes.Zoom(box, 1, 1)   'initialise the Zoom to GW before Hiding. Workaround Zoom Bug
    Shapes.HideShape(box)

    I found that I could only alter (rescale the shape) while the GW was shown. If I didn't the altered shape was not working as it should with the GW.

    Might be helpful. I put this scenario down to initialising the altered shape to the GW. The GW had to be shown for it to work properly. In your case it might be

    IOForms.ShowWindow("New Window")

    InitializeComponent()

    Friday, November 15, 2013 8:05 PM
    Moderator
  • I did get a reply from Gungan37 for this issue.  Here's a copy of his reply:

    This is by design (you can find a note in the extension
    documentation.)

    To start a WinForm you have to start its
    message pump (which takes in all outside messages: e.g a mouse click sends a
    WM_LBUTTONDOWN message) which is a thread-locking operation. Until the pump is
    closed (when the window is destroyed), the pump has full control of the
    thread.

    However, you can still use code in events
    as they are not restricted the the locked thread.

    Here is a thorough explanation of the
    message-passing system: http://msdn.microsoft.com/en-us/library/windows/desktop/ms644927(v=vs.85).aspx


    JR

    Friday, November 15, 2013 8:19 PM
    Answerer