Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > TkDialogBox missing?

Reply
Thread Tools

TkDialogBox missing?

 
 
Josef Wolf
Guest
Posts: n/a
 
      08-31-2006
Hello!

I am pretty new to ruby, but I have used perl/Tk in my previous life
I can't find ruby's aequivalent to perl's Tk:ialogBox. I need to
implement something similar to firefox's "preferences" dialog. The
TkDialog class don't look as if it can maintain arbitrary widgets.

I have checked the archives and google, but could find only a thread[*]
dated back to the year 2000.

What is the current status? Are dialog boxes still not supported?
Or am I just misunderstanding something? Maybe there's some sort of
work-around?
[*] http://blade.nagaokaut.ac.jp/cgi-bin...7548?7484-8460

 
Reply With Quote
 
 
 
 
Hidetoshi NAGAI
Guest
Posts: n/a
 
      09-01-2006
From: Josef Wolf <(E-Mail Removed)>
Subject: TkDialogBox missing?
Date: Fri, 1 Sep 2006 07:50:34 +0900
Message-ID: <(E-Mail Removed)>
> I am pretty new to ruby, but I have used perl/Tk in my previous life
> I can't find ruby's aequivalent to perl's Tk:ialogBox. I need to


That is NOT a standard widget of Tcl/Tk.
Probably, it is a perl/Tk specific one.

I think that "Dialog" widget of BWidget extension is one of
similar widgets. BWidget extension is written in pure Tcl/Tk.
So, it is not difficult to install.
Ruby/Tk supports BWidget extension by 'tkextlib/bwidget.rb'.

# Of course, you can write such new widget class by your own.
--
Hidetoshi NAGAI ((E-Mail Removed))

 
Reply With Quote
 
 
 
 
Josef Wolf
Guest
Posts: n/a
 
      09-01-2006
On Fri, Sep 01, 2006 at 12:01:13PM +0900, Hidetoshi NAGAI wrote:

Thanks for your quick reply! (BTW: is Hidetishi your first name?)

> From: Josef Wolf <(E-Mail Removed)>
> > I am pretty new to ruby, but I have used perl/Tk in my previous life
> > I can't find ruby's aequivalent to perl's Tk:ialogBox. I need to

>
> That is NOT a standard widget of Tcl/Tk.
> Probably, it is a perl/Tk specific one.
>
> I think that "Dialog" widget of BWidget extension is one of
> similar widgets. BWidget extension is written in pure Tcl/Tk.
> So, it is not difficult to install.
> Ruby/Tk supports BWidget extension by 'tkextlib/bwidget.rb'.


It looks as if it is already installed on my suse box. But I can't find
any documentation. I assume it is to be used similar to ruby/Tk?
Anyway, I'll go dive into it. Thanks again!

 
Reply With Quote
 
Josef Wolf
Guest
Posts: n/a
 
      09-03-2006
On Fri, Sep 01, 2006 at 03:00:34PM +0900, Josef Wolf wrote:
> On Fri, Sep 01, 2006 at 12:01:13PM +0900, Hidetoshi NAGAI wrote:
> > From: Josef Wolf <(E-Mail Removed)>
> > > I am pretty new to ruby, but I have used perl/Tk in my previous life
> > > I can't find ruby's aequivalent to perl's Tk:ialogBox. I need to

> >
> > That is NOT a standard widget of Tcl/Tk.
> > Probably, it is a perl/Tk specific one.
> >
> > I think that "Dialog" widget of BWidget extension is one of
> > similar widgets. BWidget extension is written in pure Tcl/Tk.
> > So, it is not difficult to install.
> > Ruby/Tk supports BWidget extension by 'tkextlib/bwidget.rb'.

>
> It looks as if it is already installed on my suse box. But I can't find
> any documentation. I assume it is to be used similar to ruby/Tk?
> Anyway, I'll go dive into it. Thanks again!


I can't figure out how to use this widget properly. I have two major
problems with it:

1. Tk::BWidget:ialog don't seem to have a "buttons" option? But
without a "buttons" option, options like "cancel", "default" and
"separator" don't really make sense, IMHO.

2. It's draw() method returns the id of the widget instead of an indication
which button was pressed.

This is what I do:

pressed=nil
dia=Tk::BWidget:ialog.new('parent'=>parent)
label=Tk::BWidget::LabelEntry.new('parent'=>dia, 'label'=>'Entity',
'text'=>'Hello').pack
TkButton.new(dia,'text'=>'OK',
'command'=>proc{dia.enddialog(dia); pressed="OK"}).pack
TkButton.new(dia,'text'=>'Cancel',
'command'=>proc{dia.enddialog(dia); pressed="Cancel"}).pack

dia.draw

Is it really meant to be used that way? I bet I am missing some very
important details, but I can't figure out what it is.

BTW: There seems to be one more widget set called iwidgets. Anybody knows
what it is?

 
Reply With Quote
 
Morton Goldberg
Guest
Posts: n/a
 
      09-04-2006
On Sep 3, 2006, at 8:50 AM, Josef Wolf wrote:

> BTW: There seems to be one more widget set called iwidgets.
> Anybody knows
> what it is?


The iwidget widget set is Ruby support for [incr Widgets]. You can
find documentation at <http://incrtcl.sourceforge.net/iwidgets/>.
This is Tk documentation, but the Ruby implementation seems to
follows it closely.

I have just began to experiment with [incr Widgets]. So far so good.
They are higher level than the basic Tk widgets and seem to easy to use.

Here is a list:

buttonbox
calendar
canvasprintbox
canvasprintdialog
checkbox
combobox
dateentry
datefield
dialog
dialogshell
disjointlistbox
entryfield
extbutton
extfileselectionbox
extfileselectiondialog
feedback
fileselectionbox
fileselectiondialog
finddialog
hierarchy
hyperhelp
labeledframe
labeledwidget
mainwindow
menubar
messagebox
messagedialog
notebook
optionmenu
panedwindow
promptdialog
pushbutton
radiobox
regexpfield
scrolledcanvas
scrolledframe
scrolledhtml
scrolledlistbox
scrolledtext
scrolledwidget
selectionbox
selectiondialog
shell
spindate
spinint
spinner
spintime
tabnotebook
tabset
timeentry
timefield
toolbar

Regards, Morton



 
Reply With Quote
 
Josef Wolf
Guest
Posts: n/a
 
      09-04-2006
On Mon, Sep 04, 2006 at 11:30:01AM +0900, Morton Goldberg wrote:

Thanks for your reply, Morton!

> >BTW: There seems to be one more widget set called iwidgets.
> > Anybody knows what it is?

>
> The iwidget widget set is Ruby support for [incr Widgets]. You can
> find documentation at <http://incrtcl.sourceforge.net/iwidgets/>.


This page mentions examples and tutorials, but I can't find them on
this site. A google search did not reveal anything useful, too. Could
you find anything useful?

> This is Tk documentation, but the Ruby implementation seems to
> follows it closely.
>
> I have just began to experiment with [incr Widgets]. So far so good.
> They are higher level than the basic Tk widgets and seem to easy to use.


Would you dare to share some examples how the ruby bindings are to be
used?

 
Reply With Quote
 
Hidetoshi NAGAI
Guest
Posts: n/a
 
      09-05-2006
From: Josef Wolf <(E-Mail Removed)>
Subject: Re: TkDialogBox missing?
Date: Sun, 3 Sep 2006 21:50:54 +0900
Message-ID: <(E-Mail Removed)>
> I can't figure out how to use this widget properly. I have two major
> problems with it:


Please run '<ruby-src>/ext/tk/sample/tkextlib/bwidget/demo.rb',
and see '<ruby-src>/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb'.

> 1. Tk::BWidget:ialog don't seem to have a "buttons" option? But
> without a "buttons" option, options like "cancel", "default" and
> "separator" don't really make sense, IMHO.


Use Tk::BWidget:ialog#add to add buttons.

> 2. It's draw() method returns the id of the widget instead of an indication
> which button was pressed.


Please see the next example.
---------------------------------------------------------------------
require 'tk'
require 'tkextlib/bwidget'

d = Tk::BWidget:ialog.new(:relative=>Tk.root, :modal=>:local,
:separator=>true, :title=>'Dialog Test',
:side=>:bottom, :anchor=>:c,
:default=>0, :cancel=>3)

d.add(:text=>'btn0', :command=>proc{d.enddialog('btn0 is pressed')})
d.add(:text=>'btn1', :command=>proc{d.enddialog('btn1 is pressed')})
d.add(:text=>'btn2') # use default cmd => return a string of the index number
d.add(:text=>'btn3', :command=>proc{d.enddialog('btn3 is pressed')})

p d.current_itemconfiginfo(0)

# f = d.get_frame
d.get_frame{|f|
TkLabel.new(f, :text=>'Here is a frame of the dialog').pack
TkLabel.new(f, :text=>'Please lay-out your widgets here.').pack
}

TkButton.new(:text=>'show dialog', :command=>proc{p d.draw}).pack

Tk.mainloop
---------------------------------------------------------------------

> BTW: There seems to be one more widget set called iwidgets. Anybody knows
> what it is?


If you can use "iwidgets", it may be enough for your purpose to imitate
'<ruby-src>/ext/tk/sample/tkextlib/iwidgets/sample/dialog.rb'.
If you want to install "iwidgets" ([incr Widgets]) from its source,
you have to compile it.
However, BWidgets doesn't need compile, because it witten in pure Tcl/Tk.
--
Hidetoshi NAGAI ((E-Mail Removed))

 
Reply With Quote
 
Morton Goldberg
Guest
Posts: n/a
 
      09-05-2006
On Sep 4, 2006, at 1:25 PM, Josef Wolf wrote:

> On Mon, Sep 04, 2006 at 11:30:01AM +0900, Morton Goldberg wrote:
>
> Thanks for your reply, Morton!
>
>>> BTW: There seems to be one more widget set called iwidgets.
>>> Anybody knows what it is?

>>
>> The iwidget widget set is Ruby support for [incr Widgets]. You can
>> find documentation at <http://incrtcl.sourceforge.net/iwidgets/>.

>
> This page mentions examples and tutorials, but I can't find them on
> this site. A google search did not reveal anything useful, too.
> Could
> you find anything useful?


Did you try clicking on any of the widget names in the sidebar? When
I click on the name of a widget, I get a tutorial with example code
for that widget. In the lower right corner of the tutorial is a set
of buttons that link to reference material for the given widget.
Altogether I think this the [incr Widgets] are pretty well
documented. I could wish Ruby/Tk were so well documented.

>> This is Tk documentation, but the Ruby implementation seems to
>> follows it closely.
>>
>> I have just began to experiment with [incr Widgets]. So far so good.
>> They are higher level than the basic Tk widgets and seem to easy
>> to use.

>
> Would you dare to share some examples how the ruby bindings are to be
> used?


I am new to both Ruby and Tk -- I have just started exploring, so I
don't have much to offer. All I have done (and only for a two of the
[incr Widgets]) is translate the web site's example code into Ruby/Tk
and probably not very elegantly. With that disclaimer in mind, do you
still want me to post my code?

Regards, Morton

 
Reply With Quote
 
Hidetoshi NAGAI
Guest
Posts: n/a
 
      09-05-2006
From: Morton Goldberg <(E-Mail Removed)>
Subject: Re: TkDialogBox missing?
Date: Tue, 5 Sep 2006 14:13:47 +0900
Message-ID: <(E-Mail Removed)>
> I am new to both Ruby and Tk -- I have just started exploring, so I
> don't have much to offer. All I have done (and only for a two of the
> [incr Widgets]) is translate the web site's example code into Ruby/Tk
> and probably not very elegantly. With that disclaimer in mind, do you
> still want me to post my code?


Do you have any requests for Iwidgets support of Ruby/Tk?
--
Hidetoshi NAGAI ((E-Mail Removed))

 
Reply With Quote
 
Morton Goldberg
Guest
Posts: n/a
 
      09-05-2006
On Sep 5, 2006, at 6:12 AM, Hidetoshi NAGAI wrote:

> From: Morton Goldberg <(E-Mail Removed)>
> Subject: Re: TkDialogBox missing?
> Date: Tue, 5 Sep 2006 14:13:47 +0900
> Message-ID: <(E-Mail Removed)>
>> I am new to both Ruby and Tk -- I have just started exploring, so I
>> don't have much to offer. All I have done (and only for a two of the
>> [incr Widgets]) is translate the web site's example code into Ruby/Tk
>> and probably not very elegantly. With that disclaimer in mind, do you
>> still want me to post my code?

>
> Do you have any requests for Iwidgets support of Ruby/Tk?
> --
> Hidetoshi NAGAI ((E-Mail Removed))


Not at this stage of my explorations. So far what little I've tried
seems to work much as I expected. I really haven't gotten in deep
enough so that anything I've done moves me to make a support request.
There are still many [incr Widgets] with which I need to become
familiar before I use them in a real application. When I reach the
stage of building a real application, I think then I might find
myself moved to request support, but not before.

But thank you for asking.

Regards, Morton



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments