Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
LCL
»
Current position of the progress bar
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Poll: Watches and Display...
by
440bx
[
Today
at 09:55:22 pm]
Dialog ShowModal and an i...
by
d7_2_laz
[
Today
at 09:51:39 pm]
JEDI error but unit compi...
by
Thaddy
[
Today
at 09:30:33 pm]
Understanding and adjusti...
by
circular
[
Today
at 09:09:56 pm]
how to search in rxmemory...
by
rcmz
[
Today
at 08:45:16 pm]
Controlling the behavior ...
by
wp
[
Today
at 08:29:28 pm]
Offical launch of the 1 B...
by
Gustavo 'Gus' Carreno
[
Today
at 08:21:29 pm]
how to change the color f...
by
wp
[
Today
at 07:23:58 pm]
Dynarray initialization p...
by
Thaddy
[
Today
at 06:30:12 pm]
Project fails on run but ...
by
dseligo
[
Today
at 05:30:42 pm]
Zeos components. Had to c...
by
Fantablup
[
Today
at 04:17:13 pm]
[SOLVED] Completion box s...
by
furious programming
[
Today
at 04:12:26 pm]
[LAMW] How to create a ca...
by
af0815
[
Today
at 03:48:16 pm]
Complex package installat...
by
wp
[
Today
at 03:38:16 pm]
A "leisure" question on W...
by
gidesa
[
Today
at 03:17:10 pm]
Curling Pythagoras Tree: ...
by
AlexTP
[
Today
at 03:07:53 pm]
[SOLVED] Combined pointer...
by
CM630
[
Today
at 02:48:41 pm]
Using KeyPress event, how...
by
Zvoni
[
Today
at 02:24:42 pm]
a Unit problem?
by
Thaddy
[
Today
at 01:56:12 pm]
Any upgrades to fpWeb pag...
by
marcov
[
Today
at 12:50:25 pm]
Help needed with Cairo / ...
by
Roland57
[
Today
at 12:25:16 pm]
Configure JCF messages
by
DomingoGP
[
Today
at 11:26:55 am]
IDE instability on Raspbe...
by
rvk
[
Today
at 10:37:14 am]
Boleeman's projects are p...
by
AlexTP
[
Today
at 10:18:04 am]
Your best UI design - con...
by
circular
[
Today
at 09:36:11 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Current position of the progress bar (Read 938 times)
Pe3s
Hero Member
Posts: 533
Current position of the progress bar
«
on:
May 15, 2022, 10:34:07 am »
Hi, how can I calculate the current position of the progress bar if I know the length of a music track or movie?
Logged
Thaddy
Hero Member
Posts: 14205
Probably until I exterminate Putin.
Re: Current position of the progress bar
«
Reply #1 on:
May 15, 2022, 10:43:47 am »
scale to 100%, position is at X% (very simple 12 year old math)
Logged
Specialize a type, not a var.
Pe3s
Hero Member
Posts: 533
Re: Current position of the progress bar
«
Reply #2 on:
May 15, 2022, 11:30:55 am »
Code: Pascal
[Select]
[+]
[-]
pbar
.
value
:
=
pbar
.
ClientWidth
*
duration ?????
Logged
bytebites
Hero Member
Posts: 633
Re: Current position of the progress bar
«
Reply #3 on:
May 15, 2022, 11:54:48 am »
Code: Pascal
[Select]
[+]
[-]
ProgressBar1
.
Min
:
=
0
;
ProgressBar1
.
Max
:
=
100
;
ProgressBar1
.
Position
:
=
trunc
(
music
.
position
/
duration
*
100
)
;
Application
.
ProcessMessages
;
Logged
howardpc
Hero Member
Posts: 4144
Re: Current position of the progress bar
«
Reply #4 on:
May 15, 2022, 07:14:31 pm »
Quote from: Thaddy on May 15, 2022, 10:43:47 am
scale to 100%, position is at X% (very simple 12 year old math)
@Thaddy
Sometimes your advice is negated by the way you belittle the questioner. Suppose the questioner is a refugee who has had no formal education at primary or teenage level?
If you can't resist adding a snide comment to complete your advice I feel it would be better that you not offer any response.
Logged
440bx
Hero Member
Posts: 3946
Re: Current position of the progress bar
«
Reply #5 on:
May 15, 2022, 09:13:45 pm »
@Thaddy,
I have to concur with @howardpc and, FYI, putting people down doesn't make you look good, on the contrary.
Logged
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
LCL
»
Current position of the progress bar
TinyPortal
© 2005-2018