April 28, 2024, 03:13:11 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


ListView strange problem

Started by billhsln, September 13, 2011, 04:41:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billhsln

I have a listview program which displays all the data, when line 172 is commented out, and only displays some of the data when 173 is commented out.  Then only difference is the:

Line 172:
CONTROL d1,@LISTVIEW,"",10,55,1180,575,@VSCROLL|0x50000001|@BORDER|@LVSSORTASCENDING,D1_L1

compared to:

Line 173:
CONTROL d1,@LISTVIEW,"",10,55,1180,575,@VSCROLL|0x50000001|@BORDER,D1_L1

It is not displaying the Date Time, File Size and File Path, except on a few, but if there is no @LVSSORTASCENDING, it displays all the info.

Source code attached, this is a work in process (press SEARCH to see it work), if you don't have any .prg files, us an extension that you do have (.gif, .pdf, etc).

Thanks for any help,
Bill
When all else fails, get a bigger hammer.

LarryMc

that one has bitten me in the backside before also.
When you add a sorting flag to your listview (in the case where you say data is missing) you can't add entries the way you have in  this block of code at line 336
' Load Fields with data
CONTROLCMD d1,lv,@LVINSERTITEM,lvi,filename
CONTROLCMD d1,lv,@LVSETTEXT,lvi,1,TimeStamp
CONTROLCMD d1,lv,@LVSETTEXT,lvi,2,FileSize$
CONTROLCMD d1,lv,@LVSETTEXT,lvi,3,ipath

in that code you are trying to insert a new item at row lvi
when that command executes the automatic sorting feature moves that entry to some other row where it is in sorted ordered.
When you use LVSETTEXT to set the associated values at lvi the item you think is there isn't there.  With your scheme, whatever record happens to be at the bottom of the sorting order is the one that will get those values.  Depending upon specific values of your filenames the associated values could wind up all over the place even to the extent that it may appear that some randomly have values and some ramdomly don't.

The way to get it to work do this:

' Load Fields with data
CONTROLCMD d1,lv,@LVINSERTITEM,lvi,filename
int position = CONTROLCMD d1,lv, @LVFINDITEM, filename)
CONTROLCMD d1,lv,@LVSETTEXT,position,1,TimeStamp
CONTROLCMD d1,lv,@LVSETTEXT,position,2,FileSize$
CONTROLCMD d1,lv,@LVSETTEXT,position,3,ipath


I didn't run your code but that should fix it.(provided you don't have duplicate filenames you're trying to add)

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Since I am looking for dups (based on file name), I will have to look for some other way to do it.

Will still keep a copy of your example, maybe I can work another way around it.

Thanks,
Bill
When all else fails, get a bigger hammer.

LarryMc

Yeah, I ran it and seen what it actually looked like.

I'll play with it a bit more and see what I can find.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

I could always add a few blanks and a number, just to make it unique, then make column 0 not show....and stick the actual file name into column 1.

Bill
When all else fails, get a bigger hammer.

LarryMc

I'm almost through writing that very code ;D

will post it shortly
LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

here is something you can massage

It sorts on the fly
once you are satidfied how it works you can hide the first column

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Your solution worked perfectly.  With the added advantage of being able to see right off how many dups there are.

Thanks for all the help.

Just for grins, is there a limit to how many rows/columns you can have in a listview?

Thanks again,
Bill
When all else fails, get a bigger hammer.

LarryMc

I'm not aware of aany.  Memory is always a limit though.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

Larry,

Ran your offering, and don't see any files at all - and it is running in the
Projects dir. Am I missing any files, or is there anything to set up?

Brian

whitenite1

Ran the program, and it worked flawlessly. Found 461 files ending in '.iwb'

whitenite1

billhsln

Larry's version searches for .iwb, mine searches for .prg (Foxpro files).

Just change the value in the NAME box and press SEARCH.

Bill
When all else fails, get a bigger hammer.