QB64.org Forum

QB64 Team Software => InForm Discussion => Topic started by: IronMan on March 20, 2020, 10:59:57 pm

Title: Progress Bar Info
Post by: IronMan on March 20, 2020, 10:59:57 pm
Anyone got any examples for the progress bar in inForm?

Can't seem to find any place o get started on using this routine, and I'm needing to add it to one of my applications.

Any help is appreciated.

Thank you.
Kent
Title: Re: Progress Bar Info
Post by: FellippeHeitor on March 20, 2020, 11:33:46 pm
I can help. What do you intend to do?
Title: Re: Progress Bar Info
Post by: IronMan on March 21, 2020, 12:12:36 am
For starters just the basics to make the ProgressBar Move. I have created a button and placing code on it when it clicks to moved the ProgressBar1. I have tried, but don't think I'm using the correct syntax because I get errors.

I have tried:

ProgressBar1 = 25
ProgressBar1 Value=25
ProgressBar1 Value=(25)

In more detail, I created a small applications that downloads images from the internet, and when it's downloading the files I would like it t show the progress. Here is an example of the code:


' Getting images from WTVA Weather Center

IF Download(Img1, "radarr.jpg", 10) THEN
END IF

IF Download(Img2, "radarn.jpg", 10) THEN
END IF

IF Download(Img3, "warning.jpg", 10) THEN
END IF

IF Download(Img4, "7day.jpg", 10) THEN
END IF

IF Download(Img5, "cur_temp.jpg", 10) THEN
END IF

IF Download(Img6, "temp_hi.jpg", 10) THEN
END IF

IF Download(Img7, "temp_lo.jpg", 10) THEN
END IF

IF Download(Img8, "humidity.jpg", 10) THEN
END IF

IF Download(Img9, "dewpoint.jpg", 10) THEN
END IF

IF Download(Img10, "winds.jpg", 10) THEN
END IF

IF Download(Img11, "almanac.jpg", 10) THEN
END IF



Be nice if to wold update the ProgressBar1 in between images.


Thanks you for any help.

Kent




Title: Re: Progress Bar Info
Post by: FellippeHeitor on March 21, 2020, 10:14:39 am
To manipulate any control in InForm you must use the Control() array.

Code: QB64: [Select]
  1. Control(ProgressBar1).Min = 0
  2. Control(ProgressBar1).Max = 11 'you mention you will be loading 11 files

Then, to update it, change the .Value property:
Code: QB64: [Select]
  1. Control(ProgressBar1).Value = Control(ProgressBar1).Value + 1

Update it every time a file has been downloaded.

I recommend treating SUB __UI_BeforeUpdateDisplay as if it was your main program loop for this type of operation.
Title: Re: Progress Bar Info
Post by: Qwerkey on March 21, 2020, 10:38:50 am
This project (rather a large thing) has a Progress Bar (Fellippe had trained me in its use).
https://www.qb64.org/forum/index.php?topic=581.0 (https://www.qb64.org/forum/index.php?topic=581.0)
Title: Re: Progress Bar Info
Post by: IronMan on March 21, 2020, 03:16:07 pm
To manipulate any control in InForm you must use the Control() array.

Code: QB64: [Select]
  1. Control(ProgressBar1).Min = 0
  2. Control(ProgressBar1).Max = 11 'you mention you will be loading 11 files

Then, to update it, change the .Value property:
Code: QB64: [Select]
  1. Control(ProgressBar1).Value = Control(ProgressBar1).Value + 1

Update it every time a file has been downloaded.

I recommend treating SUB __UI_BeforeUpdateDisplay as if it was your main program loop for this type of operation.



Fellippe,

I tried to add this into my code but apparently I'm not doing it correctly. Please find below the entire source for this small weather applications I'm making. If you could please be so kind to show me where this needs to be added I would greatly appreciate it.
Once I see it, I think I will have a better understanding of whats going on.

Thank you for all your help.
Kent



Title: Re: Progress Bar Info
Post by: FellippeHeitor on March 21, 2020, 03:43:49 pm
Try it like this (see attachment).
Title: Re: Progress Bar Info
Post by: IronMan on March 21, 2020, 05:40:22 pm
Try it like this (see attachment).

PERFECT!!! Working good and I have a better understanding of this now. The cleanup of the code was very helpful also.

Thank you again for all your help.
Kent
Title: Re: Progress Bar Info
Post by: FellippeHeitor on March 21, 2020, 06:18:46 pm
My pleasure.