B4A Library LGauges - Gauges generation [Library] [Open Source Code]

NEW: Liberation of LGauges source code in the post #35


The purpose of the library LGauges, is simply to show gauges for measurement.

Attention: you need to load the library Base64Image, to use LGauges

LGauges
Author:
Vampirbcn
Version: 2.0

LGauges
Methods:
Initialize (thepanel As Panel, x As Int, y As Int)
-Initialize the object
SelectGauge(model as int)
-Select gauge dessign
SetTBorder(Thickness As Int)
-Set the gauge border width
SetSize(Thesize As Int)
-Set the gauge size
ActivateBorderAutoColor(activate as boolean)
-Enable or disable the automatic generation of color on the border
SetBorderColor(Thecolor As Int)
-Set the fixed border color
SetHandColor(Thecolor As Int)
-Set the hand color
SetValuesColor(Thecolor As Int)
-Set the color of values of gauge
SetFirstValue(value As Int)
-Set the first number of the displayed values
SetLastValue(value As Int)
-Set the last number of the displayed values
ChangeValue(value As Int)
-Change the value represented by the hand

Image examples:

imagen1.jpg imagen2.jpg imagen3.jpg

Example code:
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim thegauge As LGauges

    Dim Panel1 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Main")
    thegauge.Initialize(Panel1,40,40)
    thegauge.SelectGauge(1)
End Sub



-. Sorry for my bad English. -
 

Attachments

  • LGauges.zip
    111.8 KB · Views: 1,233
  • GaugesExample.zip
    294.4 KB · Views: 1,162
Last edited:

vampirbcn

Active Member
Licensed User
Longtime User
Example for display a negative initial value
SetFirstValue(-50)
SetLastValue(150)


in this case:
ChangeValue(0) is the equivalent to show -50
ChangeValue(100) is the equivalent to show 150


--------------------
Example display negative values in the gauge:

SetFirstValue(-50)
SetLastValue(-500)


in this case:
ChangeValue(0) is the equivalent to show -50
ChangeValue(100) is the equivalent to show -500

 
Last edited:

ciprian

Active Member
Licensed User
Longtime User
Thankyou. I have tried into the exemple to set the min value with the seekbar. Thats why i asked this. Now it's clear. Thankyou. Great lib
 

ciprian

Active Member
Licensed User
Longtime User
Hi there. I'm having a problem with the image of the gauge.
I have changed the color of the panel1 to black.
When i look at the image of gauge, it's having some white points round the border.
Where can i find the images to try to adjust the white points?
 

vampirbcn

Active Member
Licensed User
Longtime User
Hi Ciprian,

Unable to access images, are included and compressed in the jar file.

If you use a black background and white dots out, you can draw a black circle around the gauge, covering the edge. Not the best solution, but these white points disappear.

If you want the images to try to adjust the points or enhance the resolution, just give me your email.




-. Sorry for my bad English. -
 

Afsal

Member
Licensed User
Longtime User
hello,

I can't run the application its just stop unexpectedly
I am using the b4a version is 2.52


thanks
 

Afsal

Member
Licensed User
Longtime User
the message is like this

Sorry!
the application B4A example (process b4a. example) has stopped unexpectedly. please try again



I already insert base64image library in library folder and make it tick in reference library



thanks

Afsal
 

Afsal

Member
Licensed User
Longtime User
main_globals (java line: 324)
java.lang.NoClassDefFoundError: logic.LGauges.lgauges
at b4a.example.main._globals(main.java:324)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at b4a.example.main.initializeGlobals(main.java:226)
at b4a.example.main.afterFirstLayout(main.java:86)
at b4a.example.main.access$100(main.java:16)
at b4a.example.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3770)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
at dalvik.system.NativeStart.main(Native Method)

this is the error I am getting in the log window.



Regards

Afsal
 
Top