Important alert: (current site time 7/16/2013 2:42:38 AM EDT)
 

winzip icon

McListBox 2.2 [ A perfect replacement for vb's ListBox ] ( *All you need!! )

Email
Submitted on: 10/1/2005 11:54:32 AM
By: JJJJJJJJ  
Level: Intermediate
User Rating: By 46 Users
Compatibility: VB 6.0
Views: 27670
(About the author)
 
     Heavly improved version with Item completer, Subclassing, Api scrollbars, XP style, Mouse wheel... : It is a High Performance, Ownerdrawn and Stylish 'Listbox' control with many advantages inluding Multi-line selection, Custom list-icons, Item Highlighting, Unicode support, Adjustable RowHeight, List Sorting, Grid lines and nice Gradient effects. This control is an update for my 'ListBoxEx' control. It uses 'McImageList' for image reference. The imagelist control is also included in this zip. Check this out, and please give me your feedbacks!!, Jim Jose :-))

 
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 43 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 Intermediate 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

9/5/2005 9:15:02 AMLight Templer

Jim, ones more: Looks great! But plz run app with before submitting it to PSC ... ;-)))
(There 's an error in 'Property Let ListIcon(...)' )
Maybe you should kill the intrinsic slider, too. So a more modern look would be possible.
Anyway: GREAT JOB! My ***** for and regards.
LiTe

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

 
9/5/2005 9:24:56 AMLight Templer

After a closer look:
Selecting/Deselecting in multicolum mode with Ctrl-LeftMouseClick is missing.
Rest works fine afaiks ;-)
(If this comment was disrespectful, please report it.)

 
9/5/2005 9:26:29 AMenmity

if it was released a few years ago...
(If this comment was disrespectful, please report it.)

 
9/5/2005 9:36:04 AMenmity

the scrollbar is not so good looking, buddy;)
(If this comment was disrespectful, please report it.)

 
9/5/2005 4:17:25 PMLight Templer

enmity, its still a fine submission and well worth to vote for! :-)
(If this comment was disrespectful, please report it.)

 
9/5/2005 9:29:29 PMLMF

ok i really need this kinda code.......... 5 Globes to you ;-P
(If this comment was disrespectful, please report it.)

 
9/5/2005 10:07:24 PMJim Jose

Lite, I fixed the bug and updated just after your info. But I was unable to comment here, bcose of the long aprovel period. Anyway 'Selecting/Deselecting in multicolum mode', may be 'MultiSelectMode' requires one for collection object for selected items. Thant will be there in the next update. Thanks for your support!! :-))
(If this comment was disrespectful, please report it.)

 
9/5/2005 10:12:01 PMJim Jose

enmity, 'ScrollBars'???. I am too lazy in that part. Also it is rare to see some quality 'ScrollBars' here!!. After all I am using the same old 'Win98SE' where 'ScrollBars' are not a big MATTER.

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

 
9/5/2005 10:17:29 PMJim Jose

Also.... Thanks for voting!! :-))
(If this comment was disrespectful, please report it.)

 
9/5/2005 11:11:42 PMKenneth Foster

Jim,again great control.One small addition I made was add Usercontrol_Show and put me.refresh.This way I don't have to put the control Refresh in form code. I haven't notice any problems doing it this way.Hope it helps.
(If this comment was disrespectful, please report it.)

 
9/5/2005 11:35:17 PMdreamvb

This is wired not the code. but the Idea as I started the same project only yesterday after seeing an example of your image Control. you must have read my mind.

anyway mine is not finsihed yet. tho has many of your features and more. umm it looks Like i have to work even hardeder now. anyway Nise code keep up the good work. 5 from me *****
(If this comment was disrespectful, please report it.)

 
9/6/2005 12:38:22 AMenmity

haha~~~ sure! I vote for both of Jim's most recent good submissions.
(If this comment was disrespectful, please report it.)

 
9/6/2005 5:22:23 AMLight Templer

Jim, maybe
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=28878&lngWI d=1
gives
you an inspiration to the slider question ;-)

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

 
9/6/2005 7:27:25 AMTerriTop

Jim, nice submission and excellent implementation of these two controls. One minor issue, selection of items in the list with Ctrl gives the same result as Shift...instead of the expected non-contiguous items selection...5 for the effort, and keep it coming. TerriTop
(If this comment was disrespectful, please report it.)

 
9/6/2005 7:49:02 AMJim Jose

Lite, Wow!! its Carls's contest winning submission!! I was unaware of this post, and thanks for informing... 'Carls' was always my inspiration. In all my uc submissions he has a great roll with his DIBGradient routine, which is the BEST!!
(If this comment was disrespectful, please report it.)

 
9/6/2005 11:40:39 AMAlex Dela Cruz

I found minor error from this. when I open Operation Page & then I tried to add new item with bold text.then I clicked the item then error occured. However, it's really great. so it deserve for five globes!Thanks!
(If this comment was disrespectful, please report it.)

 
9/6/2005 2:22:16 PMFred.cpp

Very nice Very nice!
but...
Ok, It's a great work (I know what Is It all about). I have some small suggestions:
add Paul Caton's self subclassing :) Why?
*Fix the scrolllbars
*Add Mouse detection (and cursor Icon)
*Add Mouse wheel
*Win the coding contest :)
Come on, It's not so hard (you've done maybe the most difficult steps)
Also, a small and usefull adition would be to make ITems with Variable Height and optionally a caption text.
I was coding something similar, It was just missing the icons, but I lost the entire project (read my blog for details).
You got 5 globes for now, but I still wait for updates.
(If this comment was disrespectful, please report it.)

 
9/6/2005 10:16:32 PMJim Jose

TerriTop, Alex... Yes I found some errors in multiselection mode. Also 'Shift' for extended selection and 'Ctrl' for "Simple' Selection!! is not implimented. One more.. the selection with keybroard (up & down arrows) is missing!!. All will be cleared in the next update. Thanks for informing!! :-))
(If this comment was disrespectful, please report it.)

 
9/6/2005 10:22:21 PMOption Explicit

I agree about the subclassing Jim! I have Caton's self subclasser fully working in my MorphListBox now (mouse wheel, etc.) if you want I can email you an update of what I have, (which is quite further along than what I emailed you a couple days ago).
(If this comment was disrespectful, please report it.)

 
9/6/2005 11:35:49 PMHeriberto Mantilla Santamaria

Yeah the Paul Caton is an excellent subclassing, Jim you can implement in your 'McListBox'.

You can unite with fred and Matthew and to take out a only ListBox it would be spectacular to see three united geniuses.
(If this comment was disrespectful, please report it.)

 
9/7/2005 12:40:55 AMHeriberto Mantilla Santamaria

Doesn't work with CTRL + Item.
(If this comment was disrespectful, please report it.)

 
9/7/2005 6:11:05 PMHeriberto Mantilla Santamaria

New bug, when the list is clear and you make click in the list the error 5 is show.
(If this comment was disrespectful, please report it.)

 
9/7/2005 10:21:37 PMJim Jose

OK, multiselection bug is completly fixed!!. Now we can use 'Shift' for extended selection and 'Ctrl' for simple selection. Thanks for ur Help!!
(If this comment was disrespectful, please report it.)

 
9/7/2005 10:30:50 PMJim Jose

Heriberto, I got no errors on clicking an erased list!!. You please try the newest version and make me informed... Thanks!!
(If this comment was disrespectful, please report it.)

 
9/8/2005 5:34:43 PMHeriberto Mantilla Santamaria

Bug when you press the key Repag (Page Up) and these to the beginning of the list, when you press Avpag this it doesn't arrive at the end of the list, to be able to advance with the keys Beginning and End lacks or they don't work correctly.

Now when you clean the list and you make click in the same one there is an error in the property ListBold

Now when you clean the list and you make click in the same one there is an error in the property ListBold.
(If this comment was disrespectful, please report it.)

 
9/9/2005 9:05:39 AMTheCardinal

Can you add a feature that the listbox can display items like in the ADD/REMOVE PROGRAM in the windows control panel.
(If this comment was disrespectful, please report it.)

 
9/10/2005 5:33:45 PMLibor Blaheta

5 stars especially for the Unicode support. There are not many controls that support Unicode.
(If this comment was disrespectful, please report it.)

 
9/10/2005 9:35:00 PMJim Jose

Cardinal, what you exactly mean?? Please inform me, "What you found special on listbox of ADD/Remove"!!
(If this comment was disrespectful, please report it.)

 
9/10/2005 9:55:45 PMFred.cpp

Congratulations Jim! Great work. The Update Is great (specially the scrollbar stuff).
I can't vote again, But It would be great. 5 imaginary globes more! :)
(If this comment was disrespectful, please report it.)

 
9/11/2005 5:22:57 AMPhantom Man

Nicley done Jim!

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

 
9/11/2005 3:30:11 PMHeriberto Mantilla Santamaria

No Jim, Cardinal spoken of the Windows XP OS the ListBox in the section Add/Remove Programs.
(If this comment was disrespectful, please report it.)

 
9/11/2005 7:36:05 PMTom Level

great code!! 5 globes from me
did u already think about extending it to multicolumn? (listview in report mode) this would rox!
(If this comment was disrespectful, please report it.)

 
9/12/2005 8:10:03 AMRichard Mewett

Jim I love it! You are a master craftsman with UC graphics - it has a great look & feel. 5*
(If this comment was disrespectful, please report it.)

 
9/12/2005 12:22:05 PMDashmisr

Greate Code!! except the application stop responding when i click on Style solid have you gote idea why?

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

 
9/12/2005 7:54:09 PMZhu JinYong

can't run.it caused my xp dead.
(If this comment was disrespectful, please report it.)

 
9/12/2005 10:05:43 PMenmity

now i see the improvements;)
(If this comment was disrespectful, please report it.)

 
9/13/2005 12:59:15 AMJim Jose

Dashmisr, I don't know why!!. The only thing special to 'Solid' is the Gradient code. You please try the same on the 'Test' control and let me know it works! Zhu JinYong, OS dead??( i think there is no chance). Can you please try it once more. Other XP users... please inform me if you got a similer scope.
(If this comment was disrespectful, please report it.)

 
9/13/2005 4:12:03 AMPhantom Man

Hi Jim

I Have Tested The Control On The Following : WinXP(SP2)Pro,Win98, WinNT, Windows 2003 Server and Win2000.

And It Ran Extremely Well On All Os's.
No Problems What So Ever.

But When I Tried It At Home On My XP(SP2) Machine It Did Lock Up. The Root Of The Problem Was Windows Blinds!

I Disabled Windows Blinds And Everything Worked!

Note: Windows Blinds Also Locked Up Some Of My Other Software Including MS Software!

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

 
9/13/2005 10:00:29 AMJim Jose

Gary, thanks a lot for helping me again, IN TIME!
(If this comment was disrespectful, please report it.)

 
9/13/2005 10:05:50 PMOption Explicit

Hi Jim, I just downloaded your latest... Looking great! I noticed an issue with multiselect though. Try this. In the McListBox that handles multiple selections, go to the botton and select the last two or three items. Then a few spaces above those, select another item. THEN, press Shift-Home. Using the scrollbar, scroll down to the bottom of the list. You will see that items that should not be selected, *are* selected. At least, that's what happened to me. I *think* this is the way to reproduce the error (I'm not at my PC right now). Regardless, there are issues with multiselect. Try experimenting with it... I'm working on the .MultiSelect = Extended part of MorphListBox and it's a pain, for sure! Keep up the great work!
(If this comment was disrespectful, please report it.)

 
9/14/2005 8:57:51 AMenmity

in Tab style, click any item, hanging.
(If this comment was disrespectful, please report it.)

 
9/14/2005 10:01:25 AMHeilan Percio Cardoso

Jin Jose :
Congratulations for your great code.
I would like to know how can I create your superb control in runtime.
Sorry for my poor english.
(If this comment was disrespectful, please report it.)

 
9/14/2005 12:37:20 PMJim Jose

Matt, Thanks for the *Deep Look*... Ok, the version 1.8 is released which fixes the issue. Also fixed the color identifying bug when selecting *System Color* as informed by Fred.cpp
(If this comment was disrespectful, please report it.)

 
9/14/2005 8:41:45 PMZhu JinYong

Click any item of your MClistbox 1.8 inside Tab,my XP locked-up because of endless redrawing.
(If this comment was disrespectful, please report it.)

 
9/14/2005 10:00:02 PMPaul Turcksin

Impressive!! Thanks for sharing an 5 from me.
(If this comment was disrespectful, please report it.)

 
9/15/2005 12:59:11 AMJim Jose

Heilan Percio Cardoso, Please try this to add McListBox in *Runtime*....

>>>Dim NewList As Control
Set NewList = Controls.Add("ListBox.McListBox", "Test")
NewList.Visible = True<<<
(If this comment was disrespectful, please report it.)

 
9/16/2005 8:54:51 AMRiccardo Cohen

Woow, this is great and a nice upgrade! Thanks for sharing Jim. One question: Is it posible to use XP-icons (or pictures with alpha channels) in the near future? This would be great.
But here it is... 5 globes from me for this fabulous work!!!
(If this comment was disrespectful, please report it.)

 
9/16/2005 10:28:09 AMRiccardo Cohen

Hi Jim, Bug report:
1. 3D-Appearence doesn't redraw listbox (Items)... Use checkbox within TAB [General]

2. Error in Public Property Let ListIcon. I used this example; delete all items till you get 4 items f.e., then click in ListBox (not at an item). You will see that items are deselected. Now click TAB [Operations] and push button [Set New Icon] --> Error!

Many Thanks!
Riccardo Cohen
(If this comment was disrespectful, please report it.)

 
9/16/2005 9:34:34 PMenmity

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

 
9/17/2005 9:41:43 AMJim Jose

Riccardo Cohen, thanks for informing... Bugs fixed!!
(If this comment was disrespectful, please report it.)

 
9/19/2005 7:01:20 PMFred.cpp

here works fine, great work jim.
I can use It for my projects, right? (I'll give you full credit for It).
(If this comment was disrespectful, please report it.)

 
9/20/2005 1:22:54 PMFarolfo

great work jim thanks for background picture support 5 globe for me

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

 
9/21/2005 6:02:38 AMJim Jose

Fred, I am planning to include an "ItemCompleter" which will enable the user to see items with textwidth more than the uc's width. I hope the new version can release soon!
(If this comment was disrespectful, please report it.)

 
9/21/2005 7:11:01 AMPhantom Man

Hi Jim: Nice Updates, The Control Keeps Getting Better And Better. Kind Regards
Gary


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

 
9/21/2005 10:05:24 AMJim Jose

Thanks Gary : Guys, As I said, the new version 2.1 is released with "Item Completer" (See the screenshot). I *hope it is useful!!
(If this comment was disrespectful, please report it.)

 
9/21/2005 4:15:43 PMLibor Blaheta

Hi, the AutoCompleter is really cool but it has problems with unicode chars.

Try this long line

sText = ChrW(50000) & ChrW(50000) & "Move Mouse Here... And now you see the full Text " & ChrW(50000) & ChrW(50000)

The problem is that the AutoCompleter does not show the last two chars.
(If this comment was disrespectful, please report it.)

 
9/21/2005 5:58:39 PMOption Explicit

Getting better all the time! I might have to steal your "Item Completer" idea for MorphListBox! ;-)
(If this comment was disrespectful, please report it.)

 
9/22/2005 5:10:00 AMRiccardo Cohen

Nice upgrade Jim. Little bugs with the "Item Completer" thou... When completer is visible, using the mouse scroll doesn't disappear the completer. Second, if the completer reaches the right of the screen it doesn't auto fit to screen (Or moving to the left).
Another Q: And are you planning to make the ListBox XP(Alpha) pictures compatible?
Keep Up the good work Jim Jose!
(If this comment was disrespectful, please report it.)

 
9/23/2005 7:26:46 AMJim Jose

Libor Blaheta,Riccardo Cohen, Thanks for reporting the bugs... COde Updated!! : Matt, :-))
(If this comment was disrespectful, please report it.)

 
9/23/2005 8:50:20 AMLibor Blaheta

Hi, thanks for the update. But the Completer still has problems with Unicode. Try this long line - sText = ChrW(50000) & "Item Completer with... " & ChrW(5000) & " ...Unicode!!" & ChrW(50000) . The first chinese char is displayed well, but the one in the middle of the string and the last one is not displayed at all. Could you check it.
(If this comment was disrespectful, please report it.)

 
9/23/2005 3:55:28 PMJim Jose

Libor, It works fine for me. Ok, I will try to solve it. : Anybody else got the same BUG???
(If this comment was disrespectful, please report it.)

 
10/6/2005 5:38:10 PMOption Explicit

Congratulations on your contest win Jim!
(If this comment was disrespectful, please report it.)

 
10/7/2005 1:37:08 AMLuis

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

 
10/7/2005 4:22:29 AMRichard Mewett

Jim, well done a a deserved COTM!
(If this comment was disrespectful, please report it.)

 
10/23/2005 3:47:12 PMDustin

some gliches
if u set the row hight to big, it crashes ;), maby a on error resume next oO
not sure how i did it, but i couldnt scroll to see the other items in the listbox (has happined 2 time's now)

was wondering if u could add a icon on the end of the list item, and sub items(with there own colors(or can you already?)
(If this comment was disrespectful, please report it.)

 
12/13/2005 8:36:49 AMAntonio Henrique

Jim, this control is very simple to use althouth its differences from VB listbox.
I need something and I don't know if it is possible. Well I'd want to change the text in one listindex, I try to use mcList1.List(mclist1.ListIndex) = "test" where the original value were "original" but one error message appears, Like this "Run-Time error '424' Objetct required"
This occurs when I was debuging in McListBox, Property Let List in line m_Items(vIndex + 1) = Join(txtData, SPLITER).
As I don't know how it functions I really need your help.
Since now Thank you for your help.
obs1.: I need to put On Error Resume Next in Public Property Get Image so as not to have problems when I instance in a new project.
Obs2.: I'm brazilian and I'm so sorry for my bad English.
Obs3.: GOOD JOB and Great Code.
(If this comment was disrespectful, please report it.)

 
12/17/2005 12:24:47 AMJim Jose

Antonio, Since u was debuging the code... and there is no problem on a new instance... it may be due to the the property read-write methods. I think the control tries to read a non-writen property!! Anyway I will look into it.

The new version of McListBox is on it's way. It has ListBox,FileList,DriveList,FolderList mode!! I wish I could solve all the detected bugs before that!!

Thanks to everybody for ur interest in my control. :)

Jim Jose

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

 
12/31/2005 1:08:36 AMJim

Very nice control. Is it possible to have the text displayed on multiple lines within each row?

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

 
1/23/2006 9:47:27 AMenmity

when will u release it
(If this comment was disrespectful, please report it.)

 
1/24/2006 7:54:30 AMJim Jose

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

 
2/4/2006 10:31:31 PMKenneth Foster

Jim,Great control. I did notice though in the text aligment properties that the vbRightJustify and vbCenterJustify are reversed.
(If this comment was disrespectful, please report it.)

 
2/9/2006 9:11:49 PM

this control will crash when put it in a picture(frame).
(If this comment was disrespectful, please report it.)

 
2/16/2006 3:04:52 PMJakeBullet

Dude! Nice! and 5 big ones!
(If this comment was disrespectful, please report it.)

 
2/7/2007 10:50:28 PMRob C

For a wee moment I thought that the completer mentioned was an auto complete, but not so.
I guess you have stopped enhancing this uc by now ?
An auto find that worked something like this would be nice -
User clicks in Listbox to give it focus.
User starts typing, and the list selection moves to first match.
If user keeps typing, and the selection no longer matches, then it moves selection further down to a match.

It looks great, and works very well.
That's a 5
(If this comment was disrespectful, please report it.)

 
3/23/2007 1:33:55 AMMew

It is possible to modify drawtext to add different item with different colors each time ?
(If this comment was disrespectful, please report it.)

 
3/11/2009 8:14:44 AMFurkan

I don't know why but it keeps freezing and freezing.. Entering endless "Redrawing" loop.. (Hybrid one too.)
(If this comment was disrespectful, please report it.)

 
12/11/2010 2:46:51 AMoxy

it does? subitems..???
(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.