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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Questions about EM_SETWORDBREAKPROC message and EDITWORDBREAKPROCA function

Questions about EM_SETWORDBREAKPROC message and EDITWORDBREAKPROCA function

Scheduled Pinned Locked Moved C / C++ / MFC
help
22 Posts 3 Posters 7 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.
  • L Lost User

    I have created a similar test (although not MFC), and it appears to work. Remember that the callback will not get called until the edit control is trying to reformat some text to fit in the window. I tested mine just by dragging the right hand edge to make the window narrower. As soon as a word needed to be broken, the callback got actioned.

    F Offline
    F Offline
    ForNow
    wrote on last edited by
    #10

    Richard thanks for the help let me explain my problem I am trying to dump data from my z/os machine on a editctrl the data has 0x0a ns 0x0d and 0x0c causing a break where I dont want to I do have a 0x0a 0ad to break a line. need to think If I can use the wordbreak to resolve this issue thanks

    L 1 Reply Last reply
    0
    • F ForNow

      Richard thanks for the help let me explain my problem I am trying to dump data from my z/os machine on a editctrl the data has 0x0a ns 0x0d and 0x0c causing a break where I dont want to I do have a 0x0a 0ad to break a line. need to think If I can use the wordbreak to resolve this issue thanks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #11

      I do not think that is what you need. The EDITWORDBREAKPROC function is only called at the point where the control needs to decide whether to split a word or not. Searching for line break characters is a different issue and will depend on exactly how you are trying to reformat it.

      F 1 Reply Last reply
      0
      • L Lost User

        I do not think that is what you need. The EDITWORDBREAKPROC function is only called at the point where the control needs to decide whether to split a word or not. Searching for line break characters is a different issue and will depend on exactly how you are trying to reformat it.

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #12

        Richard I have to think if there is a way to drive the callback proc before I display the data let me explain the data is in the following format 2E000 XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX * * from the 2E000 till the first * is hex data in printable format so O know for sure there is no any 0x0a x0d or x0c line feed between the two * there might be I am just trying to think if there is a way of drving the callback as from what I understand it gives the user the ability to decide when to line break need to think about it thanks

        L 1 Reply Last reply
        0
        • F ForNow

          Richard I have to think if there is a way to drive the callback proc before I display the data let me explain the data is in the following format 2E000 XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX * * from the 2E000 till the first * is hex data in printable format so O know for sure there is no any 0x0a x0d or x0c line feed between the two * there might be I am just trying to think if there is a way of drving the callback as from what I understand it gives the user the ability to decide when to line break need to think about it thanks

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #13

          But as I mentioned above, the callback is only actioned when the control is trying to update the display, and a word cannot fit in the existing space. If you do not register a callback then the control will use spaces between words and existing line break sequences. Your issue quite different as far as I understand it, but it is not clear what you are trying to achieve in your text display.

          F 1 Reply Last reply
          0
          • L Lost User

            But as I mentioned above, the callback is only actioned when the control is trying to update the display, and a word cannot fit in the existing space. If you do not register a callback then the control will use spaces between words and existing line break sequences. Your issue quite different as far as I understand it, but it is not clear what you are trying to achieve in your text display.

            F Offline
            F Offline
            ForNow
            wrote on last edited by
            #14

            I am trying to display storage from my Z/os Server in the following format a 32 bit address in printable format which is 8 bytes then 16 bytes of storage in printable format 4 groups 4 bytes separated by spaces then within * * the raw hex data at this point i would like to line break I have to look at the streamin says

            The control calls the callback function repeatedly, transferring a portion of the data with each call.

            just wondering if each call would be a line need to think

            L 1 Reply Last reply
            0
            • F ForNow

              I am trying to display storage from my Z/os Server in the following format a 32 bit address in printable format which is 8 bytes then 16 bytes of storage in printable format 4 groups 4 bytes separated by spaces then within * * the raw hex data at this point i would like to line break I have to look at the streamin says

              The control calls the callback function repeatedly, transferring a portion of the data with each call.

              just wondering if each call would be a line need to think

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #15

              I have not used STREAMIN but looking at the documentation at EDITSTREAMCALLBACK (richedit.h) - Win32 apps | Microsoft Docs[^], it suggests that your callback method controls how much, and what format, each block of text takes. So that looks a much better bet than wordbreak.

              F 1 Reply Last reply
              0
              • L Lost User

                I have not used STREAMIN but looking at the documentation at EDITSTREAMCALLBACK (richedit.h) - Win32 apps | Microsoft Docs[^], it suggests that your callback method controls how much, and what format, each block of text takes. So that looks a much better bet than wordbreak.

                F Offline
                F Offline
                ForNow
                wrote on last edited by
                #16

                Richard when while writing my debugger I was display the assembler source code in a richedit I marked off the end of line with /r/n Now I am at the point of display storage did the same typically storage is displayed with printable portion to the left and raw hex data to the right I would mark off the end of each line with 0x0a 0x0d the problem when the raw hex data contains 0x0a 0x0d or 0x0c I am not sure if you return to richedit with what you think is line if it will break that way have to think about this thanks for your help

                L 2 Replies Last reply
                0
                • F ForNow

                  Richard when while writing my debugger I was display the assembler source code in a richedit I marked off the end of line with /r/n Now I am at the point of display storage did the same typically storage is displayed with printable portion to the left and raw hex data to the right I would mark off the end of each line with 0x0a 0x0d the problem when the raw hex data contains 0x0a 0x0d or 0x0c I am not sure if you return to richedit with what you think is line if it will break that way have to think about this thanks for your help

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #17

                  Hi, If you decide to modify the word/line breaking behavior then it might help to look at how Chromium does it[^]. Richard MacCutchan mentioned modification of the input stream to normalize the line breaks. I think it's worth exploring that idea. Best Wishes, -David Delaune

                  1 Reply Last reply
                  0
                  • F ForNow

                    Richard when while writing my debugger I was display the assembler source code in a richedit I marked off the end of line with /r/n Now I am at the point of display storage did the same typically storage is displayed with printable portion to the left and raw hex data to the right I would mark off the end of each line with 0x0a 0x0d the problem when the raw hex data contains 0x0a 0x0d or 0x0c I am not sure if you return to richedit with what you think is line if it will break that way have to think about this thanks for your help

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #18

                    You should convert the raw data to its hex equivalent (like hex editors do it) so the line breaks do not affect the display.

                    F 2 Replies Last reply
                    0
                    • L Lost User

                      You should convert the raw data to its hex equivalent (like hex editors do it) so the line breaks do not affect the display.

                      F Offline
                      F Offline
                      ForNow
                      wrote on last edited by
                      #19

                      thats what I am currently doing thanks

                      1 Reply Last reply
                      0
                      • L Lost User

                        You should convert the raw data to its hex equivalent (like hex editors do it) so the line breaks do not affect the display.

                        F Offline
                        F Offline
                        ForNow
                        wrote on last edited by
                        #20

                        Richard Siad the wordline break is invoked only what he tried to resize it i.e. once It has been displayed and user narrows the richedit If there is way to invoke the wordlinebreak proc before the display that would be helpful thanks

                        L 1 Reply Last reply
                        0
                        • F ForNow

                          Richard Siad the wordline break is invoked only what he tried to resize it i.e. once It has been displayed and user narrows the richedit If there is way to invoke the wordlinebreak proc before the display that would be helpful thanks

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #21

                          I am not aware of any way you could do this, since there are no words that need breaking until they are displayed. You may need to consider other options, both of which require you to do all the display handling yourself: 1. Make your display a fixed width based on the font you are using and the amount of data you wish to display. 2. Rebuild the entire display whenever the Window is resized. It may be possible to implement the above by subclassing the RichEdit control, although I have never done that in MFC.

                          F 1 Reply Last reply
                          0
                          • L Lost User

                            I am not aware of any way you could do this, since there are no words that need breaking until they are displayed. You may need to consider other options, both of which require you to do all the display handling yourself: 1. Make your display a fixed width based on the font you are using and the amount of data you wish to display. 2. Rebuild the entire display whenever the Window is resized. It may be possible to implement the above by subclassing the RichEdit control, although I have never done that in MFC.

                            F Offline
                            F Offline
                            ForNow
                            wrote on last edited by
                            #22

                            Richard My display is fixed width as it is Courier new I know that exact number of characters in the width of a line (wonder if ShowWindow(SW_HIDE) would drive edit editwordbreakproc) I am just wondering if there is another way and causes line breaks other than 0x0a, 0x0d, 0x0c I have to think about this

                            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