Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a thermometer to a form 1

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
1
18
GB
I have an application where I would like to show a progress bar as a horizontal thermometer. I suppose I could display an empty text box and vary its size, but I see that there is an _therm.vcx file in VFP9.

I have looked at the sample in "solutions" and can see that it works, but cannot see how to incorporate the thermometer into the form which I am designing. I have added the _therm.vcx library to my Form controls when I have the standard VFP screen displayed, but when I try to drop the icon onto my form I get the error message "Cannot add a form/toolbar class to a form/toolbar class". Is there a way round this.

Thanks. Andrew M.
 
Use the Microsoft Progress Bar ActiveX control.

Just drop it on the form, set the min and max properties, then set the Value property periodically to what value you need. The progress bar will handle everything else.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
I use a series of shapes and change their colour.

Crude but graphic - some people change the picture to show a bit of progress.

For me it depends on how long a change in progress is likely to take.

Good luck

Regards

Griff
Keep [Smile]ing
 
Andrew,

when I try to drop the icon onto my form I get the error message "Cannot add a form/toolbar class to a form/toolbar class". Is there a way round this.

You can't drop the Thermometer class (in _therm.vcx) on a form, because it is itself a form. You need to instantiate it with CREATEOBJECT() or NEWOBJECT(). Then call its Update method to actually show the progress.

Alternatively, use the ProgressBar class, which you can drop on a form.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks Craig (and indeed Griff) - that works fine. I had not previously discovered the Activex controls.
 
Just be sure, if you're going to use the ActiveX control, that you distribute the proper OCX file with your application.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Thanks Jockey2. I have run the program and it does indeed display a nice thermometer (although I couldn't get the OLE version to work)

I would like to incorporate the thermometer into a form so that I can use it on live data and display the thermometer from within my form. Is that possible and how can I do that?

Tried copying the CREATE CLASS . . code into the Init() method of my form, but that is obviously wrong ["Methods and events cannot contain nested procedures or class definitions"]

Thanks. Andrew
 
A little late maybe, but you could use this class:


It creates a real Windows common controls progressbar, full themes compliance, and works just like the NET progress bar, you can learn how to use it by reading the NET progress bar help, or the class help here:


If you have any questions, you can post in the ctl32 forums too.

And the best part, its free!

Carlos Alloatti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top