No announcement yet.

RICHEDIT behaves little different in PB9

  • Filter
  • Time
  • Show
Clear All
new posts

  • RICHEDIT behaves little different in PB9

    Hi all,

    I have strange behave into a RICHEDIT control that in PB803 was working fine while in PB9 have some focus problem.
    In PB9, if the window having the RICHEDIT inside it is moved from foreground to background to foregound again, when it gets focus, the richedit control cursor moves to the last line and all the text inside RICHEDIT is selected.
    This behave is not present if I compile the project with PB803

    I cannot post the source code because it is part of a big project. Trying to replicate into a simple program seems working fine so I'm sure it is 100% a problem from my side maybe related to the new way to catch NOTIFICATIONs messages in control callbacks.

    Any idea of what message can fire such behave?

    Thanks a lot

  • #2
    DDT or SDK?

    If DDT I know nothing.

    If SDK, you might look for changes in the Windows' header files from release to release, specifically for LONG/DWORD changes or changes in UDT definitions.

    Try compiling/running with previous versions of header files and see if problem appears. At least that will tell you if it's something in the header files which has changed which has caused the behavior change.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]


    • #3
      Using the DDT code below there is a difference in the behaviour when compiled with PBWin90 and PBWin804.
      It doesn't seem to be related to the header files.

      Try commenting out the %ES_NOHIDESEL style and/or the Button control then compile with each compiler and test by moving the window to the background and back again..
      #Include "WIN32API.INC"
      #Include "RICHEDIT.INC"
      Declare CallBack Function DIALOGProc()
      Function PbMain()
       Local hDlg As Dword, hLib As Dword
       hLib = LoadLibrary("RICHED32.DLL")
        Dialog New 0, "RichEdit Test5", 200, 200, 225, 140, %WS_SYSMENU To hDlg
          Control Add "RichEdit", hDlg, 1001, "", 10, 10, 205, 85, %WS_CHILD Or _
          Control Add Button, hDlg, 1002, "Button1", 145, 100, 50, 15          'try w/without Button
        Dialog Show Modal hDlg, Call DIALOGProc
       FreeLibrary hLib
      End Function
      CallBack Function DIALOGProc()
       Local hRichEdit As Dword, cr As CHARRANGE
        Select Case CbMsg
          Case %WM_INITDIALOG
            Control Set Text CbHndl, 1001, "Some text for testing"
            Dialog Post CbHndl, %WM_USER + 1000, 0, 0
          Case %WM_USER + 1000
            Control Set Text CbHndl, 1001, "Some text for testing"
            cr.cpMin = 5 : cr.cpMax = 9
            Control Send CbHndl, 1001, %EM_EXSETSEL, 0, VARPTR(cr)
            Dialog Set Text CbHndl, "Focus " + Str$(GetDlgCtrlID(GetFocus()))
        End Select
      End Function
      Rgds, Dave


      • #4
        I know alllll tooo well "Part of a larger project" because I have been caught there many times, until I could figure out how to demo. (and hence ideas how to not get caught again), but its been a slow process.

        If you can break something down, even if it just shows you the differences from one version to is a well worth idea to persue

        (I find it myself, when trying to tear down an example just to find I should have done did I not see that before???)
        Engineer's Motto: If it aint broke take it apart and fix it

        "If at 1st you don't succeed... call it version 1.0"

        "Half of Programming is coding"....."The other 90% is DEBUGGING"

        "Document my code????" .... "WHYYY??? do you think they call it CODE? "


        • #5
          Thanks all.
          Code is DDT. %ES_NOHIDESEL didn't make any difference.

          I will try to break down my code into something I can post.