Solved

disable highlighting of listbox selection

Posted on 2004-09-03
3
468 Views
Last Modified: 2008-02-01
I have a group of listboxes that a user selects items from. Normally you select an item from a listbox and the item becomes highlighted blue, click it again and the highlighting is disabled. Is it possible to disable the highlighting, or as the item is selected remove the highlighting.
Also when a user holds down the spacebar in a listbox,all consecutive items are selected, can this be prevented.
0
Comment
Question by:dearness
  • 2
3 Comments
 

Accepted Solution

by:
vb6wizard earned 250 total points
Comment Utility
I am not entirely sure what programming language you are using but I will answer it from the Visual Basic point of view.  You want to immediately disable the highlighting of an item as soon as it is selected.  The code that I am putting below will do this in Visual Basic.  A few things to note -- the name of the object is List1 so you will need to change this to the name of the object that you are using.  This code is also placed in the Click Method.  I will post some more details later.
Private Sub List1_Click()
  If List1.ListIndex >= 0 Then
      If List1.Selected(List1.ListIndex) = True Then
          List1.Selected(List1.ListIndex) = False
      End If
  End If
End Sub
0
 

Author Comment

by:dearness
Comment Utility
vbWizard,
sorry for not giving the programming language, but you were right on target. Your suggestion works great. Nice simple answer.
Thanks.
0
 

Author Comment

by:dearness
Comment Utility
By the way, I had one of the list boxes set for multi select, thats why the spacebar was selecting consecutive items
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now