Important alert: (current site time 7/16/2013 3:08:40 AM EDT)
 

winzip icon

ucCoolList 1.2

Email
Submitted on: 12/8/2001 1:17:28 PM
By: Carles P.V. 
Level: Beginner
User Rating: By 63 Users
Compatibility: VB 6.0
Views: 33226
 
     A ListBox control with cool effects. Sample project demo.

 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
'Windows API/Global Declarations for :ucCoolList 1.2
'**************************************
· A few paint API functions
· msimg32.dll (W-98. Problems under W-NT)
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 53 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
12/8/2001 1:58:50 PMgonchuki

nice code! i have been working in something similar for a few months... but your's seems to be better...
(If this comment was disrespectful, please report it.)

 
12/8/2001 2:53:29 PMCarles P.V.

Thanks again,

A lot of hours...
But, I've had one problem: ImageList (well, really, more than one...).
I'd like to show all ImageList controls on parent form in a property page.



... Congratulations for your Button control of last month!
(If this comment was disrespectful, please report it.)

 
12/8/2001 3:34:14 PMOmar Dixon

Another Great job again!
Keep you the good work Charles..
(If this comment was disrespectful, please report it.)

 
12/8/2001 3:35:53 PMOmar Dixon (OmarSwan)

I meant keep it up!
(If this comment was disrespectful, please report it.)

 
12/8/2001 4:07:19 PMCarles P.V.

Ok, thanks.
(If this comment was disrespectful, please report it.)

 
12/8/2001 4:32:41 PMRefik

This is great brotha! I really like, well I will try it now! You will get 5 Globes from me! Perfect job done keep up the good work
(If this comment was disrespectful, please report it.)

 
12/9/2001 12:46:42 PMmichael

Hello Carles,
>
What can I say ?
Very nice control and a excellent work,
you have 5 star`s from me.
(If this comment was disrespectful, please report it.)

 
12/9/2001 1:23:02 PMCarles P.V.

Hello Michael,

Thanks again.
(If this comment was disrespectful, please report it.)

 
12/10/2001 9:07:39 AMs amditis

Excellent work. Couldn't use the gradients though. Missing msimg.dll.
(If this comment was disrespectful, please report it.)

 
12/10/2001 2:28:05 PMraf

Very nice ocx, got 5 from me. However, I would add few more standard properties to it:

1. Border Color (VERY IMPORTANT)
2. Border Styles (Raised, Frame etc)
3. Background Picture (not so important)

anyhow, good job

raf
(If this comment was disrespectful, please report it.)

 
12/10/2001 2:55:02 PMCarles P.V.

Raf:

Thanks,

I'll add these border properties next version.

Probably too:
New select styles, hor. scroll bar, enable/disable item/s, icon aligments, new effects.

About background picture (I'll add to). Meanwhile, you can generate two pictures (same size as item), and use them as selected and unselected item.
(If this comment was disrespectful, please report it.)

 
12/10/2001 6:50:12 PMChris O'Hara

You really are a pro man
(If this comment was disrespectful, please report it.)

 
12/10/2001 7:34:38 PMCarles P.V.

But, always, all can be improved. There are ways, and better ways, to do something. The only problem is know them... and there are lots to learn.

Anyway, thanks again.
(If this comment was disrespectful, please report it.)

 
12/11/2001 10:11:50 AMßrunø It@lianinø

no comments! good control!
(If this comment was disrespectful, please report it.)

 
12/11/2001 10:31:41 AMCarles P.V.

Good comment!
(If this comment was disrespectful, please report it.)

 
12/12/2001 12:18:09 AMKenny Lai, Lai Ho Wa

Excellent! I will never use the M$ listbox again.
(If this comment was disrespectful, please report it.)

 
12/12/2001 5:33:23 AMCarles P.V.

Well, it's an option...

(If this comment was disrespectful, please report it.)

 
12/15/2001 1:56:31 AMYusuf Simonson

Best list i've ever seen, but that doesn't take much ^_^. 5'er!
(If this comment was disrespectful, please report it.)

 
12/15/2001 2:32:32 AMYusuf Simonson

By the way... how do you get icons in the list?
(If this comment was disrespectful, please report it.)

 
12/15/2001 11:47:38 AMCarles P.V.

Yusuf: Thanks.

"Pointing to" an ImageList control.
See method.

I've tried to get all ImageList controls from parent form to a property page, and let select desired one like TreeView or ListView do, ... but I haven't got how to do it.
(If this comment was disrespectful, please report it.)

 
12/17/2001 8:53:05 PMEmperor Frollard

Call me a NewB...but

I CANNOT get this to work.
I get:
2x"error during load, refer to the logfile"
1x"Invalid property value" pointing to Ln43..." cmbAlignment.ListIndex = .Alignment"
any thoughts?

Hope you can help me because this thing is awesome!
P.S. if you know how to help, email me (jfrost@monarch.net) how to do it, because whether or not I can get back into this page is uncertain.
Thanks!!!
(If this comment was disrespectful, please report it.)

 
12/24/2001 6:34:47 PMGrout

Hey, could you send me the OCX.
Thanks
(If this comment was disrespectful, please report it.)

 
2/7/2002 7:42:16 AMDavid Peake

Hi Charles,
I'm experiencing problems when removing item from the list.... When I select the last item and remove it, the text & icon remain in the control but are unselectable, the 'ghost' stays there until the list is completely empty.

Any ides?

Dave
(If this comment was disrespectful, please report it.)

 
2/7/2002 7:47:21 AMDavid Peake

Hi Charles, I've found out the problem, here's the fix:

Public Sub RemoveItem(Index As Integer)

If UBound(List) = 0 Or Index > UBound(List) - 1 Then Err.Raise 381 _

If Index <= UBound(List) - 1 Then ........

It's the above if statement needed changing to '<=' from '<'

Dave
(If this comment was disrespectful, please report it.)

 
2/7/2002 11:24:29 AMCarles P.V.

David: Thanks!

Zip is updated.
(If this comment was disrespectful, please report it.)

 
2/7/2002 4:50:05 PMCarles P.V.

Fixed: Repaints on resize.
(If this comment was disrespectful, please report it.)

 
2/7/2002 4:52:45 PMCarles P.V.

Really fixed: Resize.
(Crashed on minimizing parent form)
(If this comment was disrespectful, please report it.)

 
2/26/2002 8:58:25 PMGlenn L Hasley

Can you pleae not give this code out for free? I mean how is anyone every supposed to make any money if everyone is giving code away for free?

Very cool OCX but you shouldnt just give away the code. You can give away the control... but NOT THE CODE! :(
(If this comment was disrespectful, please report it.)

 
3/14/2002 12:16:45 PMElias Barbosa

Excellent.
Five planets from me!
(If this comment was disrespectful, please report it.)

 
4/9/2002 4:24:20 PMKristof Torfs

WOW!!!!
(If this comment was disrespectful, please report it.)

 
4/15/2002 2:24:28 PMtony

i've just come across you coollist control - WOW - this code is absolutely fantastic - can't say enough - probably the most useful piece of code on psc - excellent*****
(If this comment was disrespectful, please report it.)

 
5/18/2002 6:58:51 AMVlad Vissoultchev

about imagelists: make a Friend Property Get ParentControls() As ParentControls on the control and use it from the property page to enumerate the controls on the form and filter imagelists in a combobox. Then use the Name of the imagelist control to persist user selection as control property. Later at run-time access ParentControls to find the imagelist.

HTH,


(If this comment was disrespectful, please report it.)

 
5/24/2002 8:05:00 AMCyAnShaDoW

Very nice.... very very nice
(If this comment was disrespectful, please report it.)

 
5/24/2002 10:32:58 AMO. Brightman

I think Glenn is missing the whole point of this site.

(If this comment was disrespectful, please report it.)

 
5/24/2002 3:49:02 PMJccSoft

excellent work, 5 globs from me.
(If this comment was disrespectful, please report it.)

 
5/25/2002 6:44:03 AMJohn Galanopoulos

Excellent Excellent Excellent. 1000000 if i could. Keep up.
(If this comment was disrespectful, please report it.)

 
5/25/2002 4:00:14 PMAl Moledina

Great!! Carles *****
(If this comment was disrespectful, please report it.)

 
5/26/2002 5:29:14 PMEugene

is there a way i can load and save the listbox?
(If this comment was disrespectful, please report it.)

 
5/26/2002 5:58:25 PMEugene

I just made a module to save and load from the CoolList, it saves the icon integer too !
Public Sub xSaveCLList(FileName As String, List As cpvCoolList)

On Error Resume Next
Dim lngSave As Integer

If FileName$ = "" Then Exit Sub

Open FileName$ For Output As #1
For lngSave = 0 To List.ListCount - 1
Print #1, List.ItemText(lngSave) & "|" & List.ItemIcon(lngSave)
Next lngSave
Close #1
End Sub
Public Sub xLoadCLList(FileName As String, List As cpvCoolList, Clear As Boolean)

If Clear = True Then List.Clear
Dim lstInput As String
Dim X As Integer
On Error Resume Next
Open FileName$ For Input As #1
While Not EOF(1)
Input #1, lstInput$

X = InStr(1, lstInput$, "|")

List.AddItem Mid(lstInput$, 1, X - 1), Mid(lstInput$, X + 1, Len(lstInput$)), Mid(lstInput$, X + 1, Len(lstInput$))

Wend
Close #1
End Sub

(If this comment was disrespectful, please report it.)

 
5/27/2002 3:33:32 AMCarles P.V.

Eugene:

Or, if you want: Add these two methods in UserControl...

Public Sub LoadList(ByVal Filename As String)
Dim ff As Integer
Dim ni As Integer

Clear

ff = FreeFile
Open Filename For Binary As #ff
Get #ff, , ni
ReDim List(ni)
Get #ff, , List
ReDim Selected(ni)
Get #ff, , Selected
Close #ff
ff = 0

ReadjustScrollBar
End Sub

Public Sub SaveList(ByVal Filename As String)
Dim ni As Integer
Dim ff As Integer

ni = UBound(List)

ff = FreeFile
Open Filename For Binary As #ff
Put #ff, , ni
Put #ff, , List
Put #ff, , Selected
Close #ff
ff = 0
End Sub
(If this comment was disrespectful, please report it.)

 
5/27/2002 3:39:48 AMCarles P.V.

Anyway, if you want to locate these subs out of OCX, you can use 'Item' type.

Dim m_Item as Item
...
(If this comment was disrespectful, please report it.)

 
6/18/2002 7:27:23 AMDavid Peake

Hi Charles,

I'm still amazed at this listbox. Any thoughts on adding columns? (aka MS ListView Report Mode) ??

Cheers

Dave
(If this comment was disrespectful, please report it.)

 
7/5/2002 11:35:39 AMStephanLudwig@t-online.de

Super OCX,
I have added a function so that the user can decide if the scrollbar shall be shown. This is useful if somebody uses Your OCX in an OSD application.

Again Great Work

Stephan

(If this comment was disrespectful, please report it.)

 
7/24/2002 10:28:58 PMPaul Hendryx

I cant get it to work in WinXP Pro. It works find during design time, but the exe fails when its compiled.
(If this comment was disrespectful, please report it.)

 
9/10/2002 11:33:33 AM

same as Paul Hendryx. If I compile the OCX start a new project add the cpvCoolList to a form and run from IDE the IDE crashes in both win98 and win2000 ??.

Looks really good and works fine in the demo project so I hope I can get this to work, you got 5 globs from me.
(If this comment was disrespectful, please report it.)

 
10/14/2002 3:05:55 PM

Could you please send me the OCX for the cpvCoolList. Thanks, it's great...
(If this comment was disrespectful, please report it.)

 
12/9/2002 3:49:38 AM

This code is absolutely fantastic.

Could I get the OCX that may not be crashed in both win2000 and winXP?

Thanks.....

(If this comment was disrespectful, please report it.)

 
12/9/2002 4:05:48 AM

This code is absolutely fantastic.

Could I get the OCX that may not be crashed in both win2000 and winXP?
My email address is alphee@naver.com
Thanks.....

(If this comment was disrespectful, please report it.)

 
2/18/2003 3:25:49 AM

Very very good work.
But If I compile the
OCX and then add the
cpvCoolList to a form and run from IDE
the IDE crashes in both win98 and
winXP? Could you tell me that am i doing wrong? or send me the OCX at
svagelis@hotmail.com
Thanks Anyway.....

(If this comment was disrespectful, please report it.)

 
7/3/2003 8:47:26 AM

good work&code 5XG
`itemheightauto` prop does not seem to work. if anyone had any ideas , share.
(If this comment was disrespectful, please report it.)

 
9/3/2003 8:09:40 AM

can i download that in OCX form ?
(If this comment was disrespectful, please report it.)

 
8/17/2004 11:27:43 PM

Perfect, great listbox replacement.
5 stars *****
(If this comment was disrespectful, please report it.)

 
11/25/2005 8:44:45 PMS. Austin

Great code! Just what I needed. Just as a quick question. Is there a way to combine the gradient and box styles. I would like to fill a slightly rounded box with a gradient, thanks!
(If this comment was disrespectful, please report it.)

 
12/14/2005 12:00:16 PMfrostbyte2k2

Hi,

How can i drag one item into a treeview ?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.