Panel Popup Modal


Licensed User
I am trying to develop and panel where the user would press a LABEL to trigger a pop-up panel with a 10-key keyboard display, instead of using the Number.Dialog or the Android keyboard, I would like to have this panel show up instead.

What happens now, is that the panel pops up and I can click on the number buttons and the values are populated in the panel display (lblKeyboardDisplay.Text), then press the ENTER key, and the panel disappears, but the value from the panel's label (which holds the numbers pressed), doesn't get transferred back to the initial label text.

Also, I am able to press other controls on the screen and the keyboard panel is still displayed.

Is it possible to have this panel display in a label_click event by setting it to visible = true, but then have the application wait until the Enter key tag on this keyboard is pressed, then transfer the value back to the label?

For example:

Sub lblPaxCount_Click

lblPaxCount.Text = ""
pnlKeyboard.Visible = True

lblPaxCount.Text = returnedKeyValue

End Sub

This is the SUB that is attached to the pnlKeyboard event in the designer:

Sub btnKeyboard_Click

Dim Send As Button

Send = Sender

Select Send.Tag

Case "Back"
lblKeyboardDisplay.Text = ""
Case "Enter"
returnedKeyValue = lblKeyboardDisplay.Text
pnlKeyboard.Visible = False
Case Else
lblKeyboardDisplay.Text = lblKeyboardDisplay.Text & Send.Tag
End Select

End Sub

Thanks very much!


Well-Known Member
Licensed User
Name the main panel in your layout file to PanelMain. You may have to change the code below to make it look just like you want. In the Button_Click event of your Enter button of the panels enter key, Put labeltextyouwant.text = panelslabeltext.text. You call the sub like this:

PanPop("yourlayout.bal", 0, 0)

'Put this code in your Globals sub
Dim pnlInput, pnlSelect, PanelMain As Panel

Sub PanPop (mlayout As String, hc As Int, wc As Int) '( mlayout=your .bal file, hc=height offset + or -, wc=same for width )
   pnlSelect.Initialize ( "Select")      
   pnlInput.Initialize ("")
   pnlInput.LoadLayout ( mlayout )    
   pnlSelect.Color  = Colors.ARGB (150,0,0,0)         
   Activity.AddView (pnlSelect, 0, 0,   100%x, 100%y)   
   mh1=(pnlSelect.Height/2) - (PanelMain.Height/2) + hc
   mw1=pnlSelect.Width/2 - (PanelMain.Width/2) + wc
   pnlSelect.AddView (pnlInput, mw1, mh1, mw2, mh2)
End Sub

Sub Select_Click ' Stop clicks on Select panel getting to panel underneath
           'this sub stops other clicks outside your panel from working
End Sub

To remove the view use this command:

Upvote 0


Licensed User
Thank you both for the code and the article. I'll have a look at them and let you know what I come up. Appreciate the time!
Upvote 0