This is my first attempt to create a library Please be kind :)

This allows you to make a label with tiny indicator on left which can be turned on or off (with any choice of color)

Usage instructions:
- Download the ledlabel.jar & xml and put it in the B4X additional library folder
- Add reference to LEDLabel
- Add LEDLabel with the designer.

ledlabel.png


Example and Library are attached. Request for source if you need.
Have only checked for b4a.
Uses xui library.
Feedback welcome.
 

Attachments

  • LEDlabel_example.zip
    5.5 KB · Views: 49
  • LEDLabel_Lib.zip
    5 KB · Views: 53

mohsyn

Member
Changelog

Version 1.2

- code optimization to prevent crashes with "loadlayout" method
- method gettext added
- method "enabled" renamed to isTurnedON to avoid confusion with default item "enabled"
- example updated with adding LEDLabels to xCustomListView with random thickness, roundness and turnedon state


LEDLabel
Author:
M Mohsin
Version: 1.2
  • LEDLabel
    Fields:
    • mbase As anywheresoftware.b4a.objects.B4XViewWrapper
    • tag As Object
    • Methods:
    • IsInitialized As boolean
      Tests whether the object has been initialized.
    • gettext As String
    • gettextsize As int
    • initialize (ba As anywheresoftware.b4a.BA, Callback As Object, EventName As String) As String
    • isturnedon As boolean
    • setroundness (val As int) As String
    • settext (txt As String) As String
    • settextsize (txtsize As int) As String
    • setthickness (thik As int) As String
    • turnedon (NewValue As boolean) As String
    • Properties:
    • text As String
    • textsize As int
 

Attachments

  • LEDlabel_examplev2.zip
    6.2 KB · Views: 34
  • LEDLabelv1.2.zip
    4.9 KB · Views: 39

Magma

Well-Known Member
Licensed User
IDEA: You can make it "blinking" - setting a Timer...
 

Gabino A. de la Gala

Active Member
Licensed User
IDEA: What about to can define a click event?. Could be used like a beatifull button or swicht...
 

Gabino A. de la Gala

Active Member
Licensed User
An example of "LEDSwicht":

B4X:
Private Sub clv_ItemClick (Index As Int, Value As Object)
    Dim l As LEDLabel
    l = clv.GetPanel(Index).GetView(0).tag
    l.TurnedON(Not(l.isTurnedON))
End Sub
 

Gabino A. de la Gala

Active Member
Licensed User
Hello again.
I have already achieved the desired effect by making the LEDLabel act as a Swicht, but much more beautiful and customizable.
The only thing I have had to do is put it inside a panel and activate the click event of the panel and change the state of the LEDLabel each time that event occurs.
Anyway, I think if you could put it directly on the LEDLabel it would make it much more versatile.
Thank you for your work.

B4X:
Private Sub Panel1_Click
	LEDLabel4.TurnedON(Not(LEDLabel4.isTurnedON))
End Sub
 
Top