I have a big favor to ask. I am new to ruby and have managed to build an
application which manages my Option Trades.
Now I get to the point were I want to make a GUI for my application.
Based on all the info provide I have decided for FxRuby. Studying FxRuby
I miss the first step documentation.
I have managed to build a demo screen with FoxGui (see below), but I am
struggling to write a program that handles this window.
On the forum I see a lot of us (newbie's) struggling with the first
Fxruby steps. Would one of you please be so kind and write a little
program using my enclose Demo Window.
Let the program handle the following actions.
At Init move value '1' to button one, '2' to button '2' and '3' to
button '3', 'a' to text1, 'b' to text2 and 'c' to text3.
On click of button1. Swap the strings from button2 and button3 and text2
and text3.
On click of button2. swap the strings from button1 and button3 plus
text1 and text3.
On click of button3. swap 1 and 2.
A picture is worth a 1000 words equals to an example hold the value of a
book.
Thanks a million in advance.
Ernst
···
--------
# source generated by foxGUIb 0.7.1
class MainWindow
def initialize( parent)
construct_widget_tree( parent)
init if respond_to? 'init'
end
def construct_widget_tree( parent)
@topwin=
FX::MainWindow.new(parent){|w|
@mainWindow=w
w.wdg_name='mainWindow'
w.width=532
w.shown=true
w.y=312
w.height=536
w.x=390
FX::HorizontalFrame.new(@mainWindow){|w|
@horizontalframe1=w
w.wdg_name='horizontalframe1'
w.width=532
w.height=536
FX::VerticalFrame.new(@horizontalframe1){|w|
@verticalframe1=w
w.wdg_name='verticalframe1'
w.width=231
w.height=536
FX::Button.new(@verticalframe1){|w|
@button1=w
w.wdg_name='button1'
w.width=40
w.height=21
}
FX::Button.new(@verticalframe1){|w|
@button2=w
w.wdg_name='button2'
w.width=40
w.y=21
w.height=21
}
FX::Button.new(@verticalframe1){|w|
@button3=w
w.wdg_name='button3'
w.width=40
w.y=42
w.height=21
}
}
FX::VerticalFrame.new(@horizontalframe1){|w|
@verticalframe2=w
w.wdg_name='verticalframe2'
w.width=301
w.height=536
w.x=231
FX::Text.new(@verticalframe2){|w|
@text2=w
w.wdg_name='text2'
w.width=301
w.height=178
}
FX::Text.new(@verticalframe2){|w|
@text4=w
w.wdg_name='text4'
w.width=301
w.y=178
w.height=179
}
FX::Text.new(@verticalframe2){|w|
@text5=w
w.wdg_name='text5'
w.width=301
w.y=357
w.height=179
}
}
}
}
end
attr_reader :topwin
attr_reader :mainWindow
attr_reader :horizontalframe1
attr_reader :verticalframe1
attr_reader :button1
attr_reader :button2
attr_reader :button3
attr_reader :verticalframe2
attr_reader :text2
attr_reader :text4
attr_reader :text5
end
#unit test
if __FILE__==$0
require 'libGUIb16'
app=FX::App.new
w=MainWindow.new app
w.topwin.show(Fox::PLACEMENT_SCREEN)
app.create
app.run
end
Attachments:
http://www.ruby-forum.com/attachment/1100/demo.rb
--
Posted via http://www.ruby-forum.com/.