From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Daniel Burgaud
Sent: December-08-08 12:33 AM
To: Perl-Win32-Users
Subject: Q on TK popups


Hi,

I have a Scrolled Text wherein, each line is binded to a popup

        $frames{'name-r'}->tag( 'bind', "A$i", '<Double-1>'  => sub {
&displayRecord($i) } );

I have been trying to use messageBox, Dialog and Balloon.

* The problem with messageBox is that I could not configure the font of the
message.

* The problem with Dialog is that it wraps the word to a new line even if
the dialog window
is wide enough to contain twice the length of the message thus ruining the
display.

* The problem with Balloon however is that, it is difficult to control when
it should show up.
Currently, the Balloon is defined to show for the whole $frames{'name-r'}
which therefore,
would show even if the cursor isnt on top of the desired line (ie, it is
displaying info for Line1
when cursor is already at Line3 or the scrolled text).

My questions are:
1. Is there a way to configure font for messageBox? or
2. Is there a way to prevent Dialog from truncating the message into a new
line? or
3. Is it possible to attach a Balloon to a particular line within the
scrolled text? 
ie, it will popup only when mouseover a particular line and will unpop when
un-mouseover
instead of having the balloon attached to the whole scrolled text widget.

4. Or is there a different function that can solve the above?

#####################################
As a general rule I rarely ever use messageBox. It is actually a 'method'
that creates a Dialog every time you use it. It will be the cause of
increased memory if you call it often enough.

Dialog is a subwidget of Dialogbox. As such you can use the Subwidget method
to get the "Advertised" label and change the wraplength. If you change it to
a zero then the Dialog will only wrap the text at a newline which I'm
assuming you can control. If you don't have control over the newline
character - then you can increase the wraplength using the same method. It
defaults to 3 inches ('3i')

Here is an example:

use Tk;
use Tk::Dialog;
use strict;

my $mw=tkinit;
my $d=$mw->Dialog(-title=>'Test Dialog',
  -text => "A very long string"x10,
  -bitmap=>'info');
my $label = $d->Subwidget('message');
$label->configure(-wraplength=>0);
$d->Show;
MainLoop;
__END__

As for using a Balloon - I'm sure you could use the -postcommand or
-motioncommand options to decide whether or not to display a balloon
depending on the line number your mouse is over.

Jack
#####################################

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to