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. dialog contents disappear when covered, reappear when moved

dialog contents disappear when covered, reappear when moved

Scheduled Pinned Locked Moved C / C++ / MFC
questionhtmlhelp
2 Posts 2 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.
  • P Offline
    P Offline
    permutations
    wrote on last edited by
    #1

    I have a dialog box that's mostly working except for one thing. Under certain circumstances, if another window covers it for any reason, then when it's unhidden there is nothing in the dialog box until you move it slightly - no controls at all, just a gray background. I figure I need to stick an Invalidate() somewhere, but I can't figure out where. The dialog box has a rich edit control and a bunch of buttons. Some of the buttons load different HTML files into the rich edit control (the HTML is converted to rich text). One of the buttons hides the rich edit control and displays a jpeg (which was easier than trying to load the jpeg into the rich edit control). One of the buttons prints whatever is displayed. If it's a rich edit control, it prints what's in it. If it's the jpeg, it prints that. All this is working. I handle WM_PAINT so the jpeg is continually displayed if the window is resized or moved. OnPaint() checks the report type being displayed, and then if it's the image, it redisplays the image. To fix the disappearing dialog controls after the window is hidden I added a handler for ON_ERASEBKGND that basically does the same thing as OnPaint(). If the jpeg is the current report, it redraws the jpeg. This works - but only for the jpeg. If the currently displayed report is in a rich edit control, every control in the dialog disappears after it's covered by another window - including the buttons. I've tried every combination of return values I can think of (0, 1, calling the base method), but nothing restores the controls except moving the dialog. What am I missing? How do I get the dialog to redraw after being hidden when the rich edit control is being displayed?

    C 1 Reply Last reply
    0
    • P permutations

      I have a dialog box that's mostly working except for one thing. Under certain circumstances, if another window covers it for any reason, then when it's unhidden there is nothing in the dialog box until you move it slightly - no controls at all, just a gray background. I figure I need to stick an Invalidate() somewhere, but I can't figure out where. The dialog box has a rich edit control and a bunch of buttons. Some of the buttons load different HTML files into the rich edit control (the HTML is converted to rich text). One of the buttons hides the rich edit control and displays a jpeg (which was easier than trying to load the jpeg into the rich edit control). One of the buttons prints whatever is displayed. If it's a rich edit control, it prints what's in it. If it's the jpeg, it prints that. All this is working. I handle WM_PAINT so the jpeg is continually displayed if the window is resized or moved. OnPaint() checks the report type being displayed, and then if it's the image, it redisplays the image. To fix the disappearing dialog controls after the window is hidden I added a handler for ON_ERASEBKGND that basically does the same thing as OnPaint(). If the jpeg is the current report, it redraws the jpeg. This works - but only for the jpeg. If the currently displayed report is in a rich edit control, every control in the dialog disappears after it's covered by another window - including the buttons. I've tried every combination of return values I can think of (0, 1, calling the base method), but nothing restores the controls except moving the dialog. What am I missing? How do I get the dialog to redraw after being hidden when the rich edit control is being displayed?

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      Does your dialog have the "clip children" style set? If no, try enabling it and see if it helps.

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <

      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