Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,37 @@
include pGUI.e
Ihandle dlg, label1, input1, label2, input2, OK, Cancel
function ok_cb(Ihandle self)
if self=OK then
string in1 = IupGetAttribute(input1,"VALUE")
integer in2 = IupGetInt(input2,"VALUE")
string msg = sprintf("\"%s\" and %d",{in1,in2})
IupMessage("You entered",msg)
-- (return IUP_CONTINUE if unhappy with input)
end if
return IUP_CLOSE
end function
function esc_close(Ihandle /*ih*/, atom c)
return iff(c=K_ESC?IUP_CLOSE:IUP_CONTINUE)
end function
IupOpen("demo/pGUI/")
label1 = IupLabel("Please enter a string")
input1 = IupText("VALUE=\"a string\", EXPAND=HORIZONTAL")
label2 = IupLabel("and the number 75000")
input2 = IupText("VALUE=75000, EXPAND=HORIZONTAL")
IupSetAttribute(input2,"MASK",IUP_MASK_INT)
OK = IupButton("OK", "ACTION", Icallback("ok_cb"))
Cancel = IupButton("Cancel", "ACTION", Icallback("ok_cb"))
dlg = IupDialog(IupVbox({IupHbox({label1,input1},"ALIGNMENT=ACENTER, PADDING=5"),
IupHbox({label2,input2},"ALIGNMENT=ACENTER, PADDING=5"),
IupHbox({IupFill(),OK,Cancel,IupFill()},"PADDING=15")},
"GAP=5,MARGIN=5x5"))
IupSetAttribute(dlg,"TITLE","User Input/Graphical")
IupSetCallback(dlg, "K_ANY", Icallback("esc_close"))
IupDestroy(IupNormalizer({OK,Cancel},"NORMALIZE=BOTH"))
IupShow(dlg)
IupMainLoop()
IupClose()

View file

@ -0,0 +1,43 @@
Load "guilib.ring"
MyApp = New qApp {
num = 0
win1 = new qWidget() {
setwindowtitle("Hello World")
setGeometry(100,100,370,250)
btn1 = new qpushbutton(win1) {
setGeometry(130,200,100,30)
settext("Validate")
setclickevent("Validate()")}
lineedit1 = new qlineedit(win1) {
setGeometry(10,100,250,30)
settext("")}
lineedit2 = new qlineedit(win1) {
setGeometry(10,150,50,30)
settext("0")}
label1 = new qLabel(win1) {
setGeometry(270,100,50,30)
setText("")}
label2 = new qLabel(win1) {
setGeometry(70,150,50,30)
setText("")}
label3 = new qLabel(win1) {
setGeometry(10,50,250,30)
setText("Please enter a string, and the number 75000 :")}
show()}
exec()}
func Validate
lineedit1{temp1 = text()}
num1 = isdigit(temp1)
if num1 = 0 label1{settext("OK")} else label1{settext("NOT OK")} ok
lineedit2{temp2 = text()}
num2 = number(temp2)
if num2 = 75000 label2{settext("OK")} else label2{settext("NOT OK")} ok

View file

@ -0,0 +1,182 @@
var gtk2 = require('Gtk2') -> init;
var gui = %s'Gtk2::Builder'.new;
gui.add_from_string(DATA.slurp);
func clicked_ok(*_) {
var entry = gui.get_object('entry1');
var text = entry.get_text;
var spinner = gui.get_object('spinbutton1');
var number = spinner.get_text;
say "string: #{text}";
say "number: #{number}";
number == 75000 ? gtk2.main_quit : warn "Invalid number!";
}
func clicked_cancel(*_) {
gtk2.main_quit;
}
gui.get_object('button1').signal_connect('clicked', clicked_ok);
gui.get_object('button2').signal_connect('clicked', clicked_cancel);
gtk2.main;
__DATA__
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.24"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100000</property>
<property name="value">75000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkWindow" id="window1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Please insert a string and a number:</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">string:</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">55</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">number:</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="spinbutton1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<property name="adjustment">adjustment1</property>
<property name="numeric">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">spread</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
</interface>