1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Bug? Bug? Or Strange Attractors?

Discussion in 'Bugs & wishlist' started by William Lancee, May 20, 2019.

  1. William Lancee

    William Lancee Member Licensed User

    As is common in this forum, bugs are often caused by lack of full understanding of the underlying processes. This may be one of those. Nevertheless, I found it interesting and challenging to solve.

    In my app, an editText appears to magically change shape, based on a strange attraction to the activity of another editText.

    Press "Return" on soft keyboard to advance to next part.
     

    Attached Files:

    Last edited: May 21, 2019
  2. DonManfred

    DonManfred Expert Licensed User

    My first thought when seeing your code: You should never reuse the same drawable with multiple/different views. Add a third Option to the thread title: "Coding error/mistake".

    untested:
    Code:
    Sub CreateCD() As ColorDrawable
        
    Dim cd As ColorDrawable
        cd.Initialize2(
    Colors.RGB(240240 ,255), 3dip1dipColors.Black)
        
    Return cd
    End Sub
    Sub Activity_Create(FirstTime As Boolean)
        
    Activity.Color = Colors.RGB(245,245,245)


        editBox.Initialize(
    "editBox")
        editBox.TextSize = 
    20
        editBox.TextColor = 
    Colors.Black
        editBox.Gravity = 
    Gravity.TOP
        editBox.Visible = 
    False
        editBox.Background = CreateCD
        editBox.InputType = 
    Bit.Or(editBox.InputType, 524288)        'to remove autosuggest
        Activity.addView(editBox, 10%x33%y80%x25%y)
     
        inputBox.Initialize(
    "inputBox")
        inputBox.TextSize = 
    20
        inputBox.TextColor = 
    Colors.Black
        inputBox.Visible = 
    False
        inputBox.Background = CreateCD
        inputBox.InputType = 
    Bit.Or(inputBox.InputType, 524288)        'to remove autosuggest
        Activity.addView(inputBox, 50%x10%y20%x5%y)

        
    Dim alphnum As String = "abcdefghijklmnopqrstuvwxyz"
        alphnum = alphnum & alphnum.toUppercase & 
    "0123456789,_"
        kbInput.Initialize(
    "kbInput")
        kbInput.SetCustomFilter(inputBox, inputBox.INPUT_TYPE_TEXT, alphnum)
        kbInput.AddHandleActionEvent(inputBox)

        kbEdit.Initialize(
    "kbEdit")
        kbEdit.SetCustomFilter(editBox, editBox.INPUT_TYPE_TEXT, alphnum)
        kbEdit.AddHandleActionEvent(editBox)

        CallSubDelayed(Me, 
    "showProblem")         'callSubDelayed to let the kb handlers get ready
    End Sub
     
    Last edited: May 21, 2019
  3. William Lancee

    William Lancee Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice