[Ironruby-core] Form Designer adding delegates

Wayne Kelly w.kelly at qut.edu.au
Wed Oct 24 21:29:58 EDT 2007


I battled many of these issues in developing the VS package (including forms designer) for Ruby.NET.

You can check out a complete version from http://rubydotnetcompiler.googlecode.com/svn/trunk/src/VisualStudioPackage/

There may be still be some bugs, but it basically works. Some of the code in our InitializeComponent is a little un Ruby like
but it was done to achieve perfect round-trip-ability.

Perhaps we could collaborate more closely on the VS integration challenges for Ruby?

I'm certainly happy to have one-on-one conversations with anyone working on this part of the project.

Cheers, Wayne.


FYI, the code that we would generate in that scenario is as follows:



require 'mscorlib.dll'
require 'System.dll'
require 'System.Drawing.dll'
require 'System.Windows.Forms.dll'


class Form1 < System::Windows::Forms::Form

  def initialize
        self.InitializeComponent
  end


  attr_accessor :button1

  def InitializeComponent()
    @button1 = System::Windows::Forms::Button.new()
    self.SuspendLayout()
    #
    # button1
    #
    @button1.set_Location(System::Drawing::Point.new(47, 54))
    @button1.set_Name('button1')
    @button1.set_Size(System::Drawing::Size.new(75, 23))
    @button1.set_TabIndex(0)
    @button1.set_Text('button1')
    @button1.set_UseVisualStyleBackColor(true)
    @button1.add_Click(System::EventHandler.new { |*args| self.button1_Click(*args)})
    #
    # Form1
    #
    self.set_ClientSize(System::Drawing::Size.new(292, 266))
    self.get_Controls().Add(@button1)
    self.set_Name('Form1')
    self.ResumeLayout(false)
  end

  def button1_Click(sender,e)

  end

end


More information about the Ironruby-core mailing list