Author Topic: Progress Bar Info  (Read 8460 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline IronMan

  • Newbie
  • Posts: 38
    • View Profile
Progress Bar Info
« 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

FellippeHeitor

  • Guest
Re: Progress Bar Info
« Reply #1 on: March 20, 2020, 11:33:46 pm »
I can help. What do you intend to do?

Offline IronMan

  • Newbie
  • Posts: 38
    • View Profile
Re: Progress Bar Info
« Reply #2 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





FellippeHeitor

  • Guest
Re: Progress Bar Info
« Reply #3 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.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Progress Bar Info
« Reply #4 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

Offline IronMan

  • Newbie
  • Posts: 38
    • View Profile
Re: Progress Bar Info
« Reply #5 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



* weather.txt (Filesize: 7.02 KB, Downloads: 352)

Marked as best answer by IronMan on March 21, 2020, 01:38:47 pm

FellippeHeitor

  • Guest
Re: Progress Bar Info
« Reply #6 on: March 21, 2020, 03:43:49 pm »
Try it like this (see attachment).
* weather.bas (Filesize: 8.51 KB, Downloads: 359)
« Last Edit: March 21, 2020, 03:48:03 pm by FellippeHeitor »

Offline IronMan

  • Newbie
  • Posts: 38
    • View Profile
Re: Progress Bar Info
« Reply #7 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

FellippeHeitor

  • Guest
Re: Progress Bar Info
« Reply #8 on: March 21, 2020, 06:18:46 pm »
My pleasure.