B4A Library [B4X] SD CustomKeyboard

agraham

Expert
Licensed User
Longtime User
I am having a problem with my original program when upgrading to version 11.
You need to upgrade to B4A v 11.2, install a fresh SDK and then solve the problem with your code. Post the problem on the forum to get help with it. There is no point in using an old and unsupported version of B4A. Those of us who advise on the forum are all running the latest version.
 

joko0124

Member
Licensed User
Longtime User
Thank you so much for your advice. Indeed, I am stuck with the old version and yes, I'll try to recode my program using the latest version.
 

Star-Dust

Expert
Licensed User
Longtime User
Update 1.08
  • Add a character to the last row entered on the keyboard and customized keys with the possibility of establishing their size
  • Ability to customize the background with an image
  • Possibility to insert empty spaces between the keysAdd a character to the last line entered on the keyboard
  • Possibility to set the StartSelect always at the end (Fields InsertAlwaysAtEnd)

Add a character to the last row:
Ck.AddKeytoLastRow("A",65,"a",97,2)  ' 2-seater wide button
Customize background:
SD_Keyboard1.ImageBackground=xui.LoadBitmap(File.DirAssets,"1.png")
empty spaces:
Ck.AddKeytoLastRow("",0,"",0,1)
Always inserts typed characters at the end:
SD_Keyboard1.InsertAlwaysAtEnd=True
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Example n.6

 

Attachments

  • aSample6.zip
    101.8 KB · Views: 298
  • iSample6.zip
    154.3 KB · Views: 271
  • jSample6.zip
    95.4 KB · Views: 285

Star-Dust

Expert
Licensed User
Longtime User
update 1.09
  • Added AddSimpleCharToLastRow and AddRowDoubleCharToLastRow methods.
  • Added constants with the numeric code of the special keys: CodeCanc,CodeTab,CodeEnter,CodeEsc,CodeDel,CodeNext,CodeShift,CodeEraseAll
  • Ability to add custom keys that do not raise the TextChange event but the new CustomKey event
    Example: Sub TextField1_CustomKey (Code As Int)
  • Added new event to TextField or EditText view to handle custom keys that must have a negative return code and will raise the CustomKey event.

Example of custom keys

B4X:
Sub Mycode
    SD_Keyboard1.SpecialKeyFont=xui.CreateMaterialIcons(16)

    Dim Ck As CustomKey
    Ck.Initialize
    Ck.AddRowSimpleChar(Regex.Split(",","Q,W,E,R,T,Y,U,I,O,P,Shift"))
    ck.AddKeytoLastRow("REP.3",-133,"rep.3",-133,2) ' For Customize key - Negative value codes only  from -11 to -255
    SD_Keyboard1.Add(TextField1,"TextField1",Ck,null)
End SUb

Private Sub TextField1_CustomKey(Code As Int)
    Log(Code)
    if code=-133 then
        ' my code'
    End if
End Sub
 
Last edited:

Blueforcer

Well-Known Member
Licensed User
Longtime User
Is it possible to change the colors from code?
I switch colorschemes during runtime and it would be great if i can apply it to the keyboard as well.
Thanks
 

Star-Dust

Expert
Licensed User
Longtime User
At the moment it is not possible, I will try to insert it in the next versions
 

Star-Dust

Expert
Licensed User
Longtime User
Update 1.12
  • Added AddCustomKeyToLastRow method in CustomKey class to customize single key colors
  • Added Add2 method in the SD_Keyboard class to set the SHIFT key when starting the keyboard
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Update 1.13
  • Set Shift key by code
  • Fix bugs
 

Star-Dust

Expert
Licensed User
Longtime User
Update 1.14
  • Added AddEmpyKeyToLastRow method in CustomKey class
  • Added cEmptyKey method in CustomKey class
Allows you to insert blank spaces on the keyboard
B4X:
Dim ck As CustomKey
ck.Initialize
ck.AddRowSimpleChar(Regex.Split(",","7,8,9"))
ck.AddEmptySpaceToLastRow 
ck.AddCustomKeyToLastRow("F1",-15,"f1",-16,1,0xFF6495ED,0xffffffff)

' or
ck.Initialize
ck.AddRowSimpleChar(Regex.Split(",","7,,8,9")) ' Added space in the center

'or
Ck.Initialize
Ck.AddRowSimpleChar(Array As String("A","","C","D")) ' Added space in the center
ck.AddEmptySpaceToLastRow 'Added another space in the left

 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
How to add a Custom Key to the left side of a line
B4X:
Dim L As List
L.Initialize
L.Add(Ck.cKeyCustomized("REP.3",-133,"rep.3",-133,2,0xFFFF6159,xui.Color_White)) 'Custom Key
Ck.AddRow(L)
Ck.AddSimpleCharToLastRow(Regex.Split(",","Q,W,E,R,T,Y,U,I,O,P,Shift"))

How to add a custom key to the right side of a line
B4X:
Ck.AddSimpleChar(Regex.Split(",","Q,W,E,R,T,Y,U,I,O,P,Shift"))
Ck.AddCustomKeyToLastRow("REP.3",-133,"rep.3",-133,2,0xFFFF6159,xui.Color_White) 'Custom Key

How to add a Custom key in the middle of a line
B4X:
Ck.AddSimpleChar(Regex.Split(",","Q,W,E,R,T,Y"))
Ck.AddCustomKeyToLastRow("REP.3",-133,"rep.3",-133,2,0xFFFF6159,xui.Color_White) 'Custom Key
Ck.AddSimpleCharToLastRow(Regex.Split(",","U,I,O,P,Shift"))
 
Last edited:

Cesaral

Member
Congratulations and thanks for such a great library!

In the spanish keyboard (it happens the same in many languajes) there are for example vowels (a, e, i, o, u) that can have or not an accent. In the Android original keyboard, if you hold the tab action on a vowel, then an extra floating window appears where you can then select the vowel with different accents...

Can this be done with this library?
 

Star-Dust

Expert
Licensed User
Longtime User
At the moment I have not thought of this option. But I will take this into account in future updates
 

Star-Dust

Expert
Licensed User
Longtime User
Update 1.15
  • Added AddEmptyRow method in CustomKey class
How to add a Custom Key to the left side of a line (with AddEmptyRow)
B4X:
Dim L As List
L.Initialize
Ck.AddEmptyRow
Ck.AddCustomKeyToLastRow("REP.3",-133,"rep.3",-133,2,0xFFFF6159,xui.Color_White) 'Custom Key
Ck.AddSimpleCharToLastRow(Regex.Split(",","Q,W,E,R,T,Y,U,I,O,P,Shift"))
 

astronald

Active Member
Licensed User
Longtime User
Hello great project, but i cant works properly on B4xPages,
can you upload sample, please thanks.
 

Star-Dust

Expert
Licensed User
Longtime User
Salutations,

What problems do you have with B4XPage?
 

Theera

Well-Known Member
Licensed User
Longtime User
In future,Is there fractions keyboard?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…