Sub BtnXXX_Click
Dim b As Button
b = Sender
If b.Tag = "NX" Then
'Some stuff
If b.Tag = "NY" Then
'More stuff
Else
'Extra stuff
End If
End Sub
'This buton will raise the click event and could use the Tag with the sender Object
MyButton1.Tag = "1"
'This Button will dismiss the dialog and return 1 as the Response
MyButton1.Tag = "~1"
Dim Result as Int = Dialog.LoadLayout("dialog1").ShowDefault("title", "message")
If Result = 1 Then 'NX
'Some stuff
else If Result = 2 Then 'NY
'More stuff
Else
'Extra stuff
End If
Thank you for the info.The reason is that a specific event (onOrientationChanged) is not raised correctly in the genymotion emulator. In the past, the dialogview did not catch that event in order to dismiss itself.
Ivan, I think that I now understand what you mean and you are right. I will modify the code so that if the tag is not numeric, it will be ignored and the default onclick handler will be called.
Dialog.Options.Dimensions.Set(100%x, 100%y)
'Alternative use:
'Dialog.Options.Dimensions.Width = 100%x
'Dialog.Options.Dimensions.Height = 100%y
Sub Dialog1_Show
Dim Dialog As DialogView = Sender
Dim Label1 As Label = Dialog.GetView("label1")
Label1.Text = "Yo!"
End Sub
Dim Dialog As DialogView
'Load the layout into a DialogViewLayout
Dim DialogLayout As DialogViewLayout = Dialog.LoadLayout("Dialog1")
'DialogViewLayout has also a GetView method that can be used to access layout views
'Get a reference to the Label1 object in the Dialog1 layout
Dim Label1 As Label = DialogLayout.GetView("Label1")
'Set the label text
Label1.Text = "this is a text"
'Show the custom dialog
Dim Result = DialogLayout.ShowOk("", "done")
This way, you can load the layout, initialize the contents of the dialog, and then show it without the need of the show event anymore. This is now the standard way of accessing layout views.
Dim DialogLayout As DialogViewLayout = Dialog.LoadLayout("Dialog1")
Dim LayoutFile As InputStream
LayoutFile = LoadLaoutFromJar("DlgLayout")
Dim DialogLayout As DialogViewLayout = Dialog.LoadLayoutFromInput(LayoutFile)
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?