Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,80 +0,0 @@
|
|||
with Gtk.Button; use Gtk.Button;
|
||||
with Gtk.GEntry; use Gtk.GEntry;
|
||||
with Gtk.Label; use Gtk.Label;
|
||||
with Gtk.Window; use Gtk.Window;
|
||||
with Gtk.Widget; use Gtk.Widget;
|
||||
with Gtk.Table; use Gtk.Table;
|
||||
|
||||
with Gtk.Handlers;
|
||||
with Gtk.Main;
|
||||
|
||||
procedure Graphic_Input is
|
||||
Window : Gtk_Window;
|
||||
Grid : Gtk_Tnetable;
|
||||
Label : Gtk_Label;
|
||||
Message : Gtk_Label;
|
||||
Edit : Gtk_GEntry;
|
||||
Button : Gtk_Button;
|
||||
|
||||
package Handlers is new Gtk.Handlers.Callback (Gtk_Widget_Record);
|
||||
package Return_Handlers is
|
||||
new Gtk.Handlers.Return_Callback (Gtk_Widget_Record, Boolean);
|
||||
|
||||
function Delete_Event (Widget : access Gtk_Widget_Record'Class)
|
||||
return Boolean is
|
||||
begin
|
||||
return False;
|
||||
end Delete_Event;
|
||||
|
||||
procedure Destroy (Widget : access Gtk_Widget_Record'Class) is
|
||||
begin
|
||||
Gtk.Main.Main_Quit;
|
||||
end Destroy;
|
||||
|
||||
procedure Clicked (Widget : access Gtk_Widget_Record'Class) is
|
||||
begin
|
||||
if Get_Text (Label) = "Enter integer:" then
|
||||
Set_Text (Message, "Entered:" & Integer'Image (Integer'Value (Get_Text (Edit))));
|
||||
Set_Sensitive (Button, False);
|
||||
else
|
||||
Set_Text (Message, "Entered:" & Get_Text (Edit));
|
||||
Set_Text (Label, "Enter integer:");
|
||||
end if;
|
||||
exception
|
||||
when Constraint_Error =>
|
||||
Set_Text (Message, "Error integer input");
|
||||
end Clicked;
|
||||
|
||||
begin
|
||||
Gtk.Main.Init;
|
||||
Gtk.Window.Gtk_New (Window);
|
||||
Gtk_New (Grid, 2, 3, False);
|
||||
Add (Window, Grid);
|
||||
Gtk_New (Label, "Enter string:");
|
||||
Attach (Grid, Label, 0, 1, 0, 1);
|
||||
Gtk_New (Edit);
|
||||
Attach (Grid, Edit, 1, 2, 0, 1);
|
||||
Gtk_New (Button, "OK");
|
||||
Attach (Grid, Button, 2, 3, 0, 1);
|
||||
Gtk_New (Message);
|
||||
Attach (Grid, Message, 0, 3, 1, 2);
|
||||
Return_Handlers.Connect
|
||||
( Window,
|
||||
"delete_event",
|
||||
Return_Handlers.To_Marshaller (Delete_Event'Access)
|
||||
);
|
||||
Handlers.Connect
|
||||
( Window,
|
||||
"destroy",
|
||||
Handlers.To_Marshaller (Destroy'Access)
|
||||
);
|
||||
Handlers.Connect
|
||||
( Button,
|
||||
"clicked",
|
||||
Handlers.To_Marshaller (Clicked'Access)
|
||||
);
|
||||
Show_All (Grid);
|
||||
Show (Window);
|
||||
|
||||
Gtk.Main.Main;
|
||||
end Graphic_Input;
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
#region Define the Windows Form
|
||||
[Void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
|
||||
|
||||
$Form1 = New-Object System.Windows.Forms.Form
|
||||
$label1 = New-Object System.Windows.Forms.Label
|
||||
$label2 = New-Object System.Windows.Forms.Label
|
||||
$txtInputText = New-Object System.Windows.Forms.TextBox
|
||||
$txtInputNumber = New-Object System.Windows.Forms.TextBox
|
||||
$btnAccept = New-Object System.Windows.Forms.Button
|
||||
$label3 = New-Object System.Windows.Forms.Label
|
||||
$btnCancel = New-Object System.Windows.Forms.Button
|
||||
$SuspendLayout
|
||||
#
|
||||
# label1
|
||||
#
|
||||
$label1.AutoSize = $true
|
||||
$label1.Location = New-Object System.Drawing.Point(23, 36)
|
||||
$label1.Name = "label1"
|
||||
$label1.Size = New-Object System.Drawing.Size(34, 13)
|
||||
$label1.TabIndex = 0
|
||||
$label1.Text = "String"
|
||||
#
|
||||
# label2
|
||||
#
|
||||
$label2.AutoSize = $true
|
||||
$label2.Location = New-Object System.Drawing.Point(13, 62)
|
||||
$label2.Name = "label2"
|
||||
$label2.Size = New-Object System.Drawing.Size(44, 13)
|
||||
$label2.TabIndex = 1
|
||||
$label2.Text = "Number"
|
||||
#
|
||||
# txtInputText
|
||||
#
|
||||
$txtInputText.Location = New-Object System.Drawing.Point(63, 33)
|
||||
$txtInputText.Name = "txtInputText"
|
||||
$txtInputText.Size = New-Object System.Drawing.Size(100, 20)
|
||||
$txtInputText.TabIndex = 0
|
||||
#
|
||||
# txtInputNumber
|
||||
#
|
||||
$txtInputNumber.Location = New-Object System.Drawing.Point(63, 59)
|
||||
$txtInputNumber.Name = "txtInputNumber"
|
||||
$txtInputNumber.Size = New-Object System.Drawing.Size(100, 20)
|
||||
$txtInputNumber.TabIndex = 1
|
||||
$txtInputNumber.Text = "75000"
|
||||
#
|
||||
# btnAccept
|
||||
#
|
||||
$btnAccept.DialogResult = [System.Windows.Forms.DialogResult]::OK
|
||||
$btnAccept.Location = New-Object System.Drawing.Point(16, 94)
|
||||
$btnAccept.Name = "btnAccept"
|
||||
$btnAccept.Size = New-Object System.Drawing.Size(75, 23)
|
||||
$btnAccept.TabIndex = 2
|
||||
$btnAccept.Text = "Accept"
|
||||
$btnAccept.UseVisualStyleBackColor = $true
|
||||
$btnAccept.add_Click({$rc="Accept"; $Form1.Close()})
|
||||
#
|
||||
# label3
|
||||
#
|
||||
$label3.AutoSize = $true
|
||||
$label3.Location = New-Object System.Drawing.Point(13, 9)
|
||||
$label3.Name = "label3"
|
||||
$label3.Size = New-Object System.Drawing.Size(173, 13)
|
||||
$label3.TabIndex = 5
|
||||
$label3.Text = "Please input a string and a number:"
|
||||
#
|
||||
# btnCancel
|
||||
#
|
||||
$btnCancel.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
|
||||
$btnCancel.Location = New-Object System.Drawing.Point(97, 94)
|
||||
$btnCancel.Name = "btnCancel"
|
||||
$btnCancel.Size = New-Object System.Drawing.Size(75, 23)
|
||||
$btnCancel.TabIndex = 3
|
||||
$btnCancel.Text = "Cancel"
|
||||
$btnCancel.UseVisualStyleBackColor = $true
|
||||
#
|
||||
# Form1
|
||||
#
|
||||
$Form1.AcceptButton = $btnAccept
|
||||
$Form1.CancelButton = $btnCancel
|
||||
$Form1.ClientSize = New-Object System.Drawing.Size(196, 129)
|
||||
$Form1.ControlBox = $false
|
||||
$Form1.Controls.Add($btnCancel)
|
||||
$Form1.Controls.Add($label3)
|
||||
$Form1.Controls.Add($btnAccept)
|
||||
$Form1.Controls.Add($txtInputNumber)
|
||||
$Form1.Controls.Add($txtInputText)
|
||||
$Form1.Controls.Add($label2)
|
||||
$Form1.Controls.Add($label1)
|
||||
$Form1.Name = "Form1"
|
||||
$Form1.Text = "RosettaCode"
|
||||
|
||||
#endregion Define the Windows Form
|
||||
|
||||
### Show the input form
|
||||
$f = $Form1.ShowDialog()
|
||||
if ( $f -eq [System.Windows.Forms.DialogResult]::Cancel ) { "User selected Cancel" }
|
||||
else { "User entered `"{0}`" for the text and {1} for the number" -f $txtInputText.Text, $txtInputNumber.Text }
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
REBOL [
|
||||
Title: "Graphical User Input"
|
||||
URL: http://rosettacode.org/wiki/User_Input_-_graphical
|
||||
]
|
||||
|
||||
; Simple GUI's can be defined with 'layout', a special purpose dialect
|
||||
; for specifying interfaces. In this case, I describe a gradient
|
||||
; background with an instruction label, followed by the input fields
|
||||
; and a validation button. It's possible to check dynamically as the
|
||||
; user types but I wanted to keep this example as clear as possible.
|
||||
|
||||
view layout [
|
||||
|
||||
; You can define new widget styles. Here I create a padded label style
|
||||
; (so that everything will line up) and a simple indicator light to
|
||||
; show if there's a problem with an input field.
|
||||
|
||||
style label vtext 60 "unlabeled"
|
||||
style indicator box maroon 24x24
|
||||
|
||||
backdrop effect [gradient 0x1 black coal]
|
||||
|
||||
vtext "Please enter a string, and the number 75000:"
|
||||
|
||||
; By default, GUI widgets are arranged top down. The 'across' word
|
||||
; starts stacking widgets from left to right. 'return' starts a new
|
||||
; line -- just like on a typewriter!
|
||||
|
||||
across
|
||||
|
||||
; Notice I'm using my new label and indicator styles here. Widgets
|
||||
; that I need to access later (the input field and the indicator) are
|
||||
; assigned to variables.
|
||||
|
||||
label "string:" s: field 240 si: indicator return
|
||||
|
||||
label "number:" n: field 50 ni: indicator return
|
||||
|
||||
pad 66
|
||||
button "validate" [
|
||||
|
||||
; The user may have entered bogus values, so I reset the indicators:
|
||||
|
||||
si/color: ni/color: maroon
|
||||
|
||||
; Now I check to see if the values are correct. For the string, I just
|
||||
; care that there is one. For the integer, I make sure that it
|
||||
; evaluates to an integer and that it's value is 75000. Because I've
|
||||
; already set the indicator colour, I don't care the integer
|
||||
; conversion raises an error or not, so I ignore it if anything goes
|
||||
; wrong.
|
||||
|
||||
if 0 < length? get-face s [si/color: green]
|
||||
error? try [if 75000 = to-integer get-face n [ni/color: green]]
|
||||
|
||||
show [si ni] ; Repainting multiple objects at once.
|
||||
]
|
||||
]
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
strUserIn = InputBox("Enter Data")
|
||||
Wscript.Echo strUserIn
|
||||
Loading…
Add table
Add a link
Reference in a new issue