Displaying 20 results from an estimated 48 matches for "evt_button".
2004 Jun 11
9
Handling Events that don''t take an ID
Hey Kevin,
Am I correct in assuming that if I want a particular widget to respond to an
event which doesn''t take an ID as an argument (like evt_size or
evt_left_down), that I have to inherit a new widget and define the event
handler within the inherited class? Here''s a little contrived code example
to illustrate what I mean:
class MyCtrl < Wx::TextCtrl
def
2007 Sep 10
2
syntax II
...bly also have to live with whatever we
settle on for 2.0 for a little while, so...
1) Setting up event handlers
In most real apps, I think the most normal way to set up event handlers
is for the event to be dealt with by a corresponding method. At the
moment this has to be done using a block:
evt_button(AN_ID) { on_button_click }
evt_button(my_button.get_id) do | event |
on_button_click(event)
end
evt_size { | event | on_size(event) }
This is a sensible way to organise classes but it seems to have
redundancy in it. The bigger one is having to create a block, with
param, just to call a method;...
2004 May 12
8
New tutorial added!
Hey guys,
It''s been awhile, but I''ve put up a new tutorial page on Wx::Frame. It''s
the first half of the tutorial on Frame, the rest will come a little later.
Let me know what you guys think. Any comments or criticisms are welcome.
Let me know what was good and what could have been better, so that future
tutorials will be able to incorporate those improvements.
2009 Jan 29
4
Help understanding EVERYTHING
Team,
I am trying to learn a GUI for Ruby and I picked wxRuby.
The problem is that I am kind of slow learning this and I now feel
frustrated after trying for about at least 7 hours.
I am trying to design a simple Sudoku 9x9 grid to display numbers, 1 - 9,
using buttons.
I posted a question on Ruby forum ruby-talk and a gentleman, Alex Fenton,
answered my questions.
Alex gave me what appear to be
2005 Aug 19
9
Patch for listbook.rb
Attached is a patch file for listbook.rb
1) Message box scrolls properly now
2) Blank lines are skipped when adding pizzas and ice cream
_______________________________________________
wxruby-users mailing list
wxruby-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/wxruby-users
2007 Nov 02
11
xrcise tutorial, undefined method ''upper_bt''
...lib/ruby/gems/1.8/gems/wxruby-1.9.2-i386-mswin32/lib/wx/classes/app.rb:16:in
`run''
from tutorial.rb:27
The relevant ruby code looks like.
# Inherit from the generated base class and set up event handlers
class CaseChangeFrame < TextFrameBase
def initialize
super
evt_button(upper_bt) { text_box.upcase! }
evt_button(lower_bt) { text_box.downcase! }
end
end
I have triple checked that I have given the button widget an Id name of
upper_bt in DialogBlocks
Has anyone come across this before?
Thanks
Tim
_______________________________________________
wxruby-use...
2010 Mar 20
1
Tab key traversal
...#39;'
class MainFrame < TPSC
def on_init
m_scrolledwindow6.set_virtual_size(400, 100)
m_scrolledwindow6.set_scroll_rate(5, 5)
wxEVT_CHAR(@m_textCtrl2) { m_textCtrl3.set_focus }
wxEVT_CHAR(@m_textCtrl3) { m_textCtrl4.set_focus }
wxEVT_CHAR(@m_textCtrl4) { m_textCtrl4.set_focus }
# evt_button(@m_buttonincrement) { increaseColour }
# evt_button(@m_buttondecrement) { decreaseColour }
end
Wx::App.run do
self.app_name = ''TestNotebook''
frame = MainFrame.new
frame.show
end
2007 Sep 17
7
Re : syntax II
Alex Fenton wrote :
>1) Setting up event handlers
>
>In most real apps, I think the most normal way to set up event handlers
>is for the event to be dealt with by a corresponding method. At the
>moment this has to be done using a block:
>
>evt_button(AN_ID) { on_button_click }
>evt_button(my_button.get_id) do | event |
> on_button_click(event)
>end
>evt_size { | event | on_size(event) }
>
>So I''d like to suggest as alternatives:
>
>evt_button(AN_ID, :on_button_click)
>evt_button my_button, :on_button_click
&...
2004 Jun 19
4
FlexGridSizer question
...LIGN_RIGHT, 5)
@date = Wx::TextCtrl.new(self, -1, ''6/28/2004'')
@date.set_font(ROMAN_12)
sizer.add(@date, 0, Wx::ALL, 5)
button = Wx::Button.new(self, Wx::ID_OK, ''OK'',
Wx::Point.new(0,0),Wx::Size.new(70,25))
button.evt_button(Wx::ID_OK){|event| onDoOK()}
sizer.add(button, 0, Wx::SOUTH|Wx::WEST|Wx::EAST, 10)
button = Wx::Button.new(self, Wx::ID_CANCEL, ''Cancel'',
Wx::Point.new(0,0),Wx::Size.new(70,25))
button.evt_button(Wx::ID_CANCEL){|event| onDoCancel()}
siz...
2010 Mar 30
2
My first wxRuby app doesn't work, please help!
...= StaticText.new(@panel,-1,"Label")
@text1 = TextCtrl.new(@panel,-1,"Text Value")
@combo =ComboBox.new(@panel,-1,"Combo Text")
@button =Button.new(@panel,-1,"Submit")
#layout
@sizer = BoxSizer.new(VERTICAL)
@panel.set_sizer(@sizer)
evt_button(@my_button.get_id()) { |event| my_button_click(event)}
@sizer.add(@lbl1,0, GROW|ALL,2)
@sizer.add(@text1,0, GROW|ALL,2)
@sizer.add(@combo,0, GROW|ALL,2)
@sizer.add(@button,0, GROW|ALL,2)
show()
end
def my_button_click(event)
#añádir codigo
puts "Presionado&quo...
2008 May 03
3
what type of variable use? (setting text on another class va
so, i have a MinimalFrame class where i have a form, then, after a user
add a new client i would like to send a log message on MainFrame
status_bar.
--
Posted via http://www.ruby-forum.com/.
2004 Aug 07
1
end_modal question
...= Wx::Button.new( popup , -1 , "&Cancel" , Wx::Point.new(
> 150 , 75 ) ,
> Wx::Size.new( 60 , 25 ) );
> ok_btn = Wx::Button.new( popup , -1 , "&Ok" , Wx::Point.new( 225 ,
> 75 ) ,
> Wx::Size.new( 60 , 25 ) );
>
> cancel_btn.evt_button( cancel_btn.get_id() ){ |e| exit(0); }
> ok_btn.evt_button( ok_btn.get_id() ){ |e|
> Game.updateOpponent( input_txt.get_value() );
> popup.end_modal( Wx::ID_OK ); }
>
> popup.show_modal();
> end
>
> Any idea''s why my end_modal quits the...
2007 Oct 23
6
wxRuby 1.9.2
...rious method-specific fixes in GUI classes
* New and improved samples and documentation, including threads sample
== SYNTAX CHANGES ==
All the syntax additions are backwards compatible. The main change is
that when setting up an event handler that just passes onto a method,
instead of writing:
evt_button(my_button.wx_id) { | e | on_button_click(e) }
You can just write
evt_button my_button, :on_button_click
Phew! There''s more information in the event handling tutorial in the
docs. Also, for simple apps, instead of having to create a custom
Wx::App subclass, you can run an app like this...
2006 Oct 21
3
wxsugar question
I''ve only had the briefest play with wxSugar and already I like it a lot.
One small question - have you considered some more ''convention over
configuration'' like they do in rails, in particular for event connectors?
So instead of
listen(:button, my_button, my_button_pressed)
you can leave it out entirely and rely on the convention that a button has
a _pressed
2007 May 31
0
[1043] trunk/wxruby2/samples/bigdemo: Don''t manually call destroy
...pan><span class="lines">@@ -20,15 +20,16 @@
</span><span class="cx">
</span><span class="cx"> button = Button.new(panel, -1, "Close me", Point.new(15,15))
</span><span class="cx"> evt_button( button.get_id ) { on_close_me }
</span><del>- evt_close { on_close_window }
</del><ins>+ evt_close { | e | on_close_window(e) }
</ins><span class="cx"> end
</span><span class="cx">
</span><span clas...
2010 Jun 22
1
Stuck noobie: XRC/xrcise woes
....value = self.value.upcase
end
# convert all the text in the control to lower case
def downcase!
self.value = self.value.downcase
end
end
# Inherit from the generated base class and set up event handlers
class CaseChangeFrame < TextFrameBase
def initialize
super
evt_button(upper_bt) { text_box1.upcase! }
evt_button(lower_bt) { text_box1.downcase! }
end
end
# Run the class
Wx::App.run do
CaseChangeFrame.new.show
end
4)
##### ERROR MESSAGE: #####
R:\GUI\Practice\Exercise>ruby Exercise.rb
./my_frame.rb:37:in `initialize'': uninitialized const...
2006 Dec 23
0
[796] trunk/wxruby2/samples/xrc/xrc_sample.rb: Simplify some method calls, rubyify and add a little more explanation
...;del>-                #
-                evt_button(Wx::xrcid(''wxID_OK'')) do
-                        end_modal(Wx::ID_OK)
</del><in...
2007 Mar 22
0
[916] branches/wxruby2/wxwidgets_282: More Wx::AUI classes, event hooks and sample
...ND|Wx::ALL, 5)
+ self.set_sizer(cont_sizer)
+ get_sizer.set_size_hints(self)
+ update_colours
+
+ evt_spinctrl(ID_PaneBorderSize) { | e | on_pane_border_size(e) }
+ evt_spinctrl(ID_SashSize) { | e | on_sash_size(e) }
+ evt_spinctrl(ID_CaptionSize) { | e | on_caption_size(e) }
+ evt_button(ID_BackgroundColour) { | e | on_set_colour(e) }
+ evt_button(ID_SashColour) { | e | on_set_colour(e) }
+ evt_button(ID_InactiveCaptionColour) { | e | on_set_colour(e) }
+ evt_button(ID_InactiveCaptionGradientColour) { | e | on_set_colour(e) }
+ evt_button(ID_InactiveCaptionTextColour) {...
2007 Oct 03
9
WxRuby Newbie Application Hanging
I have a WxRuby application that takes a few inputs from the user and
uses that information to search through a large file for matches. The
application works very well, with one exception. If I click anywhere
in the frame while the application is searching through the long file,
the application hangs. Has anyone experienced anything similar to
this? Any suggestions on how I can fix this?
Thanks
2008 Jun 12
4
Background thread - entension code - switch contexts
...x::Frame
STEPS = 100
def initialize
super(nil,-1,"Title")
set_client_size(Wx::Size.new(300,300))
panel = Wx::Panel.new(self)
sizer = Wx::BoxSizer.new(Wx::VERTICAL)
btn = Wx::Button.new(panel, -1, "Click me")
sizer.add(btn, 0, Wx::GROW|Wx::ALL,2)
evt_button(btn.get_id){
Thread.abort_on_exception = true
#that does not work
@th = Thread.new do
Wx::Timer.every(20) do
Thread.pass
end
method1
end
}
panel.set_sizer(sizer)
sizer.fit(panel)
end
def method1
alg = C...