Solved

Hoe do I Re-Highlight selected Items In a Multi-Select listBox

Posted on 2003-11-19
5
354 Views
Last Modified: 2011-10-03
After selecting Items in a MultiSelect list Box the Highligth is removed when I Click outside the List.
For example selecting a Radio button.

How to I reset the Highlight. I still have the Index of the selected Items.
0
Comment
Question by:MCofer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9781512
LB_SETSEL
An application sends an LB_SETSEL message to select a string in a multiple-selection list box.

To send this message, call the SendMessage function with the following parameters.

SendMessage(
  (HWND) hWnd,         // handle to destination window
  LB_SETSEL,           // message to send
  (WPARAM) wParam,     // selection option
  (LPARAM) lParam      // item index
);
Parameters
wParam
Specifies how to set the selection. If this parameter is TRUE, the string is selected and highlighted; if it is FALSE, the highlight is removed and the string is no longer selected.
lParam
Specifies the zero-based index of the string to set. If this parameter is –1, the selection is added to or removed from all strings, depending on the value of wParam.
Return Values
If an error occurs, the return value is LB_ERR.

Remarks
Use this message only with multiple-selection list boxes.

0
 
LVL 1

Accepted Solution

by:
jploeg earned 125 total points
ID: 9781699
Maybe you could replace the listbox with a list ctrl (in report view), and set the "show selection always" property.
0
 

Author Comment

by:MCofer
ID: 9782024
Ok I'm new to this using   SendMessage( hDlg,LB_SETSEL,TRUE,0);
I get:
error C2660: 'SendMessageA' : function does not take 4 parameters  ??

I also tried this. It compiles but does not work;
m_List is the ListBox Control
void MyDlg::OnRadioBtn1()
{
m_List.SendMessage( LB_SETSEL,TRUE,0);
}
0
 

Author Comment

by:MCofer
ID: 9782096
I just found my mistake
I am using a ListControl not a listBox.
If this takes more effort I can add some more points
Thanks
0
 

Author Comment

by:MCofer
ID: 9782289
Ok I found the answer The Items were still actually selected
so all I needed to to was  SetFocus() to rehighlight
Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Find boost header files using gnu make (MinGW) on Win 7 11 110
Beginner to Unreal Engine 4 5 119
Android development question 2 108
what type of pointer is this pointer? 3 31
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

734 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