Announcement

Collapse
No announcement yet.

Edit text ontop of graphic control(bitmap)?

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

  • Edit text ontop of graphic control(bitmap)?

    Hi,

    Have program that allows user to enter and edit text in a multiline textbox. To make more eligant, add a graphic control with a bitmap.
    Problem is if I just disable graphic control, and add a control redraw,
    when editing text, old text is not erased? Only way I can edit text is to
    kill graphic control. I want user to be able to edit over a bitmap background. Is there any way to do this?

    Here is sample(not executable code):


    Example 1 code kills graphic control, so user can edit text without screen flicker after
    every keypress.

    Example 1 code:
    Code:
        SUB MAINDIALOG 
         CONTROL ADD LABEL,    hDlg, %IDL_COM1,      "C",             13,   76,   5,   9, %SS_LEFT
         CONTROL ADD LABEL,    hDlg, %IDL_COM2,      "omments",       18,   76,  31,   9, %SS_LEFT
         ' Background for below text box %IDT_TEXT, this code must be above (control add textbox)
         CONTROL ADD GRAPHIC, hDlg, %IDG_BACKGRD, "",                 53,   61, 325, 229
         GRAPHIC ATTACH hDlg, %IDG_BACKGRD ', REDRAW
         GRAPHIC RENDER FullCurrentPath+"\BITMAPS\GoldCream325180.bmp", (0,0)-(325, 229)
                                                                           
         CONTROL ADD TEXTBOX,  hDlg, %IDT_TEXT,      "",              58,   74 ,315, 212, _  
          %ES_NOHIDESEL OR %ES_AUTOVSCROLL OR %ES_MULTILINE OR %ES_LEFT _
          OR  %ES_WANTRETURN OR %WS_TABSTOP OR %WS_CHILD OR %WS_VISIBLE, %WS_EX_TRANSPARENT 
          CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), -2&  ' TO SEE BITMAP AS BACKGROUND
        END FUNCTION
    
        CALLBACK FUNCTION MAINDIALOG CALLBACK
    
            ELSEIF CBCTL = %IDT_TEXT THEN '104  THEN  
             CBID = 104
             ' Graphic control is killed in Sub Editor, so user can enter and erase text in %IDT_TEXT
             FUNCTION = 1
             KEYP = 0
    
            ELSEIF CBCTL = %IDG_BACKGRD THEN
             ' User left mouse clicks in Comments box
             ' See %WM_COMMAND, where Sub Editor is called, to disable buttons
             CONTROL DISABLE CBHNDL, %IDG_BACKGRD     ' For Editing
             CONTROL REDRAW CBHNDL, %IDT_TEXT
             CONTROL SET FOCUS CBHNDL, %IDT_TEXT
             FUNCTION = 1
            END IF ' IF CBCT = ...
    
        SUB Editor
                 ' Disabled in CASE %IDG_BACKGRD, so we can kill
                 CONTROL KILL hDlg, %IDG_BACKGRD
                 CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), RGB(255,128,0) 
        END SUB
    Example 2 code only Disables graphic control, so user can edit text, but screen flickers after
    every keypress. Without control redraw, text is smeared or not erased, when editing on bitmap?

    Example 2 code:
    Code:
        SUB MAINDIALOG 
         CONTROL ADD LABEL,    hDlg, %IDL_COM1,      "C",             13,   76,   5,   9, %SS_LEFT
         CONTROL ADD LABEL,    hDlg, %IDL_COM2,      "omments",       18,   76,  31,   9, %SS_LEFT
         ' Background for below text box %IDT_TEXT, this code must be above (control add textbox)
         CONTROL ADD GRAPHIC, hDlg, %IDG_BACKGRD, "",                 53,   61, 325, 229
         GRAPHIC ATTACH hDlg, %IDG_BACKGRD ', REDRAW
         GRAPHIC RENDER FullCurrentPath+"\BITMAPS\GoldCream325180.bmp", (0,0)-(325, 229)
                                                                            
         CONTROL ADD TEXTBOX,  hDlg, %IDT_TEXT,      "",              58,   74 ,315, 212, _  
          %ES_NOHIDESEL OR %ES_AUTOVSCROLL OR %ES_MULTILINE OR %ES_LEFT _
          OR  %ES_WANTRETURN OR %WS_TABSTOP OR %WS_CHILD OR %WS_VISIBLE, %WS_EX_TRANSPARENT 
          CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), -2&  ' TO SEE BITMAP AS BACKGROUND
        END FUNCTION
    
        CALLBACK FUNCTION MAINDIALOG CALLBACK
    
            ELSEIF CBCTL = %IDT_TEXT THEN '104  THEN  
             CBID = 104
             ' Must use CONTROL REDRAW, FOR EDITING, but screen flickers, 1-15-2008
             CONTROL REDRAW CBHNDL, %IDT_TEXT ' Needed if control %IDG_BACKGRD is not killed, flickers
             FUNCTION = 1
             KEYP = 0
    
            ELSEIF CBCTL = %IDG_BACKGRD THEN
             ' User left mouse clicks in Comments box
             ' See %WM_COMMAND, where Sub Editor is called, to disable buttons
             CONTROL DISABLE CBHNDL, %IDG_BACKGRD     ' For Editing
             CONTROL REDRAW CBHNDL, %IDT_TEXT
             CONTROL SET FOCUS CBHNDL, %IDT_TEXT
             FUNCTION = 1
            END IF ' IF CBCT = ...
    
        SUB Editor
                 ' Disabled in CASE %IDG_BACKGRD, so we can kill
                 rem CONTROL KILL hDlg, %IDG_BACKGRD
                 rem CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), RGB(255,128,0) 
        END SUB
    Last edited by BRENT GARDNER; 17 Jan 2008, 04:55 PM. Reason: Formatting and code tags did not work?

  • #2
    I posted the solution to this problem in another thread, where a similiar problem was discussed.

    Read this: http://www.powerbasic.com/support/pb...ad.php?t=36076

    The problem has to do with the WS_EX_TRANSPARENT extended window style. I explain how this style works and the problems it creates in repainting. The solution is quite simple (invalidate the area behind the control.

    In your case, instead of invalidating the dialog, you may have to have invalidate an area on the graphic control.
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment


    • #3
      Your the man!
      Chris, I read post earlier today, but used incorrect code and gave up
      on it. After your recent post, I went back and copied your code and
      my program seems to work. Only problem, it still flickers - but only a
      few lines throught out textbox control. Before, the whole textbox would
      change color and text would disapear and then reappear. When I kill graphic control and then use a color background, there is no flicker, so I'll have to think about which way to go. Here is code I used to get
      program to edit on bitmap:

      EXAMPLE 3 - WORKS - WITH ONLY LINES FLICKERING AND NOT WHOLE CONTROL
      Code:
      SUB MAINDIALOG 
           CONTROL ADD LABEL,    hDlg, %IDL_COM1,      "C",             13,   76,   5,   9, %SS_LEFT
           CONTROL ADD LABEL,    hDlg, %IDL_COM2,      "omments",       18,   76,  31,   9, %SS_LEFT
           ' Background for below text box %IDT_TEXT, this code must be above (control add textbox)
           CONTROL ADD GRAPHIC, hDlg, %IDG_BACKGRD, "",                 53,   61, 325, 229
           GRAPHIC ATTACH hDlg, %IDG_BACKGRD ', REDRAW
           GRAPHIC RENDER FullCurrentPath+"\BITMAPS\GoldCream325180.bmp", (0,0)-(325, 229)
                                                                              
           CONTROL ADD TEXTBOX,  hDlg, %IDT_TEXT,      "",              58,   74 ,315, 212, _  
            %ES_NOHIDESEL OR %ES_AUTOVSCROLL OR %ES_MULTILINE OR %ES_LEFT _
            OR  %ES_WANTRETURN OR %WS_TABSTOP OR %WS_CHILD OR %WS_VISIBLE, %WS_EX_TRANSPARENT 
            CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), -2&  ' TO SEE BITMAP AS BACKGROUND
          END FUNCTION
      
      
          CALLBACK FUNCTION MAINDIALOG CALLBACK
      
              ELSEIF CBCTL = %IDT_TEXT THEN '104  THEN  
               CBID = 104
               ' Must use CONTROL REDRAW, FOR EDITING, but screen flickers, 1-15-2008
               CONTROL REDRAW CBHNDL, %IDT_TEXT ' Needed if control %IDG_BACKGRD is not killed, flickers
               FUNCTION = 1
               KEYP = 0
      
              ELSEIF CBCTL = %IDG_BACKGRD THEN
               ' User left mouse clicks in Comments box
               ' See %WM_COMMAND, where Sub Editor is called, to disable buttons
               CALL ReduceFlicker
               CONTROL SET FOCUS CBHNDL, %IDT_TEXT
               FUNCTION = 1
              END IF
      
          SUB ReduceFlick
             LOCAL rt AS RECT
             GetWindowRect GetDlgItem(hDlg, %IDG_BACKGRD), rt
             ScreenToClient hDlg, BYVAL VARPTR(rt.nLeft)  ' converts first pair
             ScreenToClient hDlg, BYVAL VARPTR(rt.nRight) ' converts second pair
             InvalidateRect hDlg, rt, 1
          END SUB
      
          SUB Editor
                   ' Disabled in CASE %IDG_BACKGRD, so we can kill
                   rem CONTROL KILL hDlg, %IDG_BACKGRD
                   rem CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), RGB(255,128,0) 
          END SUB
      Appreciate your help!
      Brent

      Comment


      • #4
        In above example 3, arrow keys are the only way user can navigate in
        textbox? Can't mouse right click and copy text?
        If I disable graphic control, then left click on a specific letter,
        focus goes there, but at the cost of full textbox flicker?
        Edit 1-18-2008(Friday). Just discovered that the code:
        "GRAPHIC CLEAR -2&" will do the same thing as the
        SUB ReduceFlick in example 3 above?
        Last edited by BRENT GARDNER; 18 Jan 2008, 10:03 AM.

        Comment


        • #5
          Am I doing something wrong?
          Is there a way to edit text over a graphic control with bitmap and still
          be able to left mouse click in text to set focus there and right mouse
          click to select all and copy?

          Comment


          • #6
            I don't know Brent, I did this awhile back, but in SDK, a bitmap on a dialog and a few controls. If I recall, it was a combination of overriding wm_erasebkgnd and wm_ctlcoloredit mesages.

            I did spend about an hour on it to see if I can sand off some of the rust on my fingers, I put your snippets into a compileable demo, but I don't know DDT controls well enough or at least forgot the in's and out's to make it behave the way you want it to. Again, comes down to the same problem, cannot reduce the flicker to zero.

            I'll chew on it a bit more, but beware, I've forgot so much about DDT/SDK programming... so don't hold your breath too long.

            Regards,
            Jules

            Comment


            • #7
              Thanks for your efforts Jules!
              Tried remming each %wm_DRAWITEM etc, but did not reduce flicker.
              Got left mouse click to set focus and able to right click and copy. I had
              %SS_NOTIFY on original control add textbox and then bad fliter code in callback Case. The graphic control has to be DISABLED. Here is
              sample 4:
              EXAMPLE 4 - WORKS - WITH ONLY LINES FLICKERING AND NOT WHOLE CONTROL, now mouse left click sets focus on letter in text.
              Code:
              SUB MAINDIALOG 
                   CONTROL ADD LABEL,    hDlg, %IDL_COM1,      "C",             13,   76,   5,   9, %SS_LEFT
                   CONTROL ADD LABEL,    hDlg, %IDL_COM2,      "omments",       18,   76,  31,   9, %SS_LEFT
                   ' Background for below text box %IDT_TEXT, this code must be above (control add textbox)
                   CONTROL ADD GRAPHIC, hDlg, %IDG_BACKGRD, "",                 53,   61, 325, 229
                   GRAPHIC ATTACH hDlg, %IDG_BACKGRD 
                   GRAPHIC RENDER FullCurrentPath+"\BITMAPS\GoldCream325180.bmp", (0,0)-(325, 229)
                                                                                      
                   CONTROL ADD TEXTBOX,  hDlg, %IDT_TEXT,      "",              58,   74 ,315, 212, _  
                    %ES_NOHIDESEL OR %ES_AUTOVSCROLL OR %ES_MULTILINE OR %ES_LEFT _
                    OR  %ES_WANTRETURN OR %WS_TABSTOP OR %WS_CHILD OR %WS_VISIBLE, %WS_EX_TRANSPARENT 
                    CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), -2&  ' TO SEE BITMAP AS BACKGROUND
                  END FUNCTION
              
              
                  CALLBACK FUNCTION MAINDIALOG CALLBACK
              
                      ELSEIF CBCTL = %IDT_TEXT THEN '104  THEN  
                       CBID = 104
                       ' Must use CONTROL REDRAW, FOR EDITING, but screen flickers, 1-15-2008
                       CONTROL REDRAW CBHNDL, %IDT_TEXT 
                       KEYP = 0
              
                      ELSEIF CBCTL = %IDG_BACKGRD THEN
                       ' User left mouse clicks in Comments box
                       IF OVRCONT <> 1 THEN
                        CONTROL DISABLE CBHNDL, %IDG_BACKGRD
                        OVRCONT = 0
                        GRAPHIC ATTACH CBHNDL, %IDG_BACKGRD
                        GRPAHIC CLEAR -2& ' Does same thing as CALL ReduceFlicker, 1-18-2008
                       END IF
                       CONTROL SET FOCUS CBHNDL, %IDT_TEXT
                      END IF ' IF CBCT = ...
               
                  SUB ReduceFlick
                     'LOCAL rt AS RECT
                     'GetWindowRect GetDlgItem(hDlg, %IDG_BACKGRD), rt
                     'ScreenToClient hDlg, BYVAL VARPTR(rt.nLeft)  ' converts first pair
                     'ScreenToClient hDlg, BYVAL VARPTR(rt.nRight) ' converts second pair
                     'InvalidateRect hDlg, rt, 1
                  END SUB
              
                  SUB Editor
                           ' Disabled in CASE %IDG_BACKGRD, so we can kill
                           rem CONTROL KILL hDlg, %IDG_BACKGRD
                           rem CONTROL SET COLOR hDlg,

              Comment


              • #8
                Hi Brent,

                I replicated the functionality in SDK. Basicially, loaded a bitmap from file and rendered onto the background of a window. Added the edit control on top of it. Basically I cut a snippet of the background image(already a valid bitmap handle) and created a pattern brush that is passed along inside of responding to ctrlcoloredit. There was a couple of notificiations that needed to be trapped in order to redraw the control. Works great, no apparent flicker and the edit control works normally. No resizing of the bitmap or no visual scrollbar was used, if you do, you will need to match the scale and for the scrollbar, you will need to trap another notification to update the control.

                I will have to see if it will work in DDT, I have to fly out late tonight to Texas for the week, so I will spend another couple of hours on it just to have some fun with it. Too cold here to do anything else today.

                Compiled with PB 8.04, bitmap used is 1023x685 pixels, 24bit ( captured from http://www.discoverychannel.ca/jetstream/game/ )
                Here it is in SDK flavor...

                Code:
                '------------------------------------------------------------------------------
                '
                ' Instead of creating a %NULL_BRUSH, I created a pattern brush by using a chunk
                ' of bitmap from where the edit control is going to be shown. This is assuming,
                ' the bitmap is of actual size, and edit control has no border or H/V Scrollbars.
                '
                '------------------------------------------------------------------------------
                #COMPILE EXE
                #INCLUDE "Win32API.inc"
                 
                %IDC_EDIT_1 = 1000
                 
                global hbmp      as dword
                global hMemBmp   as dword
                global hBmpDC    as dword
                 
                '------------------------------------------------------------------------------
                '
                '------------------------------------------------------------------------------
                FUNCTION CaptureBitmapSnippet(Byval hWnd AS DWORD,Byval hBitmap AS DWORD, Byval rc aS RECT ) AS DWORD
                     
                    LOCAL hDC AS DWORD
                    LOCAL hBMDC AS DWORD
                     
                    hDC = GetDC(hWnd)
                    hBMDC = CreateCompatibleDC(hDC)
                     
                    SelectObject hBMDC, hBitmap
                     
                    BitBlt hDC,0,0,rc.nleft,rc.ntop, hBMDC, rc.nright,rc.nbottom, %SRCCOPY
                            
                    FUNCTION = hBitmap
                     
                    ReleaseDC hWnd, hDC
                    DeleteDC hBMDC
                     
                END FUNCTION
                
                 
                '------------------------------------------------------------------------------
                '
                '------------------------------------------------------------------------------
                FUNCTION WINMAIN (BYVAL hInstance AS DWORD, BYVAL hPrevInstance AS DWORD, _
                                  BYVAL lpCmdLine AS ASCIIZ PTR, BYVAL iCmdShow      AS LONG) AS LONG
                 
                    LOCAL Msg       AS tagMsg
                    LOCAL wce       AS WndClassEx
                    LOCAL szAppName AS ASCIIZ * 80
                    LOCAL hWnd      AS DWORD
                 
                    szAppName         = "HelloWin"
                    wce.cbSize        = SIZEOF(wce)
                    wce.STYLE         = %CS_HREDRAW OR %CS_VREDRAW
                    wce.lpfnWndProc   = CODEPTR(WndProc)
                    wce.cbClsExtra    = 0
                    wce.cbWndExtra    = 0
                    wce.hInstance     = hInstance
                    wce.hIcon         = 0
                    wce.hCursor       = LoadCursor(%NULL, BYVAL %IDC_ARROW)
                    wce.hbrBackground = GetStockObject(%WHITE_BRUSH) '%NULL
                    wce.lpszMenuName  = %NULL
                    wce.lpszClassName = VARPTR(szAppName)
                    wce.hIconSm       = LoadIcon(hInstance, BYVAL %IDI_APPLICATION)
                 
                    RegisterClassEx wce
                 
                    ' Create a window using the registered class
                    hWnd = CreateWindow(szAppName, _               ' window class name
                                        "The Hello Program", _     ' window caption
                                        %WS_OVERLAPPEDWINDOW, _    ' window style
                                        250, _                     ' initial x position
                                        100, _                     ' initial y position
                                        500, _                     ' initial x size
                                        420, _                     ' initial y size
                                        %NULL, _                   ' parent window handle
                                        %NULL, _                   ' window menu handle
                                        hInstance, _               ' program instance handle
                                        BYVAL %NULL)               ' creation parameters
                 
                    IF hWnd = 0 THEN  ' exit on failure
                        MSGBOX "Unable to create window"
                        EXIT FUNCTION
                    END IF
                 
                    ' Display the window on the screen
                    ShowWindow hWnd, iCmdShow
                    UpdateWindow hWnd
                 
                    DO WHILE GetMessage(Msg, %NULL, 0, 0)
                        TranslateMessage Msg
                        DispatchMessage Msg
                    LOOP
                    FUNCTION = msg.wParam
                END FUNCTION
                 
                
                '------------------------------------------------------------------------------
                '
                '------------------------------------------------------------------------------
                FUNCTION WndProc (BYVAL hWnd AS DWORD, BYVAL wMsg AS DWORD, _
                                  BYVAL wParam AS DWORD, BYVAL lParam AS LONG) EXPORT AS LONG
                
                 
                    LOCAL hDC       AS DWORD
                    LOCAL pPaint    AS PAINTSTRUCT
                    LOCAL tRect     AS RECT
                    LOCAL ptnmhdr   AS NMHDR PTR
                    LOCAL hInst     AS DWORD,hImage   AS DWORD, hCtl AS DWORD
                    LOCAL wStyle    AS DWORD,wStyleEx AS DWORD
                    LOCAL szCaption AS ASCIIZ*255
                    LOCAL rc        AS RECT
                    LOCAL stxt      AS STRING
                    STATIC hBrush   AS DWORD
                    STATIC pt  AS POINTAPI
                 
                    '---
                    SELECT CASE wMsg
                 
                     '---
                     CASE %WM_CREATE
                 
                        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        '---LOAD BITMAP FROM FILE...
                        STATIC bmpfile AS ASCIIZ*255
                        bmpfile = "jetstream.bmp" + CHR$ (0)   ' convert string to ASCIIZ
                        hBmp = LoadImage(0, bmpfile, %IMAGE_BITMAP, 0, 0, %LR_LOADFROMFILE)
                 
                        STATIC bm AS BITMAP
                        GetObject hBmp, SIZEOF(bm), BYVAL VARPTR(bm)
                        pt.x = bm.bmWidth : pt.y = bm.bmHeight
                        '--resize window to fit actual size <todo: add border and caption offset>
                        MoveWindow hWnd, 100,10,pt.x,pt.y,1
                         
                        '---CAPTURE AREA WHERE THE CONTROL WILL BE POSITIONED...
                        CALL SetRect(rc,500,220,220,100)'area to capture
                        hMemBmp = CaptureBitmapSnippet( hWnd, hBmp, Byval rc ) 'returns a snippet
                        hBrush = CreatePatternBrush( hMemBmp )
                        '---
                         
                        '---add an edit control...
                        hInst = GetModuleHandle(BYVAL %NULL)
                        szCaption = ""
                        CALL SetRect(rc,500,220,220,100)
                 
                        wStyle   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
                                   %WS_VISIBLE OR %ES_LEFT OR %ES_AUTOVSCROLL   OR _
                                   %ES_MULTILINE OR %ES_WANTRETURN 'OR %WS_VSCROLL
                        wStyleEx = 0 '%WS_EX_CLIENTEDGE
                 
                        hCtl = CreateWindowEx(wStyleEx, "EDIT", szCaption,wStyle, _
                                              rc.nLeft,rc.nTop,rc.nRight,rc.nBottom, _
                                              hWnd, %IDC_EDIT_1, hInst, BYVAL %NULL)
                        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         
                        SetTimer hWnd,555, 500, BYVAL %NULL
                         
                     '---
                     CASE %WM_TIMER
                        KillTimer hWnd, 555
                        stxt = "This is your Mission Impossible!       " & $CRLF & _
                               " ## Scroll down to read more ##        " & $CRLF & _
                               "If you accept this mission, you" & $CRLF & _
                               "will need your supernatural papers." & $CRLF & _
                               "You can locate them in your back" & $CRLF & _
                               "pocket on the right side of your" & $CRLF & _
                               "flight suit." & $CRLF & _
                               "This computer will self destruct in " & $CRLF & _
                               "10 seconds...        "
                        SetWindowText  GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL STRPTR(stxt)
                        CALL SetFocus(GetDlgItem(hWnd,%IDC_EDIT_1))
                        FUNCTION =1 :EXIT FUNCTION
                 
                     '---
                     CASE %WM_PAINT
                        hDC = BeginPaint(hWnd, pPaint)
                            'dummy paint cycle
                        EndPaint hWnd, pPaint
                        FUNCTION = 1 :EXIT FUNCTION
                 
                     '---
                     CASE %WM_ERASEBKGND
                        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        hBmpDC = CreateCompatibleDC(wParam)
                        SelectObject hBmpDC, hBmp
                        BitBlt wParam, 0, 0, pt.x, pt.y, hBmpDC, 0, 0, %SRCCOPY
                        DeleteDC hBmpDC
                        FUNCTION = 1 :EXIT FUNCTION
                        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         
                     '---
                     CASE %WM_CTLCOLOREDIT
                        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        SetTextColor wParam, %BLACK
                        SelectObject wParam, hBrush
                        SetBkMode wParam,%TRANSPARENT
                        FUNCTION = hBrush :EXIT FUNCTION
                        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         
                     '---
                     CASE %WM_COMMAND
                           '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            SELECT CASE LOWRD(wParam)
                                CASE %IDC_EDIT_1
                                    SELECT CASE HIWRD(wParam)
                                        CASE %EN_UPDATE,%EN_CHANGE,%EN_VSCROLL
                                            'force background drawing updates...
                                            InvalidateRect GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL 0, 1
                                    END SELECT
                            END SELECT
                           '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      
                     '---
                     CASE %WM_DESTROY
                        PostQuitMessage 0 :EXIT FUNCTION
                        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        DeleteObject hBrush
                        DeleteObject hBmp
                        DeleteOBject hMemBmp
                        '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         
                    END SELECT
                     
                     FUNCTION = DefWindowProc(hWnd, wMsg, wParam, lParam)
                 
                END FUNCTION
                HTH
                Regards,
                Jules
                Last edited by Jules Marchildon; 20 Jan 2008, 11:36 AM.

                Comment


                • #9
                  Jules,

                  Great work! Wish I was knowledgable enough to convert to DDT. Hope
                  you or someone else has time and ability to convert.

                  Thanks,

                  Brent

                  Comment


                  • #10
                    Well, I've been trying to convert Jules code to DDT, but can't get the
                    "PATTERN BRUSH" to show a snippet? Maybe because of "Registered
                    Window class"? Tried without graphic control, but seems code just
                    invalidates entire dialog? Anyone have any ideas how to convert this
                    code, or be able to edit text on a bitmap without "FLICKER"?

                    Thanks,

                    Brent

                    Comment


                    • #11
                      Brent,

                      I converted to DDT, but I'm getting strange behavior with the background drawing. I have to suspect there is something behind the windows dialog scene that is the source of this pain.

                      Regards,
                      Jules

                      Comment

                      Working...
                      X