Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help to hightlight in selection for style 0 type of combobox

Status
Not open for further replies.

koklimabc

Programmer
Jun 17, 2013
49
MY
Dear all,

I've one problem here and need someone could help me. How to make a highlight in selection for style 0 type of combobox where contents of combox is editable.However, I've tried to use 'sellength' but it ended up not working.

Thanks to all helpers.
 
Do you mean you want a specific item to be selected after you initialise (or populate) the combo box?

If so, you just need to set the ListIndex property to point to the item in question. For example, to highlight the third item, set ListIndex to 3.

If that's not what you wanted to know, please clarify your question.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Did you try both selstart and sellength?

Also this isn't a stable setting, each keypress changes it, as it's simply the properties reflecting the selection of text in the textbox portion of the combobox. Both setting sel properties and acting on the text work in two ways, it's not unidirectional. So if some section is selected and the user types, what happens is the same, as if the user had selected that portion. And what happens in a textbox, if you select a portion and then type something? The selected portion is replaced by what you type.

So selstart and sellength are not really meant and helpful for highlighting, this collides with what you most probably want. You would rather need to go a much complexer route and use gdiplus to draw some portion of the text highlighted or overlay a yellow transparent img or do anything directly manipulating the canvas without setting the selection of text.

What Mike suggests done in each interactivechange is rather working like intellisense works: You type _screen. in the command window and all _screen properties show up, you type C and Caption is highlighted in the dropdown combo portion, that item is selected. You type L (so you now have CL and the Class item is selected, you type I and arrive at the first item starting with CLI, which is Click.

That's something you can do in InteractiveChange locating the first item matching the typed in text.

Bye, Olaf.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top