Modern Mobile Progress Bar

Sannyasin Brahmanathaswami brahma at hindu.org
Thu Oct 4 15:21:05 CEST 2018


Is there any way to get color to show on a native scrollbar (used as a
progress bar for a download) on mobile? It show up with background fill
black with barely visible thumbnail blue going across, changing the
color in IDE has no effect on mobile.

I think there is a mobile control, but as far I can  tell , it always in
relation to scrolling some other object, not a "standalone" progress bar.

The native scroll bar it pretty "ugly" and I would like the make the UI
bit close to what people are used to seeing.

[Side note: My goodness! I am using a function from the days of Scott
Raney, found in the first MetaCard IDE, 20 years ago... and it still
works Ha! How's that for xTalk viability! ]

But, how I would upgrade to modern UI?

This was always so simple:

*command*showProgress pURL, pStatus

*-- this is the status callback message which gets called regularly
during the download*

*-- pStatus will show some initialisation messages, then*

*-- loading,bytesReceived,bytesTotal*

*-- using a graphical progress bar instead*

*-- ths first time this is called, find the total number of bytes that
are to be downloaded*

*-- use this info to set the span of the progress bar*

*-- wait until the download info is being received*

*if* thenumberofitemsinpStatus = 3*then*

*if* thevisibleofscrollbar"Progressbar"= false*then*

*put*thelastitemofpStatus intotTotalBytes

*set*thestartValueofscrollbar"Progressbar"to0

*set*theendValueofscrollbar"Progressbar"totTotalBytes

*show*scrollbar"Progressbar"

*end* *if*

*set*thethumbPositionofscrollbar"Progressbar"toitem2ofpStatus

*end* *if*

*-- better text information*

*if* thenumberofitemsinpStatus = 3*then*

*put*item2ofpStatus intotBytesReceived

*put*item3ofpStatus intotTotalBytes

*-- this gives very large numbers that are not easily read, so convert
to KB*

*put*tBytesReceived div1024intotKBreceived

*put*tTotalBytes div1024intotTotalKB

*-- calculate speed*

*put*theseconds- sDownloadStart intotElapsedSeconds

*if* tElapsedSeconds = 0*then*

*-- make sure we don't divide by zero at the start*

*put*"unknown"intotKBperSecond

*else*

*put*round(tKBreceived / tElapsedSeconds, 1) intotKBperSecond

*end* *if*

*put*"Received (KB): "& tab& tKBreceived &cr& "Of Total (KB: "& tab&
tTotalKB & cr&\

"At KB/sec: "& tab& tKBperSecond intofld"ProgressField"

*end* *if*

*end*showProgress


BR





More information about the use-livecode mailing list