0

Is there any way to extend the amount of time a progress bar message is displayed? Say extend it so that it is posted for about 1.5 seconds?

Getch
  • 107
  • 2
  • 10
  • 1
    Can you give a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) of your code, showing your problem? It is not quite clear to me what you want to achieve. – Thomas K Oct 10 '15 at 08:04

1 Answers1

0

you can use functionality from shinyIncubator package. I set the sleep for 1.5 seconds as per your example, so when the task is finished the message will remain visible for 1.5 seconds.

rm(list = ls())
library(shiny)
library(shinyIncubator)

server <- function(input, output, session) {
  observe({
    if(input$aButton==0) return(NULL)
    withProgress(session, min=1, max=15, expr={
      for(i in 1:10) {
        setProgress(message = 'Finished...',detail = paste0('Number ',i, ':10'))
        Sys.sleep(0.1)
      }
      Sys.sleep(1.5)
    })
  })
}

ui <- pageWithSidebar(
  headerPanel("Testing"),
  sidebarPanel(actionButton("aButton", "Let's go!"), width=2),
  mainPanel(progressInit())
)

shinyApp(ui = ui, server = server)
Pork Chop
  • 28,528
  • 5
  • 63
  • 77