Using additional widget in Ruby

Discussion in 'Ruby' started by Markus Liebelt, Jan 7, 2005.

  1. Hello everybody!

    Is it possible to install an additional widget written in Tcl/Tk and using
    that widget in ruby without the change of any libraries? That should be
    possible, because when copying that file to some place where Tcl will find
    it, it is possible to start it without changing any library files or
    compiling anything (Tcl is a scripting language, isn't it)?

    The task I want to do is to install Bryan Douglas Oakley combobox and
    using it in Ruby.

    http://www.purl.org/net/oakley/tcl/combobox/index.html

    By the side, has anyone a description how the integration of Tcl/Tk in
    ruby is done? I don't get it at the moment, and it looks sometimes as
    magic what is going on. If anyone has an explanation what is going on, I
    could read that and don't ask silly questions in this newsgroup.

    Bye
    Markus
    --
    Markus Liebelt;
    Markus Liebelt, Jan 7, 2005
    #1
    1. Advertising

  2. Hi,

    From: "Markus Liebelt" <>
    Subject: Using additional widget in Ruby
    Date: Sat, 8 Jan 2005 01:51:28 +0900
    Message-ID: <-si.com>
    > Is it possible to install an additional widget written in Tcl/Tk and using
    > that widget in ruby without the change of any libraries?


    Yes, of course.
    Please see tktree.rb and tktree.tcl included in the Ruby source archive.
    You can find them ext/tk/sample directory. Probably, they exist at the
    samples folder of the one-click-ruby-installer.
    tktree.tcl is a widget written in pure Tcl/Tk.
    tktree.rb is a wrapper of the tktree widget.

    > The task I want to do is to install Bryan Douglas Oakley combobox and
    > using it in Ruby.


    If your Tcl/Tk can load the library, you can use it on your Ruby/Tk.
    However, you may have to add the library path to Tk::AUTO_PATH or
    Tk::pACKAGE_PATH or Tk::LIBRARY_PATH.
    To create and control the widget class, please use Tk.tk_call.

    Ruby/Tk can call all functions of Tcl/Tk, and can load Tcl/Tk scripts.
    Even if Tcl/Tk's functions aren't wrapped by Ruby's classes or methods,
    they can be called by Tk.tk_call (or TkCore::INTERP._invoke).

    Tk.tk_call does NOT use Tcl/Tk's command line parser for the reason of
    parsing overhead.
    It uses Tcl_GetCommandInfo() function to search Tcl/Tk's commands.
    Therefore, in rare cases, Ruby/Tk fails to autoload Tcl/Tk libraries.
    When you have such troubles, please use Tk.ip_eval method to call the
    Tcl/Tk command. The methods passes the argument string to Tcl/Tk's
    command line parser.
    --
    Hidetoshi NAGAI ()
    Hidetoshi NAGAI, Jan 9, 2005
    #2
    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. Alexandru Popescu

    additional requirements for a Ruby env

    Alexandru Popescu, Jul 16, 2006, in forum: Ruby
    Replies:
    16
    Views:
    179
    Austin Ziegler
    Jul 19, 2006
  2. Replies:
    0
    Views:
    321
  3. Frederic Rentsch
    Replies:
    0
    Views:
    221
    Frederic Rentsch
    Jul 8, 2012
  4. Terry Reedy
    Replies:
    15
    Views:
    612
    Frederic Rentsch
    Jul 16, 2012
  5. Frederic Rentsch
    Replies:
    0
    Views:
    417
    Frederic Rentsch
    Jul 9, 2012
Loading...

Share This Page