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

Discussion in 'Additional libraries, classes and official updates' started by vampirbcn, Aug 27, 2013.

Similar threads

B4A Code Snippet Animated Border
B4A Code Snippet [B4X] [XUI] Rectangle image with rounded corners
Share My Creation Google Charts
B4A Library [library] ContentResolver
B4A Library [Library] ComboBox
  1. vampirbcn

    vampirbcn Active Member Licensed User

    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:
    Code:
    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. -
     

    Attached Files:

    Last edited: Aug 8, 2014
    spairo, Isac, javilargo and 4 others like this.
  2. bluedude

    bluedude Well-Known Member Licensed User

  3. ciprian

    ciprian Active Member Licensed User

    it seems to work without the base64image library. what's using this? Am i missing something?
     
  4. vampirbcn

    vampirbcn Active Member Licensed User

    Base64image library used to generate images of the gauges. Surely you have installed the library base64image and although not activated LGauges need this.


    -. Sorry for my bad English. -
     
  5. ciprian

    ciprian Active Member Licensed User

    Thankyou for the fast answer.
    Another question. How can we set negative values for the min and max values?
     
  6. vampirbcn

    vampirbcn Active Member Licensed 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: Aug 28, 2013
  7. ciprian

    ciprian Active Member Licensed 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
     
  8. Rick in North Carolina

    Rick in North Carolina Member Licensed User

    Oh I could have used this 1 year ago.... but I look forward to trying it in the future. Nice work.
     
  9. bluedude

    bluedude Well-Known Member Licensed User

    Awesome, would be nice to add some VU meters etc.
     
  10. vampirbcn

    vampirbcn Active Member Licensed User

    Good idea bluedude, I'll try it on the next version
     
    spairo likes this.
  11. ciprian

    ciprian Active Member Licensed 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?
     
  12. vampirbcn

    vampirbcn Active Member Licensed 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. -
     
    spairo likes this.
  13. ciprian

    ciprian Active Member Licensed User

    I have sent you a mail....or new conversation. :)
     
  14. Afsal

    Afsal Member Licensed User

    hello,

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


    thanks
     
  15. Erel

    Erel Administrator Staff Member Licensed User

    You should check the logs for the error message.
     
  16. ciprian

    ciprian Active Member Licensed User

    Are you missing the base64image library ?
     
  17. Afsal

    Afsal Member Licensed 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
     
  18. Afsal

    Afsal Member Licensed 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
     
  19. Afsal

    Afsal Member Licensed User

    hello,

    I am a beginner Please replay somebody the reason of error?






    thanks
     
  20. ciprian

    ciprian Active Member Licensed User

    Without your code, nobody can help finding the error.
    Can u make a litle project to reproduce this behaviour?
     
    spairo likes this.
Loading...