• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

Problem with TGauge in Status Bar

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
ianpowell
Asked:
ianpowell
  • 4
1 Solution
 
msmitsCommented:
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
 
msmitsCommented:
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
 
ianpowellAuthor Commented:
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
 
msmitsCommented:
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
 
msmitsCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now