newbee question: how to use number diaglog?

wheretheidivides

Active Member
Licensed User
Longtime User
Here's my code so far. I want the user to select a button, then a number box appear and then show the result in a label. However, I can not figure out of to get the number that was entered. The instructions don't give examples. Anyone? I know I'm close. I can figure out the -1 and -3, but not what was entered.
http://www.b4x.com/android/help/dialogs.html#numberdialog

================
UPDATE
I figured this out but is there a way that this code could be included in the file dialog instructions? or something like it. It's too hard to figure stuff out without exmples in code.

B4X:
Sub Buttontest_click
'--------------------------------------------------
   Dim ret As Int
   Dim testnum As Double
   
   Nd.Decimal = 2 'number of decimal places to be shown on popup
   Nd.Digits = 6 'number of digits including decimals to be shown on popup.  
   Nd.Number = 0 'starting number to be shown on popup
   
   ret = Nd.Show("Modify Amount to?", "Modify", "Cancel", "", Bmp)
   
   '-------------------------------------------------------
   'do something after user selects on file dialog menu
   testnum = Nd.Number/100 'divide by 100 as there are 2 decimal places
   
   Select ret
      Case -1
         Msgbox("Field was modified.","")
         Labeltest.text = "$" & testnum
      
      Case -3
         Msgbox("Canceled.  Field was NOT modified.","")
         Labeltest.text = "$" & testnum
   End Select

'-------------------------------------------------
End Sub
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…