# B4J Library[B4X] [XUI] xGauges Class

#### emexes

##### Expert
When you put them side-by-side like that, I can see now that linear gauges are just circular gauges straightened-out, ie zero curvature (or infinite radius?) That is some freaky coherence you've got going there. Next trick: the Theory of Everything

#### klaus

##### Expert
The only other thing I can think of is an optional sliding set pointer like on a thermostat.
Interesting, will also look at that.

#### klaus

##### Expert
Well, sorry, but I had to shorten the needle length from infinite to a finite value.

#### emexes

##### Expert
I had to shorten the needle length from infinite to a finite value.
Or use IEEE754 floats, that math often works eg 1 / infinity = 0.

#### Diceman

##### Active Member
Or use IEEE754 floats, that math often works eg 1 / infinity = 0.
But what is 0 * Infinity?

#### emexes

##### Expert
But what is 0 * Infinity?
Well, if 1 / infinity = 0, and we multiply both sides by infinity, then 1 = 0 * infinity = 1

Last edited:

#### Diceman

##### Active Member
Well, if 1 / infinity = 0, and we multiply both sides by infinity, then 1 = 0 * infinity = 1
Nice try, but no.

#### klaus

##### Expert
Here is version 0.9 of a new class xGaugesRect.
It is easier for users because of the new specific properties which would overcrowd the current class.
For the moment, it works only with B4J and B4A, I have problems with B4i and BitmapCreator.

B4J
B4A

I would be pleased to have some beta testers.

Attached the class module and a demo project.

#### Attachments

• 13.2 KB Views: 47
• 36.5 KB Views: 45

#### Erel

Staff member
For the moment, it works only with B4J and B4A, I have problems with B4i and BitmapCreator.
You can send me a project that demonstrates the problem and I'll try to fix it.

#### klaus

##### Expert
Hi Erel, I already had in mind to write a small project (the class has more than 1000 lines )showing the problem, try to understand what happens and submit it to you.

#### Diceman

##### Active Member
Klaus, the gauges look really good. The silver gradient makes it look real.
Suggestions: It would be nice to be able to have NeedleShadowColor & CursorShadowColor (or at least some sort of outline) so it gives some depth to these 2 important indicators. This will give the needle and cursor some relief from the background so they appear to be separate from the background as if floating above the background.

Problem. I haven't found anything wrong with your code, but the sample B4J form is acting kind of weird (release mode and debug mode). I loaded xGuagesRect.B4j into B4J v8.50 and ran it. A blank form appeared with no controls on it. No errors were reported. I ran the designer and saw the 3 xGaugesRect views. I resaved the form and reran it. Same thing; blank form appears. I went back into Designer and moved the gauges around and resaved it, thinking it would update the form. When I reran the sample app it still displayed a blank form. I solved the problem by going back into the Designer and dropping a label somewhere on the form. Recompiling it and running it showed the gauges working just fine. It appears to me that a regular view has to be on the form otherwise B4J won't display the gauges at all. I went back into Designer and deleted the Label view and when I ran the app the form was blank again. Adding the Label back on the form got the form to display the gauges again. I told you it was weird.

In B4A you have Layout.bal in the Files manager and its not needed. B4A complains when the app is loaded that Layout.bal is missing. I removed Layout.bal in the Files Manager and the app ran just fine. No problem like I had with B4J. Looks good in Android.

That's it from me, at least for now. The gauges look really professional and will save a lot of screen space.
Rect gauges are slim and trim (conserves space). If you have more than 1 round gauge they are fat and need a lot of screen space to display properly.
Once you've gone Rect, you'll never go back (to Round).

#### klaus

##### Expert
Your blank screen sounds very strange.
I develop with B4J version 8.50 like you.
Can you please check the attached version, I post only the B4J demo program.

#### Attachments

• 10.3 KB Views: 44
Last edited:

#### Diceman

##### Active Member
Your blank screen sounds very strange.
I develop with B4J version 8.50 like you.
Can you please check the attached version, I post only the B4J demo program.
Klaus,

I tried your example and the shadows do appear, but like you implied they look flat without any dimension to them.
I looked around for a solution and found JordiCP's suggestion #13 for creating shadows at this link Neumorphism UI - how would you do this

Would this work?