Solved

Problem with TGauge in Status Bar

Posted on 1997-08-19
5
325 Views
Last Modified: 2013-12-26
I am using QWL in Borland BCC 5.01

I have tried to put a Gauge in my status bar using TControlGadget. The gauge works OK and the message text and the gauge are the correct size when the program starts. However when the window has been resized several time the bottom half of the status bar’s message and hints are outside the window an cut off. Also the gauge height has grown to the full size of the bar.

At the moment I have put this same gauge in the Tool Bar where it works OK.

Does know what the problem is and how I can fix it?
0
Comment
Question by:ianpowell
  • 4
5 Comments
 
LVL 3

Expert Comment

by:msmits
ID: 1299359
I am using 5.02 and can't reproduce your problem, although using the Gauge in the statusbar doesn't look good because of the border of the Gauge that you can't get rid of.

Maybe you can post the code you are using to add the Gauge to the statusbar and tell us for which platform (win31, win95 or winNT) you are working.

To get rid of the border you have to derive your own class from the TGauge and rewrite the Paint method.

0
 
LVL 3

Expert Comment

by:msmits
ID: 1299360
Another problem that I saw later was that the Gauge is still visible when the StatusBar goes into hint display mode. I believe the only correct solution will be to write a TGaugeGagdet that is derived from TGagdet and implements about the same functionality as the gadget, although I don't see any use for vertical gauges in a statusbar.

0
 

Author Comment

by:ianpowell
ID: 1299361
I am using Windows 95

I also tried a TEdit control in TControlGadget as a test which had similar but not so server problems.

I think you are right that it needs a TGagetGauge written. Someone has sent me some code, which has a flicker problem. but which I have yet to try.

msmits<<Another problem that I saw later was that the Gauge is still visible when the StatusBar goes into hint display mode.>> I don’t recall having this problem perhaps the something was changed for 5.02.

I don’t have my original code as it got destroyed when I move the Gauge to the tool bar. But I do remember that I had a lot of problems with address violation when thing were done in the wrong order.


0
 
LVL 3

Expert Comment

by:msmits
ID: 1299362
I checked the code of TGauge between 5.01 and 5.02 and except for the copyright and version number nothing has changed. I don't know about the TControlGadget and TStatusBar, but expect nothing significant has changed. I will check it this weekend.

It doesn't seem like a big problem to copy/paste some code from the gauge.cpp file for a TGaugeGadget class. I can give it a try this evening and put up the code on my ftp-site. I will add another comment when it is done.

0
 
LVL 3

Accepted Solution

by:
msmits earned 100 total points
ID: 1299363
My testing code was (in InitMainWindow()):

  myProgress = new TProgress(NULL, "%d%%", 0, 0, 0,
                             100, 15, true, 0);
  myProgress->SetNativeUse(nuNever);
  myProgress->SetRange(0, 100);
  myProgress->SetValue(0);
  TControlGadget *myControlGadget =
      new TControlGadget(*myProgress, TGadget::Recessed);
  sb->Insert(*myControlGadget);

where myProgress is of the type TGauge* and a class member of the application class.

I have now written a TGaugeGadget class with the same interface as the TGauge class, except for the obvious ommision of SetNativeUse(), SetupWindow(), EvEraseBkgnd(), GetClassname(), PaintBorder() and the data member ClassNativeUse.
The implementation can be downloaded from:

  ftp://ftp.iaehv.nl/pub/users/msmits/exp-exch/gaugegad.zip

An example of the use (equivalent with the above) is:

  myProgress = new TGaugeGadget(0, "%d%%", 100, 15,
                                true, 1, TGadget::Recessed);
//  myProgress->SetLed(10, 90);
  myProgress->SetRange(0, 100);
  myProgress->SetValue(0);
  sb->Insert(*myProgress);

It also supports vertical stuff and the led style gauges. It however will not use the native control.

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now