LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Numeric Gauge

I need a control that imitates the compass. The closest I can find is the
Numeric Gauge, but the dial does not cover the full 360 degrees, as there is
a gap at the bottom. Is it possible to eliminate that? Is there another
control that can meet the needs?
0 Kudos
Message 1 of 4
(3,728 Views)
You can use the numeric gauge: you just have to edit it to cover the full 360.
1. Drop a LabStyle numeric gauge onto a panel.
2. Point to the lowest mark on the dial. You'll see the mouse cursor change to a circular arrow.
3. Grab the lowest mark with the mouse and move it down until it meets the highest mark.
It may take a few tries to get everything pointing in the right direction.
Attached is a simple compass project.
I put two gauges on top of each other to get a double pointed compass needle.
I edited the top gauge to make the dial transparent and to remove ticks and the digital display.
I made the bottom pointer red (to point to north) and the top arrow white (south).
I edited both gauges to go from 0 to 360.
I moved the 0 of the bottom gauge to
the top and left 0 of the top gauge at the bottom.
I removed the increment/decrement arrows of the bottom gauge because using the arrows caused funky updates. I used a callback and SetCtrlAttribute to update the pointers because there seems to be a bug in CVI 6.0 gauge updates when a dial is transparent using SetCtrlVal.
Message 2 of 4
(3,728 Views)
Thanks

That worked well, except for the ticks. Is it possible to adjust the ticks,
so they are evenly spaced at 30 degrees? If you notice the last two ticks
are also close together and not evenly spaced.

"Al S" wrote in message
news:506500000005000000E38C0100-1079395200000@exchange.ni.com...
> You can use the numeric gauge: you just have to edit it to cover the
> full 360.
> 1. Drop a LabStyle numeric gauge onto a panel.
> 2. Point to the lowest mark on the dial. You'll see the mouse cursor
> change to a circular arrow.
> 3. Grab the lowest mark with the mouse and move it down until it meets
> the highest mark.
> It may take a few tries to get everything pointing in the right
> direction.
> Attached is a simple compass project.
> I put two
gauges on top of each other to get a double pointed compass
> needle.
> I edited the top gauge to make the dial transparent and to remove
> ticks and the digital display.
> I made the bottom pointer red (to point to north) and the top arrow
> white (south).
> I edited both gauges to go from 0 to 360.
> I moved the 0 of the bottom gauge to the top and left 0 of the top
> gauge at the bottom.
> I removed the increment/decrement arrows of the bottom gauge because
> using the arrows caused funky updates. I used a callback and
> SetCtrlAttribute to update the pointers because there seems to be a
> bug in CVI 6.0 gauge updates when a dial is transparent using
> SetCtrlVal.
0 Kudos
Message 3 of 4
(3,728 Views)
The tick positions are automatically set by the control, depending on the range from min to max. If you want a tick every 30 degrees, you want 12 ticks from 0 to 360.
1. Instead of setting the gauge ranges from 0 to 360, edit the gauge controls to set the ranges from 0 to 12.
2. Edit the bottom gauge to hide the digital display.
3. Add a numeric control which goes from 0 to 360.
4. In the callback for the numeric control, read the value, divide it by 12, and use that to set your gauge value.
See the updated example.
0 Kudos
Message 4 of 4
(3,728 Views)