2009/12/15

Booのメモ - step2

import System
import System.Drawing
import System.Windows.Forms

class Frame(Form):
    def constructor(str as String):
        self.Text = str
        #standerd method
        ba = Button(Text: "OK")
        ba.Click += ba_Click
        #anonymous method
        bc = Button(Text: "Cancel")
        bc.Click += def(sender as Object, e as EventArgs):
            print "anonymous", sender, e
           
        bc.Bounds = Rectangle(0, 25, 75, 24)
       
        self.Controls.Add(ba)
        self.Controls.Add(bc)
   
    def ba_Click(sender as Object, e as EventArgs):
        print "click...", sender, e
   
[STAThread]
def Main():
    f = Frame("WinForms")
    Application.Run(f)

2009/12/05

Booのメモ - step1

namespace Boo1

import System

def Main(args as (string)):  #-> (string) is array...
    for s in range(10):
        print "Hello, Boo ! "+ s
   
    f = myFunc("Hello, World !")
    for c in f:
        print c
   
    l = ["ABC", 3, "BBQ", 5]
    print
    print l[2]
   
    print "Press any key to continue . . . "
    Console.ReadKey(true)
   
def myFunc(str as string)as char*:
    for i in str:
        yield i