### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: Current position of the progress bar  (Read 497 times)

#### Pe3s

• Full Member
• Posts: 206
##### 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?

• Hero Member
• Posts: 11764
##### 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)
Black themes should be banned.

#### Pe3s

• Full Member
• Posts: 206
##### Re: Current position of the progress bar
« Reply #2 on: May 15, 2022, 11:30:55 am »
Code: Pascal  [Select][+][-]
1. pbar.value:= pbar.ClientWidth * duration ?????

#### bytebites

• Sr. Member
• Posts: 493
##### Re: Current position of the progress bar
« Reply #3 on: May 15, 2022, 11:54:48 am »
Code: Pascal  [Select][+][-]
1. ProgressBar1.Min:=0;
2. ProgressBar1.Max:=100;
3.
4.
5. ProgressBar1.Position:=trunc(music.position/duration*100);
6. Application.ProcessMessages;

#### howardpc

• Hero Member
• Posts: 3988
##### Re: Current position of the progress bar
« Reply #4 on: May 15, 2022, 07:14:31 pm »
scale to 100%, position is at  X% (very simple 12 year old math)
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.

#### 440bx

• Hero Member
• Posts: 2928
##### Re: Current position of the progress bar
« Reply #5 on: May 15, 2022, 09:13:45 pm »