Announcement

Collapse
No announcement yet.

Custom Dialog Colors Bleed Through Controls

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Dialog Colors Bleed Through Controls

    I have a project I'm working on, and am having an issue with the custom colors of the dialog bleeding through to other controls on the client surface, specifically the status bar, when other windows are moved across the window.
    Code:
        DIALOG NEW PIXELS, hParent, "Test Program", 357, 325, 330, 276, %WS_POPUP _
            OR %WS_BORDER OR %WS_THICKFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
            %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX OR %WS_CLIPSIBLINGS OR _
            %WS_CLIPCHILDREN OR %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR _
            %DS_NOFAILCREATE OR %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT _
            OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
        DIALOG  SET ICON     hDlg, "#" + FORMAT$(%IDR_IMGFILE1)
        DIALOG  SET COLOR    hDlg, %WHITE, RGB(46, 32, 92)
        CONTROL ADD "msctls_statusbar32", hDlg, %IDSB_MAINSTATUS, "Main Status", _
            0, 237, 330, 20, %WS_CHILD OR %WS_VISIBLE, %WS_EX_TRANSPARENT OR _
            %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
        CONTROL ADD TEXTBOX, hDlg, %IDT_BUFFER, "Text Output", 6, 6, 120, 92, _
            %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_VSCROLL OR %ES_LEFT _
            OR %ES_MULTILINE OR %ES_AUTOVSCROLL OR %ES_READONLY, %WS_EX_LEFT OR _
            %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
        CONTROL SET COLOR    hDlg, %IDT_BUFFER, %BLACK, %WHITE
    I can make it refresh if I trap the %WM_NCPAINT command in the callback for the dialog and do a DIALOG REDRAW CB.HNDL, but that causes the too much flicker with the application.

    What am I overlooking?
    Attached Files
    Furcadia, an interesting online MMORPG in which you can create and program your own content.

  • #2
    The window procedure automatically adjusts the size of the status bar whenever it receives a WM_SIZE message. Typically, when the size of the parent window changes, the parent sends a WM_SIZE message to the status bar.
    WM_SIZE processing not shown.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      The colors of the Dialog can not "bleed through". Windows just does not work that way (Unless you are using XP, Vista and using the WS_EX_LAYERED extended style and alphablending the Dialog).

      What you may be experiencing is the repaint cycle and how it works.

      If one does not use the WS_CLIPCHILDREN window style for the parent dialog, then Windows will repaint the entire dialogs background first , even behind the controls, and then repaint the controls afterwards. If the dialogs color is significantly different than the controls colors, then you will see a "flicker effect", where the background of the dialog for a split second appears and then the controls redraw on top. When a dialog is moved or sized or another window is moved over it and reveals part of the dialog, then the repaint process will cause flicker and it may appear like a bleed through.

      The WS_CLIPCHILDREN style tells Windows to only repaint the part of the Dialog which is not under a control. This way there is less flicker.
      Chris Boss
      Computer Workshop
      Developer of "EZGUI"
      http://cwsof.com
      http://twitter.com/EZGUIProGuy

      Comment


      • #4
        Originally posted by Michael Mattias View Post
        WM_SIZE processing not shown.
        Code:
                CASE %WM_SIZE
                    ' Dialog has been resized
                    CONTROL SEND CB.HNDL, %IDSB_MAINSTATUS, CB.MSG, CB.WPARAM, CB.LPARAM
                    LOCAL FormX, FormY, StatusY     AS LONG
                    CONTROL GET SIZE CB.HNDL, %IDSB_MAINSTATUS TO FormX, StatusY
                    DIALOG GET CLIENT CB.HNDL TO FormX, FormY
                    Formy = FormY - StatusY
                    CONTROL SET LOC CB.HNDL, %IDT_BUFFER, 0, 0
                    CONTROL SET SIZE CB.HNDL, %IDT_BUFFER, FormX, FormY
                    DIALOG REDRAW CB.HNDL
        Furcadia, an interesting online MMORPG in which you can create and program your own content.

        Comment


        • #5
          Originally posted by Chris Boss View Post
          The WS_CLIPCHILDREN style tells Windows to only repaint the part of the Dialog which is not under a control. This way there is less flicker.
          Code:
              DIALOG NEW PIXELS, hParent, "Simple Proxy", 357, 325, 330, 276, %WS_POPUP _
                  OR %WS_BORDER OR %WS_THICKFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
                  %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX OR %WS_CLIPSIBLINGS OR _
                  %WS_CLIPCHILDREN OR %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR _
                  %DS_NOFAILCREATE OR %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT _
                  OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
          The attached image is from dragging another window across the dialog.
          Furcadia, an interesting online MMORPG in which you can create and program your own content.

          Comment


          • #6
            It looks like there's a conflict with the redraw where the statusbar get's colored twice, once with the dialog's colors, and then again with the "official" colors, only sometimes it doesn't do the second paint of the control with the official colors.
            Furcadia, an interesting online MMORPG in which you can create and program your own content.

            Comment


            • #7
              Solved: the default %WS_EX_TRANSPARENT from PBFORMS is not needed.
              Furcadia, an interesting online MMORPG in which you can create and program your own content.

              Comment

              Working...
              X