Click here to Skip to main content
15,891,136 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Can not Find Functions In Static Library Pin
Chuck O'Toole7-May-12 19:41
Chuck O'Toole7-May-12 19:41 
GeneralRe: Can not Find Functions In Static Library Pin
AmbiguousName7-May-12 20:10
AmbiguousName7-May-12 20:10 
AnswerRe: Can not Find Functions In Static Library Pin
Chuck O'Toole8-May-12 3:46
Chuck O'Toole8-May-12 3:46 
AnswerRe: Can not Find Functions In Static Library Pin
AmbiguousName8-May-12 9:06
AmbiguousName8-May-12 9:06 
QuestionCRichEditCtrl interface question Pin
ForNow6-May-12 6:32
ForNow6-May-12 6:32 
AnswerRe: CRichEditCtrl interface question Pin
enhzflep6-May-12 7:21
enhzflep6-May-12 7:21 
GeneralRe: CRichEditCtrl interface question Pin
ForNow6-May-12 9:07
ForNow6-May-12 9:07 
GeneralRe: CRichEditCtrl interface question [modified] Pin
enhzflep6-May-12 10:14
enhzflep6-May-12 10:14 
Indeed. I was actually thinking more along the lines of what sort of mainframe? e.g US Military, CRAY, and a couple of other whose name escapes me just now. I played with DEC Alphas a million years ago, MIPS before the orig PlayStation implemented it, Had a couple of old SuperSparc's sitting in cases in the CS building in uni. Perhaps I was simply too inarticulate. No matter. Sorry for my intrusiveness. Blush | :O

Yeah, one would certainly think that your code would colour the line red - though I've been spectacularly unsuccessful at changing the text colour using MFC. I can make the line bold, underlined or whatever - but I can't color the text. The same task I have easily achieved in native code in the past and cant see any special colour handling functions that seem relevant. I'm more than a little perplexed just now. Here's the (hacked together)code I have for Bolding the target line.

Also, for some reason I had to remove the other flags you'd used in FindText. It wouldn't return a valid hit for the text "_ " unless I did so, too tired to read help docs just at the moment, no doubt such limitations are mentioned in there somewhere.

Of course, if you change the "or equals" to "xor equals" you can toggle the state, rather than just setting it.
Oops! I mean, if you xor the dwEffects with CF_BOLD, instead of setting it - you'll toggle the state of the char formatting.

Also, you should be using SetSelectionCharFormat, SetDefaultCharFormat acts on the whole control, not just the selection.

C++
void CmfcRichEditDlg::OnBnClickedButton3()
{
    // TODO: Add your control notification handler code here
    FINDTEXTEX ft;
    CHARFORMAT cfm;

    ft.chrg.cpMin = 0;
    ft.chrg.cpMax = -1;
    ft.lpstrText = "_ ";

    long n = m_RichEdit.FindText(FR_DOWN, &ft);
    long l = m_RichEdit.LineLength(n);

    m_RichEdit.SetSel(n,l);

    m_RichEdit.GetSelectionCharFormat(cfm);

    cfm.dwMask |= CFM_BOLD;
    cfm.dwEffects = CFE_BOLD;

    m_RichEdit.SetSelectionCharFormat(cfm);
}


modified 6-May-12 16:32pm.

GeneralRe: CRichEditCtrl interface question Pin
enhzflep6-May-12 11:01
enhzflep6-May-12 11:01 
GeneralRe: CRichEditCtrl interface question Pin
ForNow7-May-12 7:24
ForNow7-May-12 7:24 
QuestionCRichEditCtrl FindText problem Pin
ForNow5-May-12 20:24
ForNow5-May-12 20:24 
AnswerRe: CRichEditCtrl FindText problem Pin
enhzflep5-May-12 21:44
enhzflep5-May-12 21:44 
GeneralRe: CRichEditCtrl FindText problem Pin
ForNow6-May-12 5:41
ForNow6-May-12 5:41 
GeneralRe: CRichEditCtrl FindText problem Pin
enhzflep6-May-12 5:54
enhzflep6-May-12 5:54 
QuestionLooping when you need user input Pin
abollmeyer5-May-12 19:25
abollmeyer5-May-12 19:25 
AnswerRe: Looping when you need user input Pin
Code-o-mat5-May-12 23:08
Code-o-mat5-May-12 23:08 
GeneralRe: Looping when you need user input Pin
abollmeyer6-May-12 3:37
abollmeyer6-May-12 3:37 
GeneralRe: Looping when you need user input Pin
enhzflep6-May-12 4:15
enhzflep6-May-12 4:15 
GeneralRe: Looping when you need user input Pin
abollmeyer6-May-12 7:32
abollmeyer6-May-12 7:32 
GeneralRe: Looping when you need user input Pin
enhzflep6-May-12 7:40
enhzflep6-May-12 7:40 
GeneralRe: Looping when you need user input Pin
Code-o-mat7-May-12 4:03
Code-o-mat7-May-12 4:03 
GeneralWelcome Pin
Code-o-mat5-May-12 23:11
Code-o-mat5-May-12 23:11 
Question64 bit problem Pin
appollosputnik4-May-12 4:41
appollosputnik4-May-12 4:41 
AnswerRe: 64 bit problem Pin
Albert Holguin4-May-12 9:58
professionalAlbert Holguin4-May-12 9:58 
AnswerRe: 64 bit problem Pin
«_Superman_»4-May-12 16:43
professional«_Superman_»4-May-12 16:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.