[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dialog and large selection lists

From: Peter Hansson
Subject: Re: Dialog and large selection lists
Date: Tue, 18 Dec 2012 04:39:21 -0800 (PST)

----- Original Message -----
> From: Michael D. Setzer II <address@hidden>
> To: Peter Hansson <address@hidden>; "address@hidden" <address@hidden>
> Cc: 
> Sent: Tuesday, December 18, 2012 12:18 PM
> Subject: Re: Dialog and large selection lists
> On 14 Dec 2012 at 3:30, Peter Hansson wrote:
> Date sent:    Fri, 14 Dec 2012 03:30:18 -0800 (PST)
> From:    Peter Hansson <address@hidden>
> Subject:    Dialog and large selection lists
> To:    "address@hidden" <address@hidden>
> Send reply to:    Peter Hansson <address@hidden>
>     the GNU implementation of curses" <bug-ncurses.gnu.org>
>     <mailto:address@hidden>
>     <mailto:address@hidden>
>>  Hi,
>>  I'm trying to use Dialog for some rather large selection lists (in the
>>  range 20-100 items). User must select one and one only of these items.
>>  For this purpose I'm using the menu widget.
>>  Some things I cannot get my head around:
>>  - How can I control the width of the tag within the box. It seems to
>>  me that if Dialog cannot fit the text (i.e. tag-text + item-text) it
>>  starts chopping the tag-text. This seems unnatural to me. Why not chop
>>  the item-text?  The tag text is the unique identifier of each line in
>>  the box, right?
>>  - Can I turn off the hotkey feature?  My selections have many, many
>>  choices that all start with the same letter, so the hotkey feature
>>  will be confusing to the user.
>>  - I need to add some kind of table heading. This is not a problem per
>>  se as I can use the menu text for that. But how do I align it with the
>>  contents of the menu box itself. I don't have control over the actual
>>  placement of the text inside the menu box and hence I cannot align the
>>  text a the top (the header) with what is inside.
>>  I hope you can assist with some good ideas on this.
>>  Thx.
>>  Peter
> Perhaps I am not getting what you want, but just did a little test
> using the file names in a directory as the input for the list.
> #!/bin/bash
> echo "dialog --radiolist \"text\" 0 0 0 \\" 
>> testdialog
> for a in `ls | grep -v \ | grep -v \&`
> do
>   echo $a "select" "off" \\  >>testdialog
> done
> echo "2>result.out" >>testdialog
> gedit testdialog
> ./testdialog
> gedit result.out
> This creates the testdialog script that contains over 500+ lines in
> the directory I used. Had issues with filenames with " "'s or 
> &'s in
> them, so filtered those out. Just used select as the second text,
> and set all to off.
> When it runs the testdialog script, it shows all the file names, and I
> can select the one I want, and the result is placed in the result.out
> file.
> What form do you have the 20-100 items, and do they have
> spaces or special characters.


My issues with using Dialog for large selection lists are tied to the three 
topics I mention in the original posting:
1. The tag text gets chopped off 
2. Turning off the hotkey feature
3. Table heading is close to impossible to do.

See THomas Dickey's reply to my original posting.

Let's as an example suppose the input looks like this:

"My text 1"   "Col1     Col2    Col3"
"My text 2"   "Col1     Col2    Col3"
"My text 3"   "Col1     Col2    Col3"

The problems are
1. When there's not enough screen width available Dialog will start chopping 
not only from the item-text 
but also from the tag-text. I understand that Dialog has to do *something* in 
this case but to me it 
never makes sense to start chopping the tag-text, only the item-text.

2. Hotkey feature becomes a disturbance to the user if many (or all) of the 
items have the same initial letter.
In the example above they all start with the letter 'M' and having a hotkey for 
that would seem pretty disturbing.
Currently there's no way to turn the hotkey feature off.

3. How would you create a table header for the example above ? Problem is that 
you will have to mimic
Dialog's algorithm for positioning and chopping of the two text elements - in 
other words it becomes difficult 
if not impossible to align a header with the actual contents.

So I agree that perhaps my subject line is not the best. The problem has not so 
much to do with large 
selection lists (which as you point out can be done) but more with selection 
lists that are wide, auto-generated 
and where you want a columnar format. But in fact your example - list of files 
- fits the bill pretty well. You
would also run into these issues.

Hope that explained it in more detail.


> +----------------------------------------------------------+
>   Michael D. Setzer II -  Computer Science Instructor
>   Guam Community College  Computer Center
>   mailto:address@hidden
>   mailto:address@hidden
>   http://www.guam.net/home/mikes
>   Guam - Where America's Day Begins
>   G4L Disk Imaging Project maintainer
>   http://sourceforge.net/projects/g4l/
> +----------------------------------------------------------+
> http://setiathome.berkeley.edu (Original)
> Number of Seti Units Returned:  19,471
> Processing time:  32 years, 290 days, 12 hours, 58 minutes
> (Total Hours: 287,489)
> address@hidden CREDITS
> SETI        13471758.391615   |   EINSTEIN     9375439.209852
> ROSETTA      5601813.107505   |   ABC         15592097.439004

reply via email to

[Prev in Thread] Current Thread [Next in Thread]