Beachball cursor Help

Richard Gaskin ambassador at fourthworld.com
Mon Nov 8 11:47:55 EST 2010


pepetoo wrote:

 > Mark, I understand what you're saying, but when my application
 > starts up it takes maybe 5 to 10 seconds to load data the user
 > has previously saved or default data. I like to have a "simple"
 > indication that something is happening. I suppose I could use
 > the wristwatch, but nothing as complicated as a progress bar.

You could replace the images in the cursors stack with more colorful 
ones, but as Mark pointed out the problem is that the color beachball is 
used by the OS to indicate an unresponsive app, so using that will 
prompt some users to force-quit the app thinking it's having a problem.

I would go for the progress bar.  It takes only a few minutes to set up, 
and lets users know exactly where they are in that long wait.

Here's a rough sketch of how you might use a progress bar from a routine 
which has to process a lengthy data file line by line - this assumes 
there's a scrollbar control named "progress" on the current stack:


on LoadDocument pFile
    put url ("file:"& pFile) into tData
    SetupProgress the number of lines of tData
    put 0 into i
    repeat for each line tLine in tData
        add 1 to i
        ShowProgress i
        --
        DoMyRecordLoadingStuffHere
    end repeat
    EndProgress
end LoadDocument


on SetupProgress pMax
    set the startValue of sb "progress" to 0
    set the endValue of sb "progress" to pMax
    set the thumbpos of sb "progress" to 0
    show db "progress"
end SetupProgress


on ShowProgress pVal
    -- only update every 100th time through loop,
    -- so that the OS overhead of rendering the
    -- progress bar doesn't slow things down;
    -- depending on the size of the data you may
    -- want to use another number instead of 100:
    if pVal mod 100 - 0 then
        set the thumbpos of sb "progress" to pVal
        wait 0 with messages -- allow redraw
    end if
end ShowProgress


on EndProgress
    set the thumbpos of sb "progress" to the endValue of sb "progress"
    hide sb "progress"
end EndProgress


--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv



More information about the use-livecode mailing list