1. ListViews In Reverse

Hi everyone,

I was wondering if anyone knew a way to make a ListView add each new 
line to the bottom instead of putting each new item at the top (or 
possibly to keep things in numerical order according to what is in the 
first column...?).  I'm working on a payroll program for our contractors 
here, and we enter the information right off their paysheets, but it is 
displayed in reverse order in the program.  I ended up rearranging 
things myself, and it works pretty well...unless you delete something 
and add another entry.  Here is the code I used to display the data 
properly:            

count = getCount(ListView28)
lv3 = {}
lv3 = repeat(0, count)
lParams = repeat(0, count + 1)
for i = 1 to count do
    lv3[i] = getItem(ListView28, i)
end for
eraseItems(ListView28)
lParams[1] = addLVItem(ListView28, closefolder, lv1[1..4])
for j = 1 to count do--count to 1 by -1 do
  if length(lv3[j]) > 0 then     --need this to keep from crashing
    lParams[j + 1] = addLVItem(ListView28, closefolder, lv3 [j].4])
  else
    junk = message_box("Omitting item ",
    "Info", MB_ICONINFORMATION + MB_TASKMODAL)                    
  end if
end for

The "if length(lv3[j]) > 0 then" statement keeps the program from 
crashing, but it also deletes the entry at the top of the ListView.  Any 
ideas?

Thanks, 

Virtual B

new topic     » topic index » view message » categorize

2. Re: ListViews In Reverse

Sure, feed your info in backwards.....:)

Euman
euman at bellsouth.net



----- Original Message ----- 
From: "Virtual B" <behaviorself at netzero.net>
To: "EUforum" <EUforum at topica.com>
Subject: ListViews In Reverse


> 
> 
> Hi everyone,
> 
> I was wondering if anyone knew a way to make a ListView add each new 
> line to the bottom instead of putting each new item at the top (or 
> possibly to keep things in numerical order according to what is in the 
> first column...?).  I'm working on a payroll program for our contractors 
> here, and we enter the information right off their paysheets, but it is 
> displayed in reverse order in the program.  I ended up rearranging 
> things myself, and it works pretty well...unless you delete something 
> and add another entry.  Here is the code I used to display the data 
> properly:            
> 
> count = getCount(ListView28)
> lv3 = {}
> lv3 = repeat(0, count)
> lParams = repeat(0, count + 1)
> for i = 1 to count do
>     lv3[i] = getItem(ListView28, i)
> end for
> eraseItems(ListView28)
> lParams[1] = addLVItem(ListView28, closefolder, lv1[1..4])
> for j = 1 to count do--count to 1 by -1 do
>   if length(lv3[j]) > 0 then     --need this to keep from crashing
>     lParams[j + 1] = addLVItem(ListView28, closefolder, lv3 [j].4])
>   else
>     junk = message_box("Omitting item ",
>     "Info", MB_ICONINFORMATION + MB_TASKMODAL)                    
>   end if
> end for
> 
> The "if length(lv3[j]) > 0 then" statement keeps the program from 
> crashing, but it also deletes the entry at the top of the ListView.  Any 
> ideas?
> 
> Thanks, 
> 
> Virtual B
> 
> 
> 
> 
>

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

3. Re: ListViews In Reverse

Hehe...Are you saying that I'm being frivolous here?  I'm beginning to think
that entering the info backward is the only solution, but it seems to me
that this is something that I should be able to do.  I want to make this
program as simple and user-friendly as possible (OK, OK...that is part of
the reason, but the main reason is that it seems like such a simple thing,
but I haven't been able to figure it out, and it's driving me crazy!).
Seriously, is this something that just can't be done in a ListView?

Virtual B
----- Original Message -----
From: <euman at bellsouth.net>
Subject: Re: ListViews In Reverse


>
>
> Sure, feed your info in backwards.....:)
>
> Euman
> euman at bellsouth.net
>
>
>
> ----- Original Message -----
> From: "Virtual B" <behaviorself at netzero.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Friday, July 27, 2001 10:26
> Subject: ListViews In Reverse
>
>
> >
> >
> > Hi everyone,
> >
> > I was wondering if anyone knew a way to make a ListView add each new
> > line to the bottom instead of putting each new item at the top (or
> > possibly to keep things in numerical order according to what is in the
> > first column...?).  I'm working on a payroll program for our contractors
> > here, and we enter the information right off their paysheets, but it is
> > displayed in reverse order in the program.  I ended up rearranging
> > things myself, and it works pretty well...unless you delete something
> > and add another entry.  Here is the code I used to display the data
> > properly:
> >
> > count = getCount(ListView28)
> > lv3 = {}
> > lv3 = repeat(0, count)
> > lParams = repeat(0, count + 1)
> > for i = 1 to count do
> >     lv3[i] = getItem(ListView28, i)
> > end for
> > eraseItems(ListView28)
> > lParams[1] = addLVItem(ListView28, closefolder, lv1[1..4])
> > for j = 1 to count do--count to 1 by -1 do
> >   if length(lv3[j]) > 0 then     --need this to keep from crashing
> >     lParams[j + 1] = addLVItem(ListView28, closefolder, lv3 [j].4])
> >   else
> >     junk = message_box("Omitting item ",
> >     "Info", MB_ICONINFORMATION + MB_TASKMODAL)
> >   end if
> > end for
> >
> > The "if length(lv3[j]) > 0 then" statement keeps the program from
> > crashing, but it also deletes the entry at the top of the ListView.  Any
> > ideas?
> >
> > Thanks,
> >
> > Virtual B
> >
> >
> >
> >
> >
>
>
>
>
>
>
>


NetZero Platinum
No Banner Ads and Unlimited Access
Sign Up Today - Only $9.95 per month!
http://www.netzero.net

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

4. Re: ListViews In Reverse

To specify the index of a new item when using LVM_INSERTITEM, the
Win32.hlp file says that the iItem member of the LV_ITEM structure specifies
the index of the new item.
  I think I poked in a number such as #FFFF before I called LVM_INSERTITEM
to add items to the end rather than the beginning of the list.

----- Original Message -----
From: Jonas Temple <jktemple at yhti.net>
Subject: RE: ListViews In Reverse


>
>
>
> Virtual B wrote:
> > Seriously, is this something that just can't be done in a ListView?
>
> Virtual,
>
> The reason your items are shown in the reverse order you loaded them
> into is that Win32Lib uses a literal 0 on the LVM_INSERTITEM message
> sent to the list view.  This inserts the item at the beginning of the
> list.  The first item you inserted now becomes the second displayed and
> so on.  The only way around this is to code the SendMessage calls
> yourself, specifying the item index for insertion.  However, doing this
> will break the column sorting built into Win32Lib.  For an example of
> how you might do this, try my SQL4Less on the contributions page on the
> RDS web site.
>
> Hope this helps.
>
> Jonas
>
>
>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu