B4i Library [Class] PreferenceMenu

Filippo

Expert
Licensed User
Hi,

today I want to share my classe PreferenceMenu with you.

The class is dependent on(B4i-CustomViews):
1. PreferenceManager
2. Customdialog
3. RadioButton
 

Attachments

Last edited:

Filippo

Expert
Licensed User
Hi,

I've uploaded a new version.

Changes:
  1. The CheckBox replaced with Switch
  2. bug Fixes
 

salvadoro

Member
Licensed User
Hi, Filippo

With the version b4i v2.0 is ok.

Now I use this but get errors with the new b4i v2.3:

Error: ** BUILD FAILED **


The following build commands failed:
CompileC build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/b4i_clspmedittext.o B4iProject/b4i_clspmedittext.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
 

Filippo

Expert
Licensed User
I'm sorry but I have not tried it yet with with v2.3. :(
 

schimanski

Well-Known Member
Licensed User
Hello Filippo!!

I'm using your great PreferenceMenu, thanks for that. But now I have seen, that EditText cut's every "0", when the input begins with a zero:

For example: 0201 = 201

So it is not possible to save a telephonenumber etc.
 

Filippo

Expert
Licensed User
Hi schimanski,

have you tried using the variable "InputType" ?

Edittext.PNG


If that does not work, then you can add your change in the class "clsPMEditText".

B4X:
' InputType:
' 0 = TYPE_DEFAULT
' 1 = TYPE_ASCII_CAPABLE
' 2 = TYPE_NUMBERS_AND_PUNCTUATIONS
' 3 = TYPE_URL
' 4 = TYPE_NUMBER_PAD
' 5 = TYPE_PHONE_PAD
' 6 = TYPE_NAME_PHONE_PAD
' 7 = TYPE_EMAIL_ADDRESS
' 8 = TYPE_DECIMAL_PAD
'10 = TYPE_WEB_SEARCH
Private Sub cd_click(Buttontext As String)
    If Buttontext = "OK" Then
        Select InputType1
            Case 2,4
                If IsNumber(txtEdit.Text) And Not(txtEdit.Text.Contains(".")) Then
                    lblValue.Text = txtEdit.Text.Trim
                Else
                    hd.ToastMessageShow("Wrong input!", True)
                End If   
            Case 8
                'Komma mit Punkt austauschen
                If txtEdit.Text.Contains(",") Then txtEdit.Text = txtEdit.Text.Replace(",",".")
                If IsNumber(txtEdit.Text) Then
                    lblValue.Text = txtEdit.Text.Trim
                Else
                    hd.ToastMessageShow("Wrong input!", True)
                End If
            Case Else
                lblValue.Text = txtEdit.Text.Trim
        End Select
        'lblValue.Text = txtEdit.Text
        Main.Manager.SetString(strKey, lblValue.Text)
        mPMAllg.DipendencyKeyChanged(strKey)
    End If
End Sub
 

schimanski

Well-Known Member
Licensed User
Thanks for help, but I have tried it and it is always the same. Seems to be a problem when writing in sql??? The zero is deleted in every inputtype, also when using the password-field.
 

Filippo

Expert
Licensed User
Thanks for help, but I have tried it and it is always the same. Seems to be a problem when writing in sql??? The zero is deleted in every inputtype, also when using the password-field.
The classe "PreferenceMenu" has nothing to do with SQL, you mean perhaps the classe "PreferenceManager", right?
 
Top