Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Richedit control font problem

Richedit control font problem

Scheduled Pinned Locked Moved C / C++ / MFC
csharpvisual-studiographicshelpquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    electronicman_x
    wrote on last edited by
    #1

    I'm using a richedit control in my mdi program w/controlbars and i'm having issues with the font changing on me. I'm using the richedit control to display information in a control bar, this control consists of a tab window with 4 tabs, each being a richedit control (i'm trying for something like the message window in visual studio 6.) I'm having issues setting fonts, i'm able to set them initially but they change on me when certain actions happen within the program. I can get the font to change on me when i run the program, do something to make messages appear, click and highlight the message text, and do another task to make more messages appear. If i only click and not highlight text in that richedit control, the font does not change. There are a few other random events that cause this change but i cannot pinpoint the steps that caused it. Is there some way to set a font permanently for the control? What would be the best place to set a font for this control initially so that it's unlikely to be changed? I'm using Visual Studio 6, with Stingray library. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    B J 2 Replies Last reply
    0
    • E electronicman_x

      I'm using a richedit control in my mdi program w/controlbars and i'm having issues with the font changing on me. I'm using the richedit control to display information in a control bar, this control consists of a tab window with 4 tabs, each being a richedit control (i'm trying for something like the message window in visual studio 6.) I'm having issues setting fonts, i'm able to set them initially but they change on me when certain actions happen within the program. I can get the font to change on me when i run the program, do something to make messages appear, click and highlight the message text, and do another task to make more messages appear. If i only click and not highlight text in that richedit control, the font does not change. There are a few other random events that cause this change but i cannot pinpoint the steps that caused it. Is there some way to set a font permanently for the control? What would be the best place to set a font for this control initially so that it's unlikely to be changed? I'm using Visual Studio 6, with Stingray library. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

      B Offline
      B Offline
      Beer
      wrote on last edited by
      #2

      are you using SetSelectionCharFormat(CHARFORMAT) or SetFont(&CFont, TRUE) ??? also, I assume you were talking about CRichEditCtrl hey

      E 1 Reply Last reply
      0
      • E electronicman_x

        I'm using a richedit control in my mdi program w/controlbars and i'm having issues with the font changing on me. I'm using the richedit control to display information in a control bar, this control consists of a tab window with 4 tabs, each being a richedit control (i'm trying for something like the message window in visual studio 6.) I'm having issues setting fonts, i'm able to set them initially but they change on me when certain actions happen within the program. I can get the font to change on me when i run the program, do something to make messages appear, click and highlight the message text, and do another task to make more messages appear. If i only click and not highlight text in that richedit control, the font does not change. There are a few other random events that cause this change but i cannot pinpoint the steps that caused it. Is there some way to set a font permanently for the control? What would be the best place to set a font for this control initially so that it's unlikely to be changed? I'm using Visual Studio 6, with Stingray library. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

        J Offline
        J Offline
        jhaga
        wrote on last edited by
        #3

        I can not answer your question but I can say that I have spent days trying solve similar problems. Your case complicates this Stingray library from which I have no experience. One idea could be to try to find all CHARFORMAT PARAFORMAT or CHARFORMAT2 PARAFORMAT2 structures and modify their dwMask member. That would give you some control over what is changed. jhaga CodeProject House, Paul Watson wrote: ...and the roar of John Simmons own personal Nascar in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving her *c.* and Deb scoffing chocolates in the corner. ...Good heavens!

        B 1 Reply Last reply
        0
        • J jhaga

          I can not answer your question but I can say that I have spent days trying solve similar problems. Your case complicates this Stingray library from which I have no experience. One idea could be to try to find all CHARFORMAT PARAFORMAT or CHARFORMAT2 PARAFORMAT2 structures and modify their dwMask member. That would give you some control over what is changed. jhaga CodeProject House, Paul Watson wrote: ...and the roar of John Simmons own personal Nascar in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving her *c.* and Deb scoffing chocolates in the corner. ...Good heavens!

          B Offline
          B Offline
          Beer
          wrote on last edited by
          #4

          "One idea could be to try to find all CHARFORMAT PARAFORMAT or CHARFORMAT2 PARAFORMAT2 structures and modify their dwMask member. That would give you some control over what is changed." ???, it would only give it control if that CHARFORMAT was being selected into the A CRichEditCtrl. dwMask should always be filled with all bit flags even if you're not using them, CHARFORMAT cf; cf.dwMask = CFM_COLOR | CFM_FACE | CFM_SIZE | CFM_BOLD | CFM_ITALIC | CFM_STRIKEOUT | CFM_UNDERLINE; or the RTF box will inherit properties from the last CHARFORMAT that was selected into it, or default if none. having all bitwise flags on dwMask then setting dwEffects to 0 like hmmm...( cf.dwEffects = 0; ) will kill all previous styles of the RTF selected font This ensures that no other previous styles are lingering. Alternatively, if you never change the font and are just using the RTF box because it has an autoscroll and CEdit doesn't, you can use SetFont(&CFont, TRUE), then you don't have to worry about all that crap. hey

          J 1 Reply Last reply
          0
          • B Beer

            are you using SetSelectionCharFormat(CHARFORMAT) or SetFont(&CFont, TRUE) ??? also, I assume you were talking about CRichEditCtrl hey

            E Offline
            E Offline
            electronicman_x
            wrote on last edited by
            #5

            Yeah i was using the SetSelectionCharFormat(). I went over my code and apparently i was missing the SetDefaultCharFormat() and it seems to solve the problem. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

            B 1 Reply Last reply
            0
            • E electronicman_x

              Yeah i was using the SetSelectionCharFormat(). I went over my code and apparently i was missing the SetDefaultCharFormat() and it seems to solve the problem. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

              B Offline
              B Offline
              Beer
              wrote on last edited by
              #6

              glad to hear you worked it out hey

              1 Reply Last reply
              0
              • B Beer

                "One idea could be to try to find all CHARFORMAT PARAFORMAT or CHARFORMAT2 PARAFORMAT2 structures and modify their dwMask member. That would give you some control over what is changed." ???, it would only give it control if that CHARFORMAT was being selected into the A CRichEditCtrl. dwMask should always be filled with all bit flags even if you're not using them, CHARFORMAT cf; cf.dwMask = CFM_COLOR | CFM_FACE | CFM_SIZE | CFM_BOLD | CFM_ITALIC | CFM_STRIKEOUT | CFM_UNDERLINE; or the RTF box will inherit properties from the last CHARFORMAT that was selected into it, or default if none. having all bitwise flags on dwMask then setting dwEffects to 0 like hmmm...( cf.dwEffects = 0; ) will kill all previous styles of the RTF selected font This ensures that no other previous styles are lingering. Alternatively, if you never change the font and are just using the RTF box because it has an autoscroll and CEdit doesn't, you can use SetFont(&CFont, TRUE), then you don't have to worry about all that crap. hey

                J Offline
                J Offline
                jhaga
                wrote on last edited by
                #7

                Yes, you are talking about CRichEditCtrl and I am not. Maybe I should start using CRichEditCtrl... jhaga CodeProject House, Paul Watson wrote: ...and the roar of John Simmons own personal Nascar in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving her *c.* and Deb scoffing chocolates in the corner. ...Good heavens!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups