Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tk::HList options and Tk_GetPixels

55 views
Skip to first unread message

Rudi Farkas

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
Hi all, 2 questions

1. Using Tk::HList, I'd like to parametrize the dashed-line rectangle that
surrounds the selected line
- replace it by a 1-pixel solid rectangle
- limit it's horizontal extent to the text width
- maybe replace it by a '3D' rectangle as seen in the main window of the
Widget demo (when you hover over lines in the ROText window).
Are there documented, undocumented or hidden options for this, or can I
tweak the perl code and where?

2. from HList.pod and Widget.pod ...
>Switch: -selectborderwidth
>Specifies a non-negative value indicating the width of the 3-D border to
draw around selected items.
>The value may have any of the forms acceptable to Tk_GetPixels ... such as
``2.0c'' or ``1i''.
Please point me to the Tk_GetPixels doc or explain ``2.0c'' or ``1i''.
Looks like 'c' is 'character', and a plain number is pixels, right?

Thank you, Rudi


==========================================================================
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 majo...@lists.stanford.edu

Slaven Rezic

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
"Rudi Farkas" <rudolf...@lecroy.com> writes:

>
> Hi all, 2 questions
>
> 1. Using Tk::HList, I'd like to parametrize the dashed-line rectangle that
> surrounds the selected line
> - replace it by a 1-pixel solid rectangle
> - limit it's horizontal extent to the text width
> - maybe replace it by a '3D' rectangle as seen in the main window of the
> Widget demo (when you hover over lines in the ROText window).
> Are there documented, undocumented or hidden options for this, or can I
> tweak the perl code and where?

Tk::Hlist is written in C, so there is no easy solution, I fear.



> 2. from HList.pod and Widget.pod ...
> >Switch: -selectborderwidth
> >Specifies a non-negative value indicating the width of the 3-D border to
> draw around selected items.
> >The value may have any of the forms acceptable to Tk_GetPixels ... such as
> ``2.0c'' or ``1i''.
> Please point me to the Tk_GetPixels doc or explain ``2.0c'' or ``1i''.
> Looks like 'c' is 'character', and a plain number is pixels, right?

If you have Tcl/Tk installed, you can say "man Tk_GetPixels". "c"
means "centimeters", i "inches".

Regards,
Slaven

--
use Tk;$c=tkinit->Canvas->pack;$x=45;for(split/_/,'KPI1_+09IPK_K;-OA1_+K!;A__1;
Q!7G_1+QK_3CLPI90,_+K!;A_+1!KQ!.N_K+1Q!.F_1+KN.Q__1+KN._K+1Q!.F_1+KN.Q_+1Q__+1!
KQ!.N_1;Q!7G_K3,09Q_+1!K.Q_K+1Q!.F_1+KN.Q'){s/\n//g;for(split/!/){$c->create(
'line',map{$a=-43+ord;($x+($a>>3)*2,123+($a&7)*2)}split//)}$x+=12}MainLoop

Collin Starkweather

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
> 2. from HList.pod and Widget.pod ...
> >Switch: -selectborderwidth
> >Specifies a non-negative value indicating the width of the 3-D border to
> draw around selected items.
> >The value may have any of the forms acceptable to Tk_GetPixels ... such as
> ``2.0c'' or ``1i''.
> Please point me to the Tk_GetPixels doc or explain ``2.0c'' or ``1i''.
> Looks like 'c' is 'character', and a plain number is pixels, right?

And to complement Slaven Rezic's response, you can see docs on
Tk_GetPixels at

http://w4.lns.cornell.edu/~pvhp/ptk/doc/GetPixels.htm

which can be found at the index from

http://w4.lns.cornell.edu/~pvhp/ptk/doc

an excellent Tk reference. I've never used it, but it appears to be
part of the Tk C library.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Collin Starkweather (303) 492-4784
University of Colorado collin.st...@colorado.edu
Department of Economics http://ucsu.colorado.edu/~olsonco
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>
> Thank you, Rudi

Rudi Farkas

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
Hi Stephen

you wrote
> The dashed line is the anchor, which is not the same as the selection.
> I usually get rid of the anchor using $hlist->anchorClear(). That
> leaves the selection whose appearance you can control with the
> options like -selectborderwidth.
> -wideselection looks as though it might be of use to you - the
> highlight is then only as wide as the text

That's exactly what I needed. Thank you twice.

Adding $hlist->anchorClear() in both the -browsecmd and the -command subs,
I got rid of the unsightly anchor completely.
Adding the -wideselection also worked as you said. Except that in HList I
have
-itemtype => 'imagetext', and with -wideselection the image is still
included with the
text in the highlighted area.

I should have found $hlist->anchorClear(), it is documented in HList.pod.
But where did you find out about -wideselection? I grepped for it in all
*.pm *.pod *.pl
files on my machine: nothing. Should I look into the C source code?
Do you know of other hidden features?

Best regards

Stephen Kun

unread,
May 20, 1999, 3:00:00 AM5/20/99
to
Rudi Farkas wrote:
>
> Hi Stephen
>
> you wrote
> > The dashed line is the anchor, which is not the same as the selection.
> > I usually get rid of the anchor using $hlist->anchorClear(). That
> > leaves the selection whose appearance you can control with the
> > options like -selectborderwidth.
> > -wideselection looks as though it might be of use to you - the
> > highlight is then only as wide as the text
>
> That's exactly what I needed. Thank you twice.
>
> Adding $hlist->anchorClear() in both the -browsecmd and the -command subs,
> I got rid of the unsightly anchor completely.
> Adding the -wideselection also worked as you said. Except that in HList I
> have
> -itemtype => 'imagetext', and with -wideselection the image is still
> included with the
> text in the highlighted area.

You could try using the 'indicator' to show your image. Then only
the text is highlighted. But you may come across other difficulties
doing that.

> I should have found $hlist->anchorClear(), it is documented in HList.pod.
> But where did you find out about -wideselection? I grepped for it in all
> *.pm *.pod *.pl
> files on my machine: nothing. Should I look into the C source code?
> Do you know of other hidden features?

The C files are in the pTk directory in the Tk source package.
In tixHList.c, look at the structure:
static Tk_ConfigSpec configSpecs[] = {
...
}

All the options that HList understands are there.
I think other widgets have the same structure too - it sometimes
useful to look in there for undocumented options.

--
----------------------------------------------------------------------
Stephen Kun Email: steph...@is.gaertner.de
Kurzekampstr. 10 Tel: +49 531 237 13 88 (work/fax)
38104 Braunschweig, Tel: +49 531 37 37 28 (private)
Germany Web Site: http://www.transeda.com

Rudi Farkas

unread,
May 20, 1999, 3:00:00 AM5/20/99
to
It looks like the pTk C-source files are a mine of useful information, that
should find it's way into perl/Tk docs. If someone could make a
summer-student project out of it ...
Rudi

sol0

unread,
May 20, 1999, 3:00:00 AM5/20/99
to

> The C files are in the pTk directory in the Tk source package.
> In tixHList.c, look at the structure:
> static Tk_ConfigSpec configSpecs[] = {

anchorClear() and friends are all documented in the man page (Tk::HList)
and the pocket ref.

0 new messages