Author: miguel
Date: 2006-11-27 20:16:43 -0500 (Mon, 27 Nov 2006)
New Revision: 68548

Modified:
   
trunk/mono-basic/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog
   
trunk/mono-basic/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.vb
Log:
2006-11-27  Miguel de Icaza  <[EMAIL PROTECTED]>

        * Interaction.vb: Implement InputBox



Modified: 
trunk/mono-basic/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog
===================================================================
--- 
trunk/mono-basic/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog
    2006-11-28 01:00:08 UTC (rev 68547)
+++ 
trunk/mono-basic/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog
    2006-11-28 01:16:43 UTC (rev 68548)
@@ -1,3 +1,7 @@
+2006-11-27  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * Interaction.vb: Implement InputBox
+
 2006-10-22 Guy Cohen <[EMAIL PROTECTED]>
        * Fix Get/Set Settings, to use HKCU\Software\VB and VBA Program Settings
        * Fix Partition bug to better work with spaces

Modified: 
trunk/mono-basic/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.vb
===================================================================
--- 
trunk/mono-basic/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.vb
       2006-11-28 01:00:08 UTC (rev 68547)
+++ 
trunk/mono-basic/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.vb
       2006-11-28 01:16:43 UTC (rev 68548)
@@ -34,6 +34,7 @@
 #If TARGET_JVM = False Then 'Win32,Windows.Forms Not Supported by Grasshopper
 Imports Microsoft.Win32
 Imports System.Windows.Forms
+Imports System.Drawing
 #End If
 
 Namespace Microsoft.VisualBasic
@@ -171,10 +172,65 @@
                 Return FalsePart
             End If
         End Function
+
+        Class InputForm
+            Inherits Form
+            Dim bok As Button
+            Dim bcancel As Button
+            Dim entry As TextBox
+            Dim result As String
+
+            Public Sub New(ByVal Prompt As String, Optional ByVal Title As 
String = "", Optional ByVal DefaultResponse As String = "", Optional ByVal XPos 
As Integer = -1, Optional ByVal YPos As Integer = -1)
+                SuspendLayout()
+
+                Text = Title
+                ClientSize = New Size(400, 120)
+
+                bok = New Button()
+                bok.Text = "Ok"
+
+                bcancel = New Button()
+                bcancel.Text = "Cancel"
+
+                entry = New TextBox()
+                entry.Text = DefaultResponse
+                result = DefaultResponse
+
+                AddHandler bok.Click, AddressOf ok_Click
+                AddHandler bcancel.Click, AddressOf cancel_Click
+
+                bok.Location = New Point(ClientSize.Width - 
bok.ClientSize.Width - 8, 8)
+                bcancel.Location = New Point(bok.Location.X, 8 + 
bok.ClientSize.Height + 8)
+                entry.Location = New Point(8, 80)
+                entry.ClientSize = New Size(ClientSize.Width - 28, 
entry.ClientSize.Height)
+
+                Controls.Add(bok)
+                Controls.Add(bcancel)
+                Controls.Add(entry)
+
+                ResumeLayout(False)
+            End Sub
+
+            Public Function Run() As String
+                Application.Run(Me)
+                Return result
+            End Function
+
+            Private Sub ok_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs)
+                result = entry.Text
+                Close()
+            End Sub
+
+            Private Sub cancel_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs)
+                Close()
+            End Sub
+        End Class
+
         Public Function InputBox(ByVal Prompt As String, Optional ByVal Title 
As String = "", Optional ByVal DefaultResponse As String = "", Optional ByVal 
XPos As Integer = -1, Optional ByVal YPos As Integer = -1) As String
 #If TARGET_JVM = False Then
-            Throw New NotImplementedException
-
+            Dim f As InputForm
+            f = New InputForm(Prompt, Title, DefaultResponse, XPos, YPos)
+            Return f.Run()
 #Else
             Throw New NotImplementedException
 #End If

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to