• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

only 5 pts left!!! Highlight line in list box

I am using BorlandC++ Builder3.
I am using TListBox to display text and highlight each line of text individually one at a time.
I am trying to simulate stepping through code.
My problem is that I am using a button on the screen to highlight each line of text, this is working OK, but I want to disable the ability of the mouse and the up and down arrow keys  to highlight the lines. I have tried disablying the ListBox, but this greys out the text and disables the scrollbar which I want to use.
Can anyone help???

Thanks in advance

John
0
pcb69
Asked:
pcb69
  • 2
1 Solution
 
RONSLOWCommented:
one thought .. when the list box gets the focus, immediatlely set focus to your button.  That way, the list box can never recieve input focus and so you cannot move the selection up and down.  But that won't help with the mouse.

So I'd handle WM_KEYDOWN (move selection with keyboard arrow), WM_CHAR (move selection by typing letters), and WM_LBUTTONDOWN and WM_LBUTTONDLBCLK (change selection by clicking) and do not call the default processing (do nothing).
0
 
pcb69Author Commented:
Thanks Ronslow You have been very helpful. I would like to leave the question open so that I can get an answer to the mouse problem.

Thanks again for your help
0
 
RONSLOWCommented:
Handling the WM_LBUTTONDOWN and DBLCLK should solve the mouse as well (see second paragraph of my answer).

Anyway .. give it a go and see how you go.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now