Announcement

Collapse
No announcement yet.

Problems displaying the number of processed items during intensive processing.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems displaying the number of processed items during intensive processing.

    When I run a program for netting (The process of calculating net requirements in an MRP system) I want to show how many items have been processed.
    This will not work
    Code:
     INCR ART_ANTAL
    IF ART_ANTAL MOD 1000 = 0 THEN ' Number of Items, in all c:a 51,000
    CONTROL SET TEXT HD, %ART_ANT, TAL2TXT(KOM, STR$(ART_ANTAL))
    CONTROL SET TEXT HD, %ARTBEN , ART.ARTBEN
    CONTROL SET TEXT HD, %ARTNR , ART.ARTNR
    CONTROL SET TEXT HD, %LN_AKT , TAL2TXT(KOM, STR$(ART.LN))
    END IF
    But this will work
    Code:
     INCR ART_ANTAL
    IF ART_ANTAL MOD 1000 = 0 THEN ' Number of Items, in all c:a 51,000
    CONTROL SET TEXT HD, %ART_ANT, TAL2TXT(KOM, STR$(ART_ANTAL))
    CONTROL SET TEXT HD, %ARTBEN , ART.ARTBEN
    CONTROL SET TEXT HD, %ARTNR , ART.ARTNR
    CONTROL SET TEXT HD, %LN_AKT , TAL2TXT(KOM, STR$(ART.LN))
    ?ART.ARBEN' <<=======================
    But I can not click ok 51 times.
    I have tried different methods, DIALOG DOEVENT for example, but nothing works.
    Someone who has better knowledge than me?

    /Fim W.
    Fim Wästberg

  • #2
    Howdy, Fim!

    This sound like a perfect opportunity to use a thread. Run the processing in a thread and your control set text code should work.

    Comment


    • #3
      Gary,
      I will try it.
      Fim Wästberg

      Comment


      • #4
        Fim,

        If a modal dialog try DIALOG REDRAW HD
        DIALOG DOEVENTS is for modeless dialogs.
        How long is an idea?

        Comment


        • #5
          Gary,
          Bingo!!
          Now it works exactly as I want.
          Many thanks
          But, the question remains, why?
          /Fim
          Fim Wästberg

          Comment


          • #6
            Fim,
            there's not much code shown there but I'd guess that your window message loop is also doing your "intensive processing".
            But while it's doing that, it never loops back to process the next message in the loop so the window never gets updated.


            The message loop needs to process things quickly (milliseconds) in order to keep the window responsive so any intensive processing should be done elsewhere, usually by putting it in a thread of its own.

            Comment


            • #7
              Paul,
              "here's not much code shown"
              Yes it's because the program includes 2,036 lines plus a lot of DLLs
              But I understand what you mean, so in the future I will put intensive processing in a thread.
              Thanks for the new knowledge.
              /Fim
              Fim Wästberg

              Comment


              • #8
                You do not have to do that. Just put your display instructions in the processing function.
                Walt Decker

                Comment


                • #9
                  Did you try post #4?
                  Is the dialog modeless?
                  CONTROL REDRAW and DIALOG REDRAW do not work?
                  Using style WS_CLIPCHILDREN?
                  How long is an idea?

                  Comment


                  • #10
                    Mike,
                    No, I'm happy now with the solution with thread.
                    Fim Wästberg

                    Comment


                    • #11
                      Someday please give redraw a try.
                      We have no idea if it is a modeless dialog.

                      Here are two more ways: https://forum.powerbasic.com/forum/u...hile-scrolling
                      How long is an idea?

                      Comment


                      • #12
                        Originally posted by Fim Wästberg View Post
                        Mike,
                        No, I'm happy now with the solution with thread.
                        A timer would likely also work.
                        It's just a matter of what has priority.
                        The world is strange and wonderful.*
                        I reserve the right to be horrifically wrong.
                        Please maintain a safe following distance.
                        *wonderful sold separately.

                        Comment


                        • #13
                          Maybe you should do a search here for one of the many fine "progress bar" examples provided by other members.
                          Michael Mattias
                          Tal Systems (retired)
                          Port Washington WI USA
                          [email protected]
                          http://www.talsystems.com

                          Comment

                          Working...
                          X