954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

highlighting text in the dialog's EDIT box

hi friends,

i would like to know how to highlight text in dialog's Edit box and List box.
Is there any mfc api for that ??

ashishchoure
Junior Poster
105 posts since Sep 2008
Reputation Points: 59
Solved Threads: 10
 

Why not? Do you forget GDI+?

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

You can find lots of solutions at www.codeguru.com and www.codeproject.com

jencas
Posting Whiz
366 posts since Dec 2007
Reputation Points: 395
Solved Threads: 71
 

i found the solution for highlighting text

1. SetFocus()
2. SetSel()

but i want to highlight multiple word ....can anybody help...

ashishchoure
Junior Poster
105 posts since Sep 2008
Reputation Points: 59
Solved Threads: 10
 

Great! Hightlight = Text selection.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

Selecting word is fine in my case can u help me for multiple selection i dont want go inside of gdi+

ashishchoure
Junior Poster
105 posts since Sep 2008
Reputation Points: 59
Solved Threads: 10
 

multiple selection - Text, List Items?

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

For example string in editbox is - Hi this is ashish!

and i want to select "is" and setsel() function takes position of start and end char to be selected.

m_CtlEdit.SetFocus()
m_CtlEdit.SetSel(5,7)
this is selecting first "is" - Hi this is ashish!

like that i tried for next
m_CtlEdit.SetSel(8,10)

but i want to select both "is" in same time..

ashishchoure
Junior Poster
105 posts since Sep 2008
Reputation Points: 59
Solved Threads: 10
 

Is it HideSelection?

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

if i do
m_CtlEdit.SetFocus()
m_CtlEdit.SetSel(5,7)
m_CtlEdit.SetSel(8,10)

then it is selecting the last one not both

ashishchoure
Junior Poster
105 posts since Sep 2008
Reputation Points: 59
Solved Threads: 10
 

It show the selection and make it permanent.

obj.HideSelection(FALSE, TRUE);
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

this function is used for RichEditbox not for edit box

ashishchoure
Junior Poster
105 posts since Sep 2008
Reputation Points: 59
Solved Threads: 10
 

set ES_NOHIDESEL style.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You