User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 397,605 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,663 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser:
Views: 4764 | Replies: 46 | Solved
Reply
Join Date: Nov 2007
Posts: 70
Reputation: squidd is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
squidd squidd is offline Offline
Junior Poster in Training

Re: How to split a large list

  #41  
Nov 12th, 2007
ok, it took a look at everything over 3 times to try and figure out why it didnt work for me. I still dont understand. But maybe it had to do with what you mentioned in the code because I cant see any other reason for it to have given me such grief.

BTW, I used Application.ProcessMessages because when very large lists are loaded, the program locks up until the list has completed the load. when I use Application.ProcessMessages, the program doesnt appear to have 'locked up.'

Anyway, I thank you very much for all of your help in this. It has been solved.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,825
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 11
Solved Threads: 187
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How to split a large list

  #42  
Nov 12th, 2007
Glad to have helped.

Now I see why you are calling application.processMessages. I didn't realize you were loading super-gigantic lists.

However, doing so introduces a bug: what if the user clicks, say, Remove Duplicate Entries or (gasp) Clear List while processing messages before the list is finished loading? That's a serious problem!

So, how long do you have to wait loading the largest imaginable list? If it is only several seconds or less, you should instead turn your cursor to crHourGlass and/or put up a little message saying something like "Please wait" --or even, if you want to get fancy, use a a progress bar.

If it is longer, disable all the buttons that can affect the list before beginning to load, and call processMessages as you were during the load, then re-enable all the disabled buttons after loading. Or something like that.

Good luck.
Last edited by Duoas : Nov 12th, 2007 at 9:57 pm.
Reply With Quote  
Join Date: Nov 2007
Posts: 70
Reputation: squidd is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
squidd squidd is offline Offline
Junior Poster in Training

Re: How to split a large list

  #43  
Nov 12th, 2007
ok well, the largest list would be somewhere in the area of 100,000 lines... I dont know how to use a dynamic array yet, so I am using listview. It would take almost 1 minute to load a list that large; and that is on a fast computer.

I want to do a progress bar yes! But I havent seen anything out there that really helps me do that so far.

I am trying to add messages as the list does different things (i.e. clear to say clearing list for long lists.. etc...), and of course I am having problems... lol Not to the point that I need to make a post I dont think. Maybe I should make a new post about adding a progress bar, since I have been trying that for about 2 days off and on. What do you think? The progrss bar i would like to do is inside a status bar on the bottom of my form. But learning the progress bar alone would be great as well.

The disabling of buttons that could cause problems sounds like a great idea! Maybe along with the progress bar, i could somehow give a percentage number complete at the top of my mainform. I dont know. What are your thoughts?

EDIT -

Also, Since this has a fair amount of buttons and whatnot.. I thought I may as well start learning some events like mouseover changes button color, or plays a sound, or both... add some eye candy to this program. If i can do it on this and learn this now, I can add the different things I learn into any program I write from now on. Lots of different things to do with cosmetics in a program.. learning how to make it work is another however. I dont wont to have external dependencies for colors and sound for mouseovers unless there is no other way. One exe is all I want for this.

EDIT_2 -

I was thinking since a list FINALLY splits now, maybe to add different types of files to the load button such a *.doc, *.rtf, *.pdf, etc... when I try to l;oad a different type of file other than a text file (*.txt) i get some gibberish and no lines load. If that requires major work then no worries...

I also want to be able to add a "_" in between the numbered split files (i.e. out_1.txt, out_2.txt, etc...) I tried to l;ook at the code and make some changes but had no luck with that. Again, if it is a major hassle, then no worries there either.

I did find I could save a file in different formats... that was kinda neat.. maybe I could add an edit box to have it save automatically to whatever format. Again, some reading material on how to do that would be a great thing to have. lol
Last edited by squidd : Nov 12th, 2007 at 10:31 pm.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,825
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 11
Solved Threads: 187
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: How to split a large list

  #44  
Nov 12th, 2007
The windows progress bar displays the percent-complete in the center, so that is a good choice. Delphi status bars are a pain in the nose to use, but I think you can add a panel containing a progress bar... I don't think I would bother with the form caption.

The reason it takes so long to load is because you are using a TListView... sorry to say.

Take a look at the OnMouseMove event for mouse over stuff.
Also, the PlaySound Win32 function. You'll probably want to compile your sounds into your program, so you'll need to read up on using resources.

Your program is designed to read and write text files. Binary files are a no-no. You'll damage them irrevocably. To auto-append a specific extension, just test the filename once you've got it to see if it has an extension or not, and add it if not.

The filename itself is just a string, so add an underscore the usual way
basename + '_' + intToStr( 12 ) + fileext

Just because you can save a file named "foo.pdf" does not make it a PDF file. It is still just a plain-text file. Remember, PDF, etc. are binary files. RTF is a text file, but it is not your run-of-the-mill text file. Its contents have a specific format. Load one into Notepad to see.

Good luck.
Reply With Quote  
Join Date: Nov 2007
Posts: 70
Reputation: squidd is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
squidd squidd is offline Offline
Junior Poster in Training

Re: How to split a large list

  #45  
Nov 13th, 2007
Thank you for the reply kind sir. I will look into that right now. and edit will follow shortly...
Reply With Quote  
Join Date: Nov 2007
Posts: 70
Reputation: squidd is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
squidd squidd is offline Offline
Junior Poster in Training

Re: How to split a large list

  #46  
Nov 13th, 2007
Originally Posted by Duoas
The reason it takes so long to load is because you are using a TListView... sorry to say.

I know.. an array would go MUCH faster... exponentially faster even. One thing at a time though....

Take a look at the OnMouseMove event for mouse over stuff.
Also, the PlaySound Win32 function. You'll probably want to compile your sounds into your program, so you'll need to read up on using resources.

I will be doing that tomorrow for sure... thanks for the heads up on where to look.

Lastly, (I have everything saving to a txt format now) binary files are totally different than huh? Any ideas about reading up on how to do the same thing with those types? If that is above me, then once again, no worries.

I think I need to start a new topic. lol
Reply With Quote  
Join Date: Jan 2008
Posts: 1
Reputation: Raged is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Raged Raged is offline Offline
Newbie Poster

Question Re: How to split a large list

  #47  
Jan 14th, 2008
hey!, i know this threads dead, but I've got a related issue which is really bugging me.

I have been making a program to get items from a txt file and move them into a combo box, of course i got that working great, but for all my testing i just had to remove the txt file because it took so long to load, and this topic started moving onto using application.message or something, to stop the lag....

so I'm wanting help with how i can get my program to either load my list faster (i wouldn't mind storing the information in the program if its nesessary) even though i have 1 big problem with the application already and that is its storing the information in the program, but if i remove the txt file, it can't use the information. so my applications a large file size already.

anyway, i was thinking about having a progress bar for it loading the lists up.
and i can't find any sort of progress bar code to use it while the pc's lagging on loading a file.

but if its possible to have the application loaded, and be able to use the combo box while its feeding in the information, that would be great.

also there was a post about putting progress bars in status bars, that deals with parenting, and is to over complicated for simple programs unless your really visual needed =D

Thanks in advance =)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Pascal and Delphi Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Pascal and Delphi Forum

All times are GMT -4. The time now is 7:27 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC