Vruby Question on Processing Keyboard Input

Discussion in 'Ruby' started by lrlebron@gmail.com, Nov 27, 2006.

  1. Guest

    I am new to Ruby and even newer to vruby so bear with me. I have a
    simple application that has a text box. I would like to track when the
    user hits Ctrl-C, Ctrl-X, Ctrl-A and Ctrl-V so that my program behaves
    the same way other windows program do.

    I have looked at the vruby documentation and samples but have not found
    anything that explains how to do this.

    Any help would be greatly appreciated.


    thanks,

    Luis
    , Nov 27, 2006
    #1
    1. Advertising

  2. Axel Guest


    > ... I would like to track when the
    > user hits Ctrl-C, Ctrl-X, Ctrl-A and Ctrl-V so that my program behaves
    > the same way other windows program do.


    Does Ctrl-C, Ctrl-X and Ctrl-V already work "out of the box"? (I think
    so.)

    - Axel
    Axel, Nov 28, 2006
    #2
    1. Advertising

  3. Guest

    I wish it would. As far a I understand you have to write code to handle
    the keyboard events and capture when a user uses a particular key or
    keys.


    Luis
    Axel wrote:
    > > ... I would like to track when the
    > > user hits Ctrl-C, Ctrl-X, Ctrl-A and Ctrl-V so that my program behaves
    > > the same way other windows program do.

    >
    > Does Ctrl-C, Ctrl-X and Ctrl-V already work "out of the box"? (I think
    > so.)
    >
    > - Axel
    , Nov 28, 2006
    #3
  4. Axel Guest

    > I wish it would. As far a I understand you have to write code to handle
    > the keyboard events and capture when a user uses a particular key or
    > keys.


    Hmm, some years ago, I wrote a little application using vruby. I just
    started it, and there is an edit box in it and I can copy and paste
    text with Ctrl-C and Ctrl-V. I'did not code anything special for
    making it work. One thing I remember is, that I had to change "oemfont"
    or something like this, but I think, this was not neccessary in order
    to get Ctrl-C... working.

    BTW, "subclstest.rb" in the samples dir could be interesting. (But I
    think, it is not neccessary for what you want.) Do you have/find it?

    - Axel
    Axel, Nov 28, 2006
    #4
  5. Guest

    I found the script. Thanks for the tip. But the script only handles
    single key presses. It does not handle key combinations. It does get me
    closer to a solution though.

    thanks,

    Luis

    Axel wrote:
    > > I wish it would. As far a I understand you have to write code to handle
    > > the keyboard events and capture when a user uses a particular key or
    > > keys.

    >
    > Hmm, some years ago, I wrote a little application using vruby. I just
    > started it, and there is an edit box in it and I can copy and paste
    > text with Ctrl-C and Ctrl-V. I'did not code anything special for
    > making it work. One thing I remember is, that I had to change "oemfont"
    > or something like this, but I think, this was not neccessary in order
    > to get Ctrl-C... working.
    >
    > BTW, "subclstest.rb" in the samples dir could be interesting. (But I
    > think, it is not neccessary for what you want.) Do you have/find it?
    >
    > - Axel
    , Nov 28, 2006
    #5
  6. Axel Guest

    Could you post your code, or part of it?

    And, is it right, that you just want to copy and paste text within your
    editbox or from another Windows app to/from your vruby editbox, using
    Ctrl-C, X, Z?

    - Axel
    Axel, Nov 28, 2006
    #6
  7. Guest

    After taking a closer look at the program I noticed that Ctrl-C, Ctrl-X
    and Ctrl-V work. The only one that does not work is Ctrl-A. Here's a
    sample of the code

    require 'vr/vruby'
    require 'vr/vrcontrol'
    require 'vr/vrcomctl'
    require 'vr/vrtooltip'


    class TestForm <VRForm


    def construct
    self.caption = 'NFL Stats'
    self.move(140,124,760,531)

    addControl(VRText,'text1',"",16,16,725,350,WStyle::WS_VSCROLL)


    end

    end

    VRLocalScreen.start(TestForm)




    Axel wrote:
    > Could you post your code, or part of it?
    >
    > And, is it right, that you just want to copy and paste text within your
    > editbox or from another Windows app to/from your vruby editbox, using
    > Ctrl-C, X, Z?
    >
    > - Axel
    , Nov 28, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Tuckner

    VRuby/Win32 Question

    Steve Tuckner, Sep 25, 2003, in forum: Ruby
    Replies:
    1
    Views:
    86
    Eric Landuyt
    Sep 25, 2003
  2. Iki

    VRuby and Timeout

    Iki, Nov 7, 2003, in forum: Ruby
    Replies:
    0
    Views:
    77
  3. Armin Roehrl
    Replies:
    0
    Views:
    96
    Armin Roehrl
    Feb 9, 2004
  4. Esad Hajdarevic

    vruby question

    Esad Hajdarevic, Sep 29, 2006, in forum: Ruby
    Replies:
    3
    Views:
    133
    Steve Tuckner
    Sep 29, 2006
  5. Domenic Padula

    VRuby tabstop question

    Domenic Padula, Sep 29, 2006, in forum: Ruby
    Replies:
    3
    Views:
    112
    Domenic P.
    Oct 12, 2006
Loading...

Share This Page