Added roPinEntryDialog
David Blume

David Blume commited on 2015-11-09 16:33:01
Showing 1 changed files, with 36 additions and 0 deletions.

... ...
@@ -30,6 +30,7 @@ Sub Main()
30 30
           msg = wait(0, port) 
31 31
           If type(msg) = "roUniversalControlEvent" Then
32 32
                button = msg.GetInt()
33
+               print "button is "; button
33 34
 
34 35
                If ((button = 5) Or (button = 6)) and m.index < m.slideCount - 1 Then
35 36
                     print "Show Next Slide"
... ...
@@ -39,6 +40,8 @@ Sub Main()
39 40
                     print "Show Previous Slide"
40 41
                     m.index = m.index - 1
41 42
                     ChangeSlide()
43
+               Else If (button = 10) Then
44
+                    DisplayDialog()
42 45
                End If
43 46
           End If
44 47
 
... ...
@@ -47,6 +50,39 @@ Sub Main()
47 50
 End Sub
48 51
 
49 52
 
53
+Function DisplayDialog()
54
+     dialog = CreateObject("roPinEntryDialog")
55
+     dialog.SetMessagePort(CreateObject("roMessagePort"))
56
+     dialog.EnableOverlay(true)
57
+     dialog.EnableBackButton(true)
58
+     dialog.SetNumPinEntryFields(4)
59
+     dialog.SetTitle("Enter your Roku PIN to begin your free trial.")
60
+     dialog.AddButton(1, "Continue")
61
+     dialog.AddButton(99, "Back")
62
+     dialog.Show()
63
+     While True
64
+          msg = wait(0, dialog.GetMessagePort())
65
+          If msg <> invalid
66
+               print "msg is "; msg
67
+               if msg.isScreenClosed()
68
+                    print "msg is isScreenClosed"; msg
69
+                    exit while
70
+               Else If msg.isButtonPressed()
71
+                    print "the index of the button pressed is"; msg.GetIndex()
72
+                    If msg.GetIndex() = 1 Then
73
+                         print "The user entereded PIN "; dialog.Pin()
74
+                    Else If msg.GetIndex() = 99 Then
75
+                         print "The user cancelled."
76
+                    Endif
77
+                    exit while
78
+               End If
79
+          End If
80
+     End While
81
+     print "Just before dialog.Close"
82
+     dialog.Close()
83
+End Function
84
+
85
+
50 86
 Function ChangeSlide()
51 87
 
52 88
      If m.index < 0 Then
53 89