Android Question ASWheelPicker & B4xDialog

Mitesh_Shah

Member
Licensed User
Longtime User
i am work on some b4a code, we used b4xpage and b4xdialog, with ASWheelPicker

B4X:
Private Sub ShowDialog(item As Map, RowId As Int)

            'xui.MsgboxAsync("Hello world!", "B4X")
            Dim v As B4XView = xui.CreatePanel("")
            v.SetLayoutAnimated(0,0,0,90%x,600dip)        '//'set the dialog-content size
            v.LoadLayout("dialog_layout")
            dialog.Title="SET Mode"
            dialog.BorderWidth = 0
            dialog.BorderCornersRadius=10
      
            dialog.TitleBarColor = xui.Color_ARGB(255, 140, 140, 140)
            dialog.ButtonsColor = xui.Color_ARGB(255, 140, 140, 140)
            dialog.ButtonsTextColor = xui.Color_ARGB(255, 255, 255, 255)
            dialog.BackgroundColor = xui.Color_ARGB(255, 255, 255, 230)    

'//--------------------------------------------------------------------------------------
    '---->>> When add this code line, the dialog_layout not load 
   Private selectedPanelIndex As Int                                                                        '<<-------
   Private senderButton As Button = Sender                                                           '<<-------
   Private parentPanel As B4XView = senderButton.Parent ' Get the parent panel '<<-------
   selectedPanelIndex = senderButton.Tag                                                              '<<-------
   Log(selectedPanelIndex)                                                                                      '<<-------
'--------------------------------- End -----------------------------------------------------'

    'dialog.ShowCustom(v,"Ok","","Cansel")
    Dim obj As Object = dialog.ShowCustom(v,"Ok","","Cansel")
 
    wait For(obj) complete (result As Int)
 
    If result = xui.DialogResponse_Positive Then
       Log("Closed Dialog")
    End If

End Sub

here i attached screen shot

if we remove ASwheelpicker from design layout, our code is working
or
if remove this code line >>

Private selectedPanelIndex As Int '<<-------
Private senderButton As Button = Sender '<<-------
Private parentPanel As B4XView = senderButton.Parent ' Get the parent panel '<<-------
selectedPanelIndex = senderButton.Tag '<<-------
Log(selectedPanelIndex) '<<-------

its b4xdialog work with ASwheelpicker
 

Attachments

  • AS Wheelpicker_error.jpg
    345.8 KB · Views: 106
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
its b4xdialog work with ASwheelpicker
I see no reason why my AS_WheelPicker would not be compatible with the B4XDialog. Unfortunately I can't help you either, I need an example project that shows the error in order to be able to evaluate where the error occurs.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
To complete:
There is no problem with my AS_WheelPicker and the B4XDialog.

The error is in the following code line:
Private senderButton As Button = Sender
An attempt is made to read out the sender outside of an event. This is not possible as the sender can only be read in an event.

I recommend passing the button as a parameter and assigning the sender when calling the sub.
B4X:
Private Sub ShowDialog(senderButton As Button,item As Map, RowId As Int)

B4X:
Private Sub set_button_Click
    ShowDialog(Sender,CreateMap(), 0) 
End Sub

Alex
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…