Loading ...
Sorry, an error occurred while loading the content.

40774RE: [libertybasic] menu halts program

Expand Messages
  • Stefan Pendl
    May 1, 2010
    • 0 Attachment
      > > >
      > > > I have a continuous graphing program which has a a menu bar.
      > > > The main loop of the program is something like:
      > > >
      > > > Do
      > > > Scan
      > > > Loop until 1=0
      > > >
      > > > When the menu is accessed (or in fact, any windows dialogue
      > > > box like FILEDIALOG is brought up) the program halts the loop
      > > > until the menu is closed again, then the loop continues.
      > > >
      > >
      > > Instead of using a loop you can use a TIMER to update the graph.
      > >

      ---snip

      > >
      > > To have the update of the graph being fully independent
      > from the GUI user interaction, one would have to create a
      > separate thread
      > > for the graph update procedure, but this currently not
      > possible with LB.
      > >
      >
      > Hi Stefan
      >
      > Thanks for the reply. I don't know what you mean by "a
      > separate thread". Could you clarify?
      >
      > Ross
      >

      When you start a program, Windows will launch it in a process.
      This process is doing his work in a thread, which is called the main-thread.

      Now, if you need to do some work concurrently you would create a child thread, which will then do the separate work.
      This is as simple as multi-threading can be described.

      The problem is, that developing a multi-threaded application, which is thread-safe, is a challenging task.

      ---

      You could think about it in a different way:

      You run your program and it launches another TKN, which receives the handle to the graphics box, where the graph should be
      displayed.
      The second program draws the graph, sends the image to the graphics box and notifies the main program of the change.

      ---
      Stefan Pendl

      Liberty BASIC Assist 4.03 ........ http://www.libertybasic.com/assist.html
      Liberty BASIC 4.04 RC2 ........... http://www.libertybasic.com/lb404setup.exe

      Books at http://www.lulu.com/ and http://www.amazon.com/
      Alyce Watson ... APIs for Liberty BASIC
      Carl Gundel .... Beginning Programming with Liberty BASIC

      Windows 7 Home Premium 64-bit RTM
      AMD Turion X2 RM-70 2GHz, 4GB RAM
    • Show all 4 messages in this topic