Using TGauge




Date: 10 March 1997 
Author: Brice VIDAL 
Platform: 32 bits environement 
In memory of: Carcass 


Overview

The difference between the gauge controls


The line generated looks like this: 
    CONTROL "Progress1", IDC_PROGRESS1, "msctls_progress32", 
        WS_CHILD | WS_VISIBLE | WS_BORDER, 50, 30, 80, 20  

and you have to change it to this: 
    CONTROL "Progress1", IDC_PROGRESS1, "OWL_Gauge", 
        WS_CHILD | WS_VISIBLE | WS_BORDER, 50, 30, 80, 20.  #include <owl/gauge.h> 

TGauge gauge(0, 0, 0); 

gauge.SetNativeUse(nuNever); 

Creating a gauge object

#include <owl/gauge.h> 

TGauge firstKind(0, "My Gauge value: %d", 0, 50, 90, 80, 25, true, 5); 

TGauge secondKind(0, 1, 50, 60, 80, 20); 

TGauge thirdKind(0, IDC_PROGRESS1); 

Working with your gauge

    The gauge class is able to display different gauges type. You can change the color of the gauge, the orientation, the style, the led size...   #include <owl/gauge.h> 

TGauge gauge(0, "My Gauge value: %d", 0, 50, 90, 80, 25, true, 5);

int min, max, step, value;

gauge.GetRange(min, max);

step = gauge.GetStep();

value = gauge.GetValue();
#include <owl/color.h> 
#include <owl/gauge.h> 

TGauge gauge(0, 0, 0);

gauge.SetHorizontal(false);

gauge.SetRange(0, 1000);

gauge.SetStep(100);

gauge.SetLed(20, 80);

gauge.SetColor(TColor::LtBlue);
#include <owl/gauge.h> 

TGauge gauge(0, 0, 0);

gauge.SetValue(50);

gauge.DeltaValue(-5);

gauge.StepIt();


That's all you need to know about gauges. If you want the code that has generated the above image, download the file which contains all the code here. It's just a little preview of what you can do with gauges. As an after word I just recommand to use the OWL gauge, you can do plenty of things with this one, and then call SetNativeUse() with nuNever to make sure you are using the right one. 

We are waiting for Borland to create tomorrows visual controls, meanwhile be creative!