B4A Library [B4X] SD CustomKeyboard (new version)

The CustomKeyboard library has made a leap in quality to be able to replace the native Android/iOs keyboard and also for the Desktop version.
Further developments are planned such as the possibility of adding editable fields from Design which are managed by this keyboard.

This required a more radical change, which is why I preferred to abandon the old thread and create a new thread where to insert this updated version, with new examples, avoiding creating confusion between the methods and suggestions given. The old version will remain but will no longer be supported


IMPORTANT
  • depends on SD CreativeBackGround (0.06+) library which must be downloaded
  • MaterialIcon font for special characters must be loaded. Use: SD_Keyboard1.SpecialKeyFont = xui.CreateMaterialIcons (16)


SD_CustomKeyboard

Author:
Star-Dust
Version: 2.00
  • CustomKey
    • Fields:
      • CodeCanc As Int
      • CodeDel As Int
      • CodeEnter As Int
      • CodeEraseAll As Int
      • CodeEsc As Int
      • CodeNext As Int
      • CodeShift As Int
      • CodeTab As Int
    • Functions:
      • AddCustomKeyToLastRow (UpperText As String, UpperCode As Int, LowerText As String, LowerCode As Int, size As Int, BackgroundKeyColor As Int, TextKeyColor As Int) As String
        Customize Key with color
        <code>Ck.AddCustomKeyToLastRow("SPACE",32,"SPACE.",32,3,xui.Color_Red,xui.Color_White) ' space large 3 key</code>
        <code>Ck.AddCustomKeyToLastRow("Enter",ck.CodeEnter,"Enter",ck.CodeEnter,1, ,xui.Color_Green,xui.Color_White))</code>
      • AddCustomKeyToLastRow2 (UpperText As String, UpperCode As Int, LowerText As String, LowerCode As Int, AlternateKeyUpper As Map, AlternateKeyLower As Map, size As Int, BackgroundKeyColor As Int, TextKeyColor As Int) As String
        Customize Key with color and alternative key
        <code>ck. AddCustomKeyToLastRow2("E",69,"e",101,CreateMap("È":200,"É":201),CreateMap("è":232,"é":233),1,,xui.Color_Red,xui.Color_White)</code>
      • AddEmptyRow As String
        Can add key with Add...LastRow
      • AddEmptySpaceToLastRow As String
      • AddKeyToLastRow (UpperText As String, UpperCode As Int, LowerText As String, LowerCode As Int, size As Int) As String
        Ck.AddKeytoLastRow("SPACE",32,"SPACE.",32,3) ' space large 3 key
        Ck.AddKeytoLastRow("",0,"",0,1) ' Empty
        Ck.AddKeytoLastRow("Enter",ck.CodeEnter,"Enter",ck.CodeEnter,1)
      • AddKeyToLastRow2 (UpperText As String, UpperCode As Int, LowerText As String, LowerCode As Int, AlternateKeyUpper As Map, AlternateKeyLower As Map, size As Int) As String
        To insert alternative key
        <code>Ck.AddKeyToLastRow2("E",69,"e",101,CreateMap("È":200,"É":201),CreateMap("è":232,"é":233),1)</code>
      • AddRow (Keys As List) As String
        CustomKey.AddRow(ListOfSingleKey)
      • AddSimpleCharToLastRow (Keys As String()) As String
        Char or key: Shift, Canc, Del, Tab, Esc, Next, EraseAll
        <code>CustomKey.AddSimpleCharToLastRow(array as string("A","B","C","Next","Tab","Canc"))</code>
        <code>CustomKey.AddSimpleCharToLastRow(Regex.Split(",","A,B,C,0,1,2,Enter"))</code>
      • AddSimpleCharToNewRow (Keys As String()) As String
        Special Char or key: Shift, Canc, Del, Tab, Esc, Next, EraseAll
        <code>CustomKey.AddRowSimpleChar(array as string("A","B","C","Next","Tab","Canc"))</code>
        <code>CustomKey.AddRowSimpleChar(Regex.Split(",","A,B,C,0,1,2,Enter"))</code>
      • AddStringtoKeyToNewRow (Strings As String()) As String
        Don't insert special char: Shift, Canc, Del, Tab, Esc, Next
        <code> CustomKey.AddStringtoKeyToNewRow(array as string("00","000","Hallo"))</code>
        <code> CustomKey.AddStringtoKeyToNewRow(Regex.Split(",","00,000,Hallo"))</code>
      • AddUpperLowerCharToLastRow (Keys As String()) As String
        Char or key: Shift, Canc, Del, Tab, Esc, Next,EraseAll
        CustomKey.AddUpperLowerCharToLastRow(array as string("Aa","Bb","Cc","Next","Tab","Canc"))
        CustomKey.AddUpperLowerCharToLastRow(Regex.Split(",","Aa,Bb,Cc,00,11,12,Enter"))
      • AddUpperLowerCharToNewRow (Keys As String()) As String
        Char or key: Shift, Canc, Del, Tab, Esc, Next,EraseAll
        <code>CustomKey.AddUpperLowerCharToNewRow(array as string("Aa","Bb","Cc","Next","Tab","Canc"))</code>
        <code>CustomKey.AddUpperLowerCharToNewRow(Regex.Split(",","Aa,Bb,Cc,00,11,12,Enter"))</code>
      • cEmptyKey As Type_SingleKey
      • cKey (UpperText As String, UpperCode As Int, LowerText As String, LowerCode As Int, AlternateUp As Map, AlternateLo As Map) As Type_SingleKey
      • cKeyCustomized (UpperText As String, UpperCode As Int, LowerText As String, LowerCode As Int, size As Int, BackgroundKeyColor As Int, TextKeyColor As Int, AlternateUp As Map, AlternateLo As Map) As Type_SingleKey
      • cKeySized (UpperText As String, UpperCode As Int, LowerText As String, LowerCode As Int, size As Int, AlternateUp As Map, AlternateLo As Map) As Type_SingleKey
      • Class_Globals As String
      • Initialize As String
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • KeyBoard As List
  • SD_Keyboard
    • Fields:
      • InsertAlwaysAtEnd As Boolean
      • keyCanc As String
      • keyDel As String
      • keyEnter As String
      • keyEraseAll As String
      • keyNext As String
      • keyShiftDown As String
      • keyShiftLock As String
      • keyShiftUp As String
      • keyTab As String
      • Tag As Object
      • TimeLapseMilliSec As Int
    • Functions:
      • Class_Globals As String
      • ClearKeyboard As String
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • DrawKeyboard (V As B4XView) As String
      • GetBase As B4XView
      • Initialize (Callback As Object, EventName As String) As String
      • Invalidate As String
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • SetEvent (View As EditText, te As TypeED) As String
      • SetKeyboard (TextEditorView As B4XView, NativeEventName As String, CustomizeKeyboard As CustomKey, ShiftOn As Boolean, NextFocus As B4XView) As String
      • SetupColor (BackgroundColorKey As Int, TextColorKey As Int, BackgroundColorBoard As Int) As String
      • ShifOn (S As Boolean) As String
      • ShiftStatus As Boolean
      • Snapshot As B4XBitmap
    • Properties:
      • DarkFactor As Float
        To set the intensity of the dark part of the shadow - normally = 0.85
      • Font
        Set Key Font
      • Height As Int
      • ImageBackground
      • KeyStyle
        0-Standard; 1-Comics; 2-Heart; 3-Flower; 4-Octagon
      • Left As Int
      • LightFactor As Float
        To set the intensity of the light part of the shadow - normally = 1.15
      • ShowKeyboard As Boolean
      • SpecialKeyFont
        Set Font of SpecilKey - Standard: MaterialIcon
      • Top As Int
      • Visible As Boolean
      • Width As Int
 

Attachments

  • SD_CustomKeyboard 2.00.zip
    31.4 KB · Views: 49
  • jSD_CustomKeyboard 2.00.zip
    27.8 KB · Views: 42
  • iSD_CustomKeyboard 2.00.zip
    331.1 KB · Views: 38
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
log release
  • 2.00
    • Method Add and Add2 changed to SetKeyboard
    • Method AddRowSimpleChar changed to AddSimpleCharToNewRow
    • Method AddRowDoubleChar changed to AddUpperLowerCharToNewRow
    • Method AddRowDoubleCharToLastRow changed to AddUpperLowerCharToLastRow
    • Method AddRowStringtoKey changed to AddStringtoKeyToNewRow
    • Added AddKeyToLastRow2 - Customize With Alternative
    • Added AddCustomKeyToLastRow2 - Key With Alternative
 

Star-Dust

Expert
Licensed User
Longtime User
SAMPLE 1 (B4XPAGE)
Simple numeric keyboard with special keys
1711473822018.png


SAMPLE 2 (B4XPAGE)
Classic keyboard
1711475122253.png
1711475181454.png


SAMPLE 3 (B4XPAGE)
Custom keyboard
1711475649957.png
1711478023367.png



SAMPLE 4 (B4XPAGE)
font bengali
1711478064277.png
1711476901395.png
 

Attachments

  • Sample1.zip
    15.7 KB · Views: 36
  • Sample2.zip
    15.4 KB · Views: 36
  • Sample3.zip
    15.7 KB · Views: 37
  • Sample4.zip
    205.8 KB · Views: 34
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
SAMPLE 5 (B4XPAGE)
Keyboard docked at the top left
1711478455062.png



SAMPLE 6 (B4XPAGE)
Personalized background with image
1711479917612.png


SAMPLE 7 (B4XPAGE)
SHIFT key used to change the entire keyboard
1711480595307.png
1711480659044.png



SAMPLE 8 (B4XPAGE)
Complete Keyboard
1711487613021.png
1711487651052.png
 

Attachments

  • Sample5.zip
    15.2 KB · Views: 42
  • Sample6.zip
    294.2 KB · Views: 36
  • Sample7.zip
    15.5 KB · Views: 32
  • Sample8.zip
    15.6 KB · Views: 43
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
RESERVED
 

Star-Dust

Expert
Licensed User
Longtime User
RESERVED
 
Top