Recent

Author Topic: Progressbar.Position  (Read 11882 times)

asdf

  • Sr. Member
  • ****
  • Posts: 310
Progressbar.Position
« on: November 16, 2010, 10:42:57 am »
lns: integer;
totlns: integer;
ProgressBar1.Min:=0;
ProgressBar1.Max:=100;
ProgressBar1.Smooth:=True;
ProgressBar1.Enable:=True;

.
.
.
ProgressBar1.Position:=((lns/totlns)/100);[color=teal] // Error Got "Extended", expected "LongInt" ?[/color]
Application.ProcessMessages;

Please help getting "LongInt". And the above codes are OK or not?
Lazarus 1.2.4 / Win 32 / THAILAND

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Progressbar.Position
« Reply #1 on: November 16, 2010, 10:53:18 am »
use div instead of /

DirkS

  • Sr. Member
  • ****
  • Posts: 251
Re: Progressbar.Position
« Reply #2 on: November 16, 2010, 10:55:45 am »
I would set ProgressBar.Max to the highest number and let it do the maths itself...

Assuming that totlns is the highest number and lns is the loopcounter:
Code: [Select]
lns: integer;
totlns: integer;
ProgressBar1.Min:=0;
ProgressBar1.Max:=totlns;
ProgressBar1.Smooth:=True;
ProgressBar1.Enable:=True;
.
.
ProgressBar1.Position := lns;

Gr.
Dirk

asdf

  • Sr. Member
  • ****
  • Posts: 310
Re: Progressbar.Position
« Reply #3 on: November 16, 2010, 11:13:31 am »
It works now.
Just let it do itself.
Thank you.

But I personally hate it's green color.... lol
Lazarus 1.2.4 / Win 32 / THAILAND

ivan17

  • Full Member
  • ***
  • Posts: 173
Re: Progressbar.Position
« Reply #4 on: November 16, 2010, 01:31:36 pm »
But I personally hate it's green color.... lol
use one of the resource extraction tools to get the progress bar bitmap from luna.msstyles, recolor it, put it back and restart the system.

i am boring people by repeating this but go get the theme you'd like (try destiny, opus-os, clearlooks, royale/noir, zune) - don't immediately consider changing something just because you don't like it on luna (xp default style) with blue color scheme.  my progressbars are orange.

mas steindorff

  • Hero Member
  • *****
  • Posts: 560
Re: Progressbar.Position
« Reply #5 on: November 16, 2010, 04:32:09 pm »
But I personally hate it's green color.... lol

depends on the season for me.  how to change...
http://lazarus.freepascal.org/index.php/topic,9545.msg46995.html#msg46995
windows 10 &11, Ubuntu 21+ IDE 3.4 general releases

cdbc

  • Hero Member
  • *****
  • Posts: 2561
    • http://www.cdbc.dk
Re: Progressbar.Position
« Reply #6 on: November 16, 2010, 05:56:50 pm »
Hi

Your math is off...:
  ((lns/totlns)/100);
Should be:
  ((lns div totlns) * 100);
to get percentage :-)

hth - Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

 

TinyPortal © 2005-2018