logo       

RE: [ANN:] Tk-LineNumberText v0.5: msg#00023

Subject: RE: [ANN:] Tk-LineNumberText v0.5
> -----Original Message-----
> From: owner-ptk@xxxxxxxxxxxxxxxxxx 
> [mailto:owner-ptk@xxxxxxxxxxxxxxxxxx] On Behalf Of Dean Arnold
> Sent: November 16, 2004 10:15 AM
> To: Jack D.
> Cc: ptk@xxxxxxxxxxxxxxxxxx
> Subject: Re: [ANN:] Tk-LineNumberText v0.5
> 
> Glad to see the update; alas, I've got some issues (see 
> example script below) (Running on WinXP, AS Perl 5.8.3, Tk 804.027)
> 
> 1) Nit to pick: the POD lists add/deletebookmarks() (plural), 
> but the actual functions are singular add/deletebookmark().

Oops - Do you think I should fix the POD and put out a 0.51 ?

> 
> 2) I can't get bookmarks to display; do you see anything 
> wrong with the script below ?

You cannot bookmark a blank line. (yet?!) This is clearly documented. If you
are bookmarking interactively , you will get a warning if you try to do
this. Programmatically however, I just fail quietly with no warnings. So,
you must instead ensure that the line you intend to bookmark contains at
least 1 character. See fix below.

> 
> 3) Whence image decorations ? Is there anyway to generate a 
> Pixmap/Photo image, and use it for the bookmark image ?
> (I assume bookmarks are the intended replacement for decorations ?)

Image support will be in v0.6. This update was long overdue as it was - and
I just took the easy route for now - hence - the three shapes. Simply by
switching to the Canvas - I have increased flexibility for expansion and
images will be quite simple to implement.

> 
> 4) Another nit: any chance you could include a demo in the bundle ?

Again - I took the easy route here. I am still having problems with my
CursorControl demo. Until I fix *that* - I did not want to attempt another
*failed* demo. I think I finally figured out it has to do with name clashes
of subroutines amongst the various other modules. I wanted to chat with
Steve about this before I tried to fix it again.

> (Feel free to use my tiny example below, assuming we can get 
> bookmarks working)
> 
> Thanks,
> Dean Arnold
> Presicient Corp.
> 
> 
>     use Tk;
>     use Tk::LineNumberText;
> 
>     my $mw=tkinit;
> 
> 
>     my $lntext = $mw->LineNumberText('Text',
>       -wrap=>'word',
>       -font=>['Courier',12],
>       -linenumfont=>['Courier',12],
>       -linenumbg => 'white',
>       -linenumalign => 'left',
>       -bookmarkfill => 'red',
>       -bookmarkshape => 'circle',
> #     -bookmarkstipple => 'gray50',
>       -curlinehighlight=>'both',
>       -allowbookmarks => 1,
>       -bg=>'white')->pack(-fill=>'both', -expand=>1);
> 
>       my $btns = $mw->Frame()->pack();
>       
>       $btns->Button(-text => 'Set Bookmark',
>               -command => \&set_bookmark)->pack();
> 
>       $lntext->insert('end', "
> This is the time for all good men to
> come to the aid of their country.
> 
> We need to support some kind of decoration other than just a 
> fixed shape...what happened to the decorate/undecorate i/f's ?
> 
> ");
> 
>     MainLoop;
> #
> #     POD has error: addbookmark() is NOT plural
> #

sub set_bookmark {
   my $rtext = $lntext->Subwidget('scrolled');
   my ($search) = split(/\./, $rtext->search('-regexp','-nocase','--',"We
need", '1.0', 'end'));
   return unless $search;
   print "Adding bookmark at $search\n";
   $lntext->addbookmark($search);
}

In doing this - I have found that the 'search' method didn't work as
advertised with the $lntext. I'm not sure why? It kept returning 8 no matter
what I put in. This is indeed the type of bug I need to find out. This is
also the reason I advertised ALL the widgets - so you have complete control
over the methods and look/feel.

For the "search" method - you have to use Subwidget to get the "real" text
widget. But you have to remember that the lines will not update if you go
directly to the real text widget method. So - again - I did a CYA by
providing a public method to force a line update "if" you need it. Here you
don't because the addbookmark method did it for you.

> sub set_bookmark {
>       my ($curline, $curpos) = split(/\./, $lntext->index('insert'));
>       print "Adding bookmark at $curline\n";
>       $lntext->addbookmark($curline);
> }
> 

Jack
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@xxxxxxxxxxxxxxxxxx



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe