Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1046643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:10:39+00:00 2026-05-16T16:10:39+00:00

I have built a long running script to which I have added a progress

  • 0

I have built a long running script to which I have added a progress bar with the following code:

function StartProgressBar()
   gaugeProgress = iup.gaugeProgress{}
   gaugeProgress.show_text = "YES"
   gaugeProgress.expand = "HORIZONTAL"
   dlgProgress = iup.dialog{gaugeProgress; title = "Note Replacement in Progress"}
   dlgProgress.size = "QUARTERxEIGHTH"
   dlgProgress.menubox = "NO"  --  Remove Windows close button and menu.
   dlgProgress:showxy(iup.CENTER, iup.CENTER)  --  Put up Progress Display 
   return dlgProgress
end

This is called before the loop and the progress bar updated during the loop (I am not calling MainLoop). At the end of the process I call dlgProgress.destroy to clear it.

As long as I don’t take focus from the progress bar it works fine, but if focus is lost the program crashes, so I am sure I am doing this the wrong way. Can any one tell me the correct way. A detailed google did not find me any examples for iup, lua progress bars.

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:10:40+00:00Added an answer on May 16, 2026 at 4:10 pm

    Here is a working sample.

    require "iuplua"
    
    local cancelflag
    local gaugeProgress
    
    local function StartProgressBar()
        cancelbutton = iup.button {
            title = "Cancel",
            action=function()
                cancelflag = true
                return iup.CLOSE
            end
        }
        gaugeProgress = iup.progressbar{ expand="HORIZONTAL" }
        dlgProgress = iup.dialog{
            title = "Note Replacement in Progress",
            dialogframe = "YES", border = "YES",
            iup.vbox {
                gaugeProgress,
                cancelbutton,
        }
        }
        dlgProgress.size = "QUARTERxEIGHTH"
        dlgProgress.menubox = "NO"  --  Remove Windows close button and menu.
        dlgProgress.close_cb = cancelbutton.action
        dlgProgress:showxy(iup.CENTER, iup.CENTER)  --  Put up Progress Display
        return dlgProgress
    end
    
    
    dlg = StartProgressBar()
    gaugeProgress.value = 0.0
    
    for i=0,10000 do
        -- take one step in a long calculation
        -- update progress in some meaningful way
        gaugeProgress.value = i / 10000
        -- allow the dialog to process any messages
        iup.LoopStep()
        -- notice the user wanting to cancel and do something meaningful
        if cancelflag then break end
    end
    
    -- distinguish canceled from finished by inspecting the flag
    print("cancled:",cancelflag)
    

    I’ve used IUP 3.0, and its standard Lua binding here. The gauge control is named iup.progressbar in IUP 3.0, and was named iup.gauge in earlier versions. In earlier versions it may have been in the extended controls library as well.

    I’ve tested this on Windows. One assumes it has similar behavior on other platforms, but your mileage may vary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a long-running msbuild script that I'm trying to speed up. Is there
I have a long-running service with several threads calling the following method hundreds of
I have a scenario which is causing very long running processes and suspect it
I have long file with the following list: /drivers/isdn/hardware/eicon/message.c//add_b1() /drivers/media/video/saa7134/saa7134-dvb.c//dvb_init() /sound/pci/ac97/ac97_codec.c//snd_ac97_mixer_build() /drivers/s390/char/tape_34xx.c//tape_34xx_unit_check() (PROBLEM)/drivers/video/sis/init301.c//SiS_GetCRT2Data301() /drivers/scsi/sg.c//sg_ioctl()
I have built a site which requires user to login. Now I have decided
I have a form that is going to be executing a failry long running
I have a C++ code base that has been working for a long time.
I have a Perl script running on version 5.10 build 1004 of ActiveStates Active
I have a somewhat long-running post-build event (long enough to be annoying to wait
I have a long running process in VB6 that I want to finish before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.