1. Problem with columns

Hello



I have problem with seting up several columns in list to be line up 
corectly!

I get data from several DropDownLists and then I wish to put it in one 
list in several columns.
Example of list I wish to get:
          New York 345     555       light   big
          Paris    212     387       color   small
          Cairo    809     726       dark    average
           .        .       .         .       .
           .        .       .         .       .
           .        .       .         .       .


What I get in list is something like this:
          New York  345     555       light   big
          Paris    212    387       color   small
          Cairo   809      726        dark     average
           .        .        .        .        .
           .       .       .        .         .
           .         .       .        .       .
         
The columns are not line up corectly. I have tried couple of ways but I 
#+*?%!.
The closest corectly line up gives me this code:


for the first column:


   hti = getIndex(ddlist1)

   ht = getItem(ddlist1, hti)

   hte = getTextExtent(ddlist1, ht)

   while hte[1] < 60 do
        ht = ht & 32
        hte = getTextExtent(ddlist1, ht)
   end while

--
here come the same code for column 2,3,4,5 
--


   list_line = {ht & hr & ar & at & bp}
   addItem(list, list_line)





Any suggestion or idea will be very helpfull.


Best regards, Frank

new topic     » topic index » view message » categorize

2. Re: Problem with columns

I think that you're setting all the stuff on only one column... 

Best Regards,
   Guillermo BonvehĂ­

--- Frank <sekret7 at hotmail.com> wrote:
> 
> 
> Hello
> 
> 
> 
> I have problem with seting up several columns in list to be line up 
> corectly!
> 
> I get data from several DropDownLists and then I wish to put it in
> one 
> list in several columns.
> Example of list I wish to get:
>           New York 345     555       light   big
>           Paris    212     387       color   small
>           Cairo    809     726       dark    average
>            .        .       .         .       .
>            .        .       .         .       .
>            .        .       .         .       .
> 
> 
> What I get in list is something like this:
>           New York  345     555       light   big
>           Paris    212    387       color   small
>           Cairo   809      726        dark     average
>            .        .        .        .        .
>            .       .       .        .         .
>            .         .       .        .       .
>          
> The columns are not line up corectly. I have tried couple of ways but
> I 
> #+*?%!.
> The closest corectly line up gives me this code:
> 
> 
> for the first column:
> 
> 
>    hti = getIndex(ddlist1)
> 
>    ht = getItem(ddlist1, hti)
> 
>    hte = getTextExtent(ddlist1, ht)
> 
>    while hte[1] < 60 do
>         ht = ht & 32
>         hte = getTextExtent(ddlist1, ht)
>    end while
> 
> --
> here come the same code for column 2,3,4,5 
> --
> 
> 
>    list_line = {ht & hr & ar & at & bp}
>    addItem(list, list_line)
> 
> 
> 
> 
> 
> Any suggestion or idea will be very helpfull.
<snip>

> 
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: Problem with columns

How about using a Listview control . . .?

----- Original Message ----- 
From: "Frank" <sekret7 at hotmail.com>
To: "EUforum" <EUforum at topica.com>
Subject: Problem with columns


> 
> Hello
> 
> 
> 
> I have problem with seting up several columns in list to be line up 
> corectly!
> 
> I get data from several DropDownLists and then I wish to put it in one 
> list in several columns.
> Example of list I wish to get:
>           New York 345     555       light   big
>           Paris    212     387       color   small
>           Cairo    809     726       dark    average
>            .        .       .         .       .
>            .        .       .         .       .
>            .        .       .         .       .
> 
> 
> What I get in list is something like this:
>           New York  345     555       light   big
>           Paris    212    387       color   small
>           Cairo   809      726        dark     average
>            .        .        .        .        .
>            .       .       .        .         .
>            .         .       .        .       .
>          
> The columns are not line up corectly. I have tried couple of ways but I 
> #+*?%!.
> The closest corectly line up gives me this code:
> 
> 
> for the first column:
> 
> 
>    hti = getIndex(ddlist1)
> 
>    ht = getItem(ddlist1, hti)
> 
>    hte = getTextExtent(ddlist1, ht)
> 
>    while hte[1] < 60 do
>         ht = ht & 32
>         hte = getTextExtent(ddlist1, ht)
>    end while
> 
> --
> here come the same code for column 2,3,4,5 
> --
> 
> 
>    list_line = {ht & hr & ar & at & bp}
>    addItem(list, list_line)
> 
> 
> 
> 
> 
> Any suggestion or idea will be very helpfull.
> 
<snip>

new topic     » goto parent     » topic index » view message » categorize

4. Re: Problem with columns

I had that problem -- getting columns to line up in a list box (or combo
box).  You probably could use a listview, but maybe that should wait until
the next edition of win32lib where (I assume) listview will be debugged.
  The solution I used was to pick a font that has the same width for every
character.  For example 'w' and 'i' have the same width.  Then assign a
specific number of characters to each column.  Maybe write a function that
pads or shortens a string to the correct length.

       Jerry Story

new topic     » goto parent     » topic index » view message » categorize

5. Re: Problem with columns

On Thursday 21 June 2001 01:09, Frankwrote:

> I have problem with seting up several columns in list to be line up
> corectly!

You've been given the correct advice by others: 
use a fixed width font and pad the strings.

If you have a problem and need some working code, I can 
send you the appropriate functions.

Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

6. Re: Problem with columns

Hello


Guys, I try yours sugestions and I decide to get font with the same 
width for all char.
The only font I found  with the same width is Courier.
Is there more fonts with same width?


Irv, I will be glad if you send me the code, so I can try some more
different approach to the problem. Thanks!



Best regards, Frank

new topic     » goto parent     » topic index » view message » categorize

7. Re: Problem with columns


new topic     » goto parent     » topic index » view message » categorize

8. Re: Problem with columns

>Hello
>
>
>Guys, I try yours sugestions and I decide to get font with the same
>width for all char.
>The only font I found  with the same width is Courier.
>Is there more fonts with same width?

Courier New is a good true-type font that has a fixed width.  Others are 
fixedsys and terminal (which, from my experiences, doesn't work with 
win32lib).  Courier New is the best one to use because everyone has it, 
which isn't the case for some other fonts.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Problem with columns

On Friday 22 June 2001 01:18 am, Frank wrote:

> Irv, I will be glad if you send me the code, so I can try some more
> different approach to the problem. Thanks!

Sure, but my solution isn't a 'different' one.
I'm just using a fixed font and formatting 
items so they'll line up:

procedure LoadListBox(sequence list)
 setFont(CustListBox,"Courier",8,0)
 eraseItems(CustListBox)

 for i = 1 to length(list) do
   addItem(CustListBox,sprintf("%6d %-35s %s",
                 {list[i][custCode],
    	  list[i][custName],
	  list[i][custPhone]}))
 end for
end procedure

sprintf() takes care of padding things and aligning
left or right as needed. 

I previously tried sending tabs between each item,
but that didn't work properly, not even with a fixed 
font. As far as I know, there's no way to get a 
proportional font to line up in neat columns, 
except perhaps by using a listview control. 

Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

10. Re: Problem with columns

>   I had that problem -- getting columns to line up in a list box (or combo
> box).  You probably could use a listview, but maybe that should wait until
> the next edition of win32lib where (I assume) listview will be debugged.
>   The solution I used was to pick a font that has the same width for every
> character.  For example 'w' and 'i' have the same width.  Then assign a
> specific number of characters to each column.  Maybe write a function that
> pads or shortens a string to the correct length.
>
>        Jerry Story

You can have a look at mailer.zip in Recent User Contrib, where I am doing
addressbook this way. Using ListViews gives a better look, but you must
store index returned by addLVitem and then when using getIndex or deleteItem
refer to this index.

    Martin

new topic     » goto parent     » topic index » view message » categorize

11. Re: Problem with columns

> martin.stachon at worldonline.cz wrote:
> >Using ListViews gives a better look, but you must
> > store index returned by addLVitem and then when using getIndex or 
> > deleteItem
> > refer to this index.
> > 
> Martin,
> 
> I don't know how you're using list views but I have never found a need 
> to store the index returned by addLVItem.  Usually I allow the user to 
> double-click or click-then-press-a-button to select an entry from a list 
> view.  You would get the index selected by using getLVSelected.  
> 
> Jonas
> 
Hi Jonas,

With deleteItem() you must refer to index returned by addLVitem.
In my program, LV refers to a data stored in sequence. Each entry
has stored its LV index returned by addLVitem. If user selected
an entry from LV and want to know which item of sequence it 
refers to, I compare index returned by getIndex() with indexes
stored in sequence. (The program is Euphoria E-mail client)
and it works fine.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu