iOS Question Button Event not triggered

iCAB

Well-Known Member
Licensed User
Longtime User
I am having an issue with button click event not being triggered as expected in B4I (works ok with B4A )

1. I have a class that displays a custom numeric keypad popup
2. the keypad is drawn in code, by calling a Sub that resides in another code module (not in the same class)
3. Events are not triggered

I narrowed down the issue to the sample code below

B4X:
    Dim PopupPanel1 As Panel


    PopupPanel1.Initialize("NumericKeypad")
    PopupPanel1.Tag = "NumericKeypad"
    PopupPanel1.Color = Colors.ARGB(200,58,58,58 )
    ParentPanel.AddView(PopupPanel1, 0,0,100%x, 100%y)


    'LayoutSupport.LAY_TESTButton(PopupPanel1)

'This code when called from within the class, the events are triggered no problem
'if this code is placed in another code module and called as in LayoutSupport.LAY_TESTButton(PopupPanel1), no events are triggered 
    Dim btnTestKey As Button

    btnTestKey.InitializeCustom("btnKeypad", Colors.Blue, Colors.Red)
    btnTestKey.Text = "Test"
    btnTestKey.CustomLabel.TextAlignment =  LayoutSupport.LAY_ConvertToB4IJustify(btnTestKey.CustomLabel.ALIGNMENT_CENTER, "Label")
    btnTestKey.CustomLabel.Font = Font.CreateNew(20)
    btnTestKey.Tag = "btnKeypad:1"
    btnTestKey.CustomLabel.Font = Font.DEFAULT_BOLD
    LayoutSupport.SetBackgroundImage(btnTestKey, LayoutNonGUI.LAY_LoadBitMap("btn_green_blank.png", 10%x, 10%y), 0 )               
    LayoutSupport.SetBackgroundImage(btnTestKey, LayoutNonGUI.LAY_LoadBitMap("btn_green_blank.png", 10%x, 10%y), 1 )               
    LayoutSupport.SetBackgroundImage(btnTestKey, LayoutNonGUI.LAY_LoadBitMap("btn_green_blank.png", 10%x, 10%y), 2 )               
    btnTestKey.Enabled = True
    PopupPanel1.AddView( btnTestKey, 30%x, 30%y, 10%x, 10%y)


Please comment
 
Top