listbox, a Tlistbox, and new widgets 
Author Message
 listbox, a Tlistbox, and new widgets

I have an interface I am trying to build using multiple listboxes
displayed at the same time, and I would like to have the elements that
are "selected" in one stay selected when elements in another
are selected. It seems that only one listbox can have "selected" elements
at one time. I understand why this is since what  is selected is
also put into the X-selection, so also when another application
claims the X-selection then all the elements are deselected.  It would
be really neat if there was some other way of marking elements
in a listbox. The active tag can be helpful, but it is only highlighted
when the listbox has keyboard focus.

I looked through some previous messages on this mailiing list and noticed
that Nick had mentioned Tlistbox when some people had been
asking about marking elements in a listbox with different colors.

Quote:
>I have very nearly writen Tlistbox several times now, it would use
>Text as actual widget but by backward compatible with Listbox methods
>and bindings. This would allow tags for colour and hyper-links etc.

>Till someone writes it use Text instead.

Has anybody written such a thing ?

Actually, I have been wondering recently how
hard is it to write a pTk widget. I would really like to try and
do that someday, but I don't really know how to start.  From
looking through the code i see that it is all Xlib based, ie no Xt.
I know most of Xlib, Xt  and heavily use and understand perl5, but
not very much tcl. Is there any documentation on the internals of
pTk, and is this incredibly hard ? If it isn't extermely hard to write
your own widget, then I can already think of some Xt, and Motif
widgets that would be really cool to port.

Bruno

--




Sun, 06 Sep 1998 03:00:00 GMT  
 listbox, a Tlistbox, and new widgets
Bruno White writes on 20-MAR-1996 14:55:21.06:

Quote:
>I have an interface I am trying to build using multiple listboxes
>displayed at the same time, and I would like to have the elements that
>are "selected" in one stay selected when elements in another
>are selected. It seems that only one listbox can have "selected" elements
>at one time. I understand why this is since what  is selected is
>also put into the X-selection, so also when another application
>claims the X-selection then all the elements are deselected.  It would
>be really neat if there was some other way of marking elements
>in a listbox. The active tag can be helpful, but it is only highlighted
>when the listbox has keyboard focus.

Since you ask for "marking" I would think that the

  -exportselection => 0

configuration option would be the thing you are looking for. It will allow one
Listbox to appear to have an item selected (highlight remains) but actual
listbox selection can be taking place in another. This was discussed in:

  http://w4.lns.cornell.edu/~pvhp/ptk/qna9.11.html

Quote:
>Has anybody written such a thing ?

The TListbox? I do not know.

Quote:
>Actually, I have been wondering recently how
>hard is it to write a pTk widget. I would really like to try and
>do that someday, but I don't really know how to start.  From
>looking through the code i see that it is all Xlib based, ie no Xt.
>I know most of Xlib, Xt  and heavily use and understand perl5, but
>not very much tcl. Is there any documentation on the internals of
>pTk, and is this incredibly hard ? If it isn't extermely hard to write
>your own widget, then I can already think of some Xt, and Motif
>widgets that would be really cool to port.

Writing widgets in pure perl can be relatively straightforward. In fact the
Dial.pm widget is a prime example of such a thing. It is nowadays distributed
with the Tk-b*.tar.gz distribution in the contrib directory. Of course there
are plenty of examples of perl widgets all over the Tk-b* directory tree too.
Don't be intimidated by the .xs or .c code: look at all the .pl and .pm files
for examples of pure perl widget coding.

On the other hand if you really want to start with Xt - well have a good long
look at perlxs(1) and perlxstut(1) ...

Peter Prymmer

--




Mon, 07 Sep 1998 03:00:00 GMT  
 listbox, a Tlistbox, and new widgets

Quote:

> I have an interface I am trying to build using multiple listboxes
> displayed at the same time, and I would like to have the elements that
> are "selected" in one stay selected when elements in another
> are selected. It seems that only one listbox can have "selected" elements
> at one time. I understand why this is since what  is selected is
> also put into the X-selection, so also when another application
> claims the X-selection then all the elements are deselected.  It would
> be really neat if there was some other way of marking elements
> in a listbox. The active tag can be helpful, but it is only highlighted
> when the listbox has keyboard focus.

If you don't need the selected element to be the current X selection,
you can say -exportselection => 0 on the Listbox call.  The tkperl
gizmo I use to manage my backups does this, and it works fine.

Paul Allen
--
Paul L. Allen           | voice: (206) 865-3297  fax: (206) 865-2964

Boeing ISS Research & Technology, POB 24346 M/S 7L-68, Seattle, WA 98124

--




Mon, 07 Sep 1998 03:00:00 GMT  
 listbox, a Tlistbox, and new widgets
davis_morry writes on 22-MAR-1996 09:57:25.74:

Quote:
>Is this a dumb question?
>The http://w4.lns.cornell.edu/~pvhp/ptk/doc is great but why do all the links
>just display as plain text?

Not a dumb question at all!

(Indeed I am CCing to the mail list to let other folks know what happened.)

It seems we're kind of stuck with a new version of the same problem as the
Tk-b9 (and previous) versions. Those kits were distributed with *.ht
files, the new kit is distributed with *.htm files (I hope that by official
release time they will be *.html filenames!)

Quote:
>PS: I changed my .mime.types to include .htm

This was not necessary! You are free to do with your browser as you please, of
course, but please note that the problem with
http://w4.lns.cornell.edu/~pvhp/ptk/doc/ was entirely my fault.

I was under the mistaken impression that our web-server was setup to recognize
the .htm extension as mime type text/html - it is not. For a web browser to
work (via http as opposed to local access) it needs to receive a line that  
would look like the output from a perl script like:
     print "Content-type: text/html\n\n";
from the server. Most unix servers (that I am familiar with at least) have a
configuration file that tells the server what to do with a file *based on the
file name extension* The _default_ for our server is
     print "Content-type: text/plain\n\n";
which includes any filetypes the server does not recognize. As I said I was
under the wrong impression that we were set up for .htm and .html files.
(Indeed, one solution would be to change the server configuration files - I did
 not do this, however.)

Handling filetypes based on the final part of the name is indeed frought with
difficulty as we who have attempted to browse the ptk/doc/ directory all now
know (although it is quicker than stating the file!). I must apologize for
this as I had in fact tested it: I used a browser, and poked into the
directory, successfully followed some links and was happy. I do not know why
it worked for me but I do know that I unlike all the rest of you am the owner
of those files (though this still shouldn't matter as I am not running the
web-server under my uid!?)

I have now run the files through an updated version of Mark Elston's cvtht
script (I called it cvthtm & as soon as I clean up the code I'll post it.)
Have a look now and please advise of any trouble.

Simon Galton writes on 22-MAR-1996 08:29:39.39:


!>
!> OK folks on the list - here is something related (not completely different):
!> The Tk-b10-tobe doc set is now on the web at:
!>
!>   http://w4.lns.cornell.edu/~pvhp/ptk/doc/
!
!I tried many of the items in this index and they all error with:
!
!File Not found
!
!The requested URL /~pvhp/ptk/doc/ConfigWidg.html was not found on this server.
!                                 ^^^^^^^^^^^^^^^
!                                       \_______this obviously depends on the
!                                               name of the item selected...

That one in particular had a name change. Try:

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

There is still trouble with the markup in the *.htm files. For example,
this one from label.htm (aka label.html):

 <H2><A NAME=Section1>WIDGET-SPECIFIC OPTIONS</A></H2>

That should be:

 <H2><A NAME="Section1">WIDGET-SPECIFIC OPTIONS</A></H2>
             ^        ^
             with quotation marks

Apologies to all, thanks to those who pointed out the difficulty & an open
invitation to anyone who can find more trouble.

Peter Prymmer

--




Wed, 09 Sep 1998 03:00:00 GMT  
 listbox, a Tlistbox, and new widgets

On Fri, 22 Mar 1996 20:45:59 -0500 (EST)

Quote:

>davis_morry writes on 22-MAR-1996 09:57:25.74:

>>Is this a dumb question?
>>The http://w4.lns.cornell.edu/~pvhp/ptk/doc is great but why do all the links
>>just display as plain text?

>Not a dumb question at all!

>(Indeed I am CCing to the mail list to let other folks know what happened.)

>It seems we're kind of stuck with a new version of the same problem as the
>Tk-b9 (and previous) versions. Those kits were distributed with *.ht
>files, the new kit is distributed with *.htm files (I hope that by official
>release time they will be *.html filenames!)

The reason for .ht and now .htm is that otherwise names get longer than
14 chars and some older UNIX machines cannot load the Tk distribution.

I will _stay_ with .htm which is widespread extension on DOS-ish machines,
unless someone can convince me otherwise.

Quote:

>>PS: I changed my .mime.types to include .htm

>This was not necessary! You are free to do with your browser as you please, of
>course, but please note that the problem with
>http://w4.lns.cornell.edu/~pvhp/ptk/doc/ was entirely my fault.

>I was under the mistaken impression that our web-server was setup to recognize
>the .htm extension as mime type text/html - it is not. For a web browser to
>work (via http as opposed to local access) it needs to receive a line that  
>would look like the output from a perl script like:
>     print "Content-type: text/html\n\n";
>from the server. Most unix servers (that I am familiar with at least) have a
>configuration file that tells the server what to do with a file *based on the
>file name extension* The _default_ for our server is
>     print "Content-type: text/plain\n\n";
>which includes any filetypes the server does not recognize. As I said I was
>under the wrong impression that we were set up for .htm and .html files.
>(Indeed, one solution would be to change the server configuration files - I did
> not do this, however.)

>Handling filetypes based on the final part of the name is indeed frought with
>difficulty as we who have attempted to browse the ptk/doc/ directory all now
>know (although it is quicker than stating the file!). I must apologize for
>this as I had in fact tested it: I used a browser, and poked into the
>directory, successfully followed some links and was happy. I do not know why
>it worked for me but I do know that I unlike all the rest of you am the owner
>of those files (though this still shouldn't matter as I am not running the
>web-server under my uid!?)

_My_ (UNIX) netscape is set (somehow I did not do it) to see files as
distributed as HTML. Mosaic needed the <HTML> which is now at top of all the
files. tkweb has type intuited by LWP, and also looks for <HTML>.

--




Sat, 19 Sep 1998 03:00:00 GMT  
 listbox, a Tlistbox, and new widgets
Nick Ing-Simmons writes on 2-APR-1996 04:33:41.76:

Quote:
>The reason for .ht and now .htm is that otherwise names get longer than
>14 chars and some older UNIX machines cannot load the Tk distribution.

>I will _stay_ with .htm which is widespread extension on DOS-ish machines,
>unless someone can convince me otherwise.

Fair enough. For reasons that remain a mystery to me (is it widespread use of
DOS-like editors?) a great many NT web servers do use *.htm as their html file
extension. For that reason(?), our web-server (w4.lns.cornell.edu) has just
recently been re-configured to serve up .htm as the text/html mime type (in
addition to .html).

Quote:
>>this as I had in fact tested it: I used a browser, and poked into the
>>directory, successfully followed some links and was happy. I do not know why

>_My_ (UNIX) netscape is set (somehow I did not do it) to see files as
>distributed as HTML. Mosaic needed the <HTML> which is now at top of all the
>files. tkweb has type intuited by LWP, and also looks for <HTML>.

It turns out that since I was using xmosaic 2.6 - and _it_ decided I was
browsing an html file - my initial test failed to turn up the problem. This is
apparently a bug|feature of xmosaic.

BTW I have only just started using tkweb - I like it! :-)

Peter Prymmer

--




Sat, 19 Sep 1998 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. New Win32-style Drop-down Listbox widget

2. Curses::Widgets::ListBox - Problem with ->input

3. Curses::Widgets::ListBox - Problem with input

4. get function for listbox widget

5. bind Ev problem with listbox widget

6. Listbox and Text widget questions

7. widgets in listbox?

8. Colorizing entries in a ListBox widget

9. Text color in my scrolled->Listbox widget

10. Dropdown Listbox widget

11. Drag and Drop to same listbox widget

12. Click event on ListBox widget

 

 
Powered by phpBB® Forum Software