Announcement

Collapse
No announcement yet.

Problem with %WM_CTLCOLOREDIT

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

  • Guest's Avatar
    Guest replied
    E.B. and Semen --

    Thats much better

    Regards
    Peter

    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    Funny, but Edwin 100% right.
    I corrected my sample, posted above and it works on my PC under Win95.

    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest replied
    A similar problem is described in older threads.
    Don't use the transparent and look it up...



    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Thanks Semen

    Regards
    Peter

    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    Yes, it's Windows 95 problem.
    Code:
       #Compile Exe
       #Register None
       #Dim All
       #Include "win32api.inc"
    
       %IDC_EDIT = 100
       $ReadMe = "c:\pbdll60\readme.txt"
    
       CallBack Function DlgProc
          Static hBrush As Long, hEdit As Long
          Select Case CbMsg
             Case %WM_INITDIALOG
                Local Buffer As String, hFile As Long
                hFile = FreeFile
                ErrClear: Open $ReadMe For Binary As hFile
                If Err = 0 Then Get$ hFile, Lof(hFile), Buffer: Close hFile
                Control Add TextBox, CbHndl, %IDC_EDIT, Buffer, 5, 5, 385, 275, _
                    %WS_HSCROLL Or %WS_VSCROLL Or %ES_MULTILINE Or %ES_AUTOHSCROLL Or _
                    %ES_AUTOVSCROLL Or %ES_WANTRETURN, %WS_EX_CLIENTEDGE
                hEdit = GetDlgItem(CbHndl, %IDC_EDIT)
                SetFocus hEdit
                hBrush = CreateSolidBrush(Rgb(192, 255, 255))
             Case %WM_DESTROY
                DeleteObject hBrush
             Case %WM_CTLCOLOREDIT
                If CbLparam = hEdit Then SetBkColor CbWparam, Rgb(192, 255, 255): Function = hBrush
          End Select
       End Function
       
       Function PbMain
          Local hDlg As Long
          Dialog New 0, "",,,400, 300, %WS_SYSMENU Or %WS_MINIMIZEBOX Or %DS_CENTER To hDlg
          Dialog Show Modal hDlg Call DlgProc
       End Function
    [This message has been edited by Semen Matusovski (edited June 05, 2000).]

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Thanks Jules --
    The problem on my win95 - machine is that the text becomes unreadeable when using scroll bars or PageDown. The edit box is not properly updated. Seems to be a win95 - problem.

    Regards
    Peter


    ------------------

    Leave a comment:


  • Jules Marchildon
    replied
    Tested on Win98SE, both scroll bars work fine for me. The only
    strange thing is the TAB key automatically highlights to the end
    of a string to the position of the caret.

    Jules.

    Leave a comment:


  • Guest's Avatar
    Guest started a topic Problem with %WM_CTLCOLOREDIT

    Problem with %WM_CTLCOLOREDIT

    In the following example, try to use the scroll's or PageDown.
    What is wrong?

    Regards
    Peter
    Code:
    #COMPILE EXE
    #INCLUDE "win32api.inc"
     
    DECLARE CALLBACK FUNCTION DlgProc
    DECLARE FUNCTION GetFile(File AS STRING, Buffer AS STRING) AS LONG
     
    %IDC_EDIT = 100
    $ReadMe = "e:\pbdll60\readme.txt"
     
    FUNCTION PBMAIN
     
        LOCAL hDlg AS LONG
        LOCAL Buffer AS STRING
     
        IF GetFile($ReadMe, Buffer) = 0 THEN EXIT FUNCTION
     
        DIALOG NEW 0, "",,,400, 300, %WS_SYSMENU OR %WS_MINIMIZEBOX OR %DS_CENTER TO hDlg
        CONTROL ADD TEXTBOX, hDlg, %IDC_EDIT, Buffer, 5, 5, 385, 275, %WS_HSCROLL OR %WS_VSCROLL OR _
                                   %ES_MULTILINE OR %ES_AUTOHSCROLL OR %ES_AUTOVSCROLL OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE
        CONTROL SET FOCUS hDlg, %IDC_EDIT
        DIALOG SHOW MODAL hDlg CALL DlgProc
     
    END FUNCTION
     
    CALLBACK FUNCTION DlgProc
     
        STATIC hBrush AS LONG, lb AS LOGBRUSH
     
        SELECT CASE CBMSG
        CASE %WM_INITDIALOG
            lb.lbStyle = %BS_SOLID
            lb.lbColor = RGB(192,255,255)
            hBRush = CreateBrushIndirect(lb)
     
        CASE %WM_CTLCOLOREDIT
            SetBkMode CBWPARAM, %TRANSPARENT
            FUNCTION = hBrush
     
        CASE %WM_COMMAND
            SELECT CASE LOWRD(CBWPARAM)
            END SELECT
        END SELECT
     
    END FUNCTION
     
    FUNCTION GetFile(File AS STRING, Buffer AS STRING) AS LONG
     
        LOCAL hFile AS LONG
     
        hFile = FREEFILE
     
        OPEN File FOR BINARY AS hFile
        IF ERR THEN EXIT FUNCTION
        GET$ hFile, LOF(hFile), Buffer
        CLOSE hFile
     
        FUNCTION = 1
     
    END FUNCTION
Working...
X