I''ve searched the documentation like crazy but I can''t seem to find the events for each of the widgets. Any info on this would be greatly appreciated. -- Posted via http://www.ruby-forum.com/.
John Baker
2010-Jan-24 15:48 UTC
[wxruby-users] Where can I find a list of events for each widget?
Maybe a better questions is: Is there a way to attack your event listeners to objects? Like can I take a control and add a mouse listener to it? If not then how would things be handled in a custom control -- Posted via http://www.ruby-forum.com/.
Alpha Blue
2010-Jan-24 16:22 UTC
[wxruby-users] Where can I find a list of events for each widget?
Hi John, This page here: http://rubyhelp.org/docs/wxruby/ Scroll all the way down until you see the Events section. Each of the events sub-sections when clicked on will show you all of the evt_events for that section. It''s a little confusing, I know, event to me. This is partly because the documentation was not created like a standard RI documentation. Your mouse events are here: http://rubyhelp.org/docs/wxruby/mouseevent.html When you have a control you can extend upon its behavior within a module. I''m still very new to wxruby but I''m learning quickly. Hopefully some of the links will help. I''m going to be very busy reading boards so don''t be afraid to post your comments. I know sometimes this board appears very quiet, but it just needs some new life. Alex and Mario are great responders. -- Posted via http://www.ruby-forum.com/.
John Baker
2010-Jan-24 17:21 UTC
[wxruby-users] Where can I find a list of events for each widget?
Hey I appreciate the info. I have checked all that info out already, the problem I have is how to implement it. Like I want to take a window and add key_down listener to it. I have a hard time finding how that is achievable. -- Posted via http://www.ruby-forum.com/.
Joel Dezenzio
2010-Jan-24 17:31 UTC
[wxruby-users] Where can I find a list of events for each widget?
Hi John, How are you developing your GUIs. Are you coding everything by hand or are you designing your layouts with a GUI designer and using Xrcise to compile the XRC (xml) for use with WxRuby? I''m doing the latter with DialogBlocks so how the events are tied into things are a little different for me because all of my elements are automatically setup for me and all I have to do is extend from those elements by setting up my listener events. If you have XRC and can post some code, I can help you or someone else can. Personally, I believe in GUI designers because I like to keep the graphical elements separate from the code. Let me know and post some code and I or someone else will try to help you out. Sincerely, Joel Dezenzio Website Bio: http://jdezenzio.com/ Rails Production Sites: http://ncaastatpages.com
John Baker
2010-Jan-24 18:32 UTC
[wxruby-users] Where can I find a list of events for each widget?
Well so far I have no code. What I''m doing is writing a IDE for programming that is similar to TextMate but written in ruby. I wanted to use StyledTextCtrl but while it has the charadded event that isn''t really useful to me since it doesn''t detect backspaces. So for lack of any other options I was going to try to create my own widget. I was just going to extend the scrolledWindow. It looks like it will do the trick, but I can''t figure out how to capture keystrokes with it or even what events it possesses. So I''m kinda stuck unfortuantely. -- Posted via http://www.ruby-forum.com/.
Alpha Blue
2010-Jan-25 00:01 UTC
[wxruby-users] Where can I find a list of events for each widget?
Hi John, One GUI application that I wrote in another language is a special search engine that also parses and finds code across the web. I just got back from a birthday party and performed a quick query for you and found the following: http://www.google.com/codesearch?as_q=Wx::StyledTextCtrl&hl=en&as_lang=ruby&as_license_restrict=i&as_license=&as_package=&as_filename=&as_case This might help you get started. Enjoy. -- Posted via http://www.ruby-forum.com/.
Alpha Blue
2010-Jan-25 00:18 UTC
[wxruby-users] Where can I find a list of events for each widget?
You could also look at incorporating highline with your app. I came across an interesting article concerning key captures here: http://blog.grayproductions.net/articles/i_just_want_one_character -- Posted via http://www.ruby-forum.com/.
Alex Fenton
2010-Jan-25 15:30 UTC
[wxruby-users] Where can I find a list of events for each widget?
John Baker wrote:> Hey I appreciate the info. I have checked all that info out already, the > problem I have is how to implement it. Like I want to take a window and > add key_down listener to it. I have a hard time finding how that is > achievable. >You might find this document useful: http://wxruby.rubyforge.org/doc/eventhandlingoverview.html The only slightly complicated thing is understanding the difference between Command events and others. For other, generic events like mouse and key events, it''s basically event_source.evt_type { # ... handler code } Since it inherits from Window, StyledTextCtrl should emit the evt_key_xxx family of events as well as the specialised STC events listed here: http://wxruby.rubyforge.org/doc/styledtextctrl.html hth alex
John Baker
2010-Jan-26 12:32 UTC
[wxruby-users] Where can I find a list of events for each widget?
Hey Alex, yeah I checked it out, but the evt_key didn''t seem to return any substantial data, or at least I wasn''t able to get at it if it did. I printed out every single attribute and I never got a character code or anything. I may have missed something but I don''t know. -- Posted via http://www.ruby-forum.com/.
Alex Fenton
2010-Jan-26 12:56 UTC
[wxruby-users] Where can I find a list of events for each widget?
On 26/01/2010 12:32, John Baker wrote:> Hey Alex, yeah I checked it out, but the evt_key didn''t seem to return > any substantial data, or at least I wasn''t able to get at it if it did. > I printed out every single attribute and I never got a character code or > anything. >It (evt_char) seems to work fine for me - try the sample below. Note that you''ll need to skip() the event if you want normal handling by the STC to proceed. Depending on the use case, you might also look into Wx::AcceleratorTable, which is a standardised, easy way to set up keyboard shortcuts, rather than handling the raw keypresses. alex -- require ''wx'' class STCFrame < Wx::Frame def initialize super(nil, :title => ''Key Event Test'') @stc = Wx::StyledTextCtrl.new(self) @stc.evt_char do | e | p e.key_code end end end Wx::App.run do STCFrame.new.show end
John Baker
2010-Jan-29 05:43 UTC
[wxruby-users] Where can I find a list of events for each widget?
Hey sorry I''m way late on this but thanks. I''m gonna check out this code. I''ll report back when I do. -- Posted via http://www.ruby-forum.com/.
John Baker
2010-Jan-30 03:00 UTC
[wxruby-users] Where can I find a list of events for each widget?
Alex Fenton wrote:> On 26/01/2010 12:32, John Baker wrote: >> Hey Alex, yeah I checked it out, but the evt_key didn''t seem to return >> any substantial data, or at least I wasn''t able to get at it if it did. >> I printed out every single attribute and I never got a character code or >> anything.aww man I got so excited for this to work but then it doesn''t recognize the backspace key! Not sure if there is another solution but that is pretty useless otherwise. I hope that is not the case -- Posted via http://www.ruby-forum.com/.