Announcement

Collapse
No announcement yet.

Problem getting CHARFORMAT from Rich Edit, HELP!

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

  • RyanCross
    replied
    Worked like a charm Lance. Thanks!

    ------------------
    Thank you,
    Ryan M. Cross
    Head Webmaster Nofee Inc. Internet Services
    President Likuid Creations Ltd.

    Leave a comment:


  • Lance Edmonds
    replied
    I'm not at my DEV PC to check if this is required, but I think you have to set the .cbSize member of the structure before calling the API.

    I think it's time that we see your code...

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • RyanCross
    replied
    Yeah I added the dummy and removed the 2 extra bytes, but it still has no affect. Does anyone have any Richedit examples they could post? If not I'll try ot throw a small code together for an example of compilable code.

    ------------------
    Thank you,
    Ryan M. Cross
    Head Webmaster Nofee Inc. Internet Services
    President Likuid Creations Ltd.

    Leave a comment:


  • Lance Edmonds
    replied
    As discussed in the thread I noted above - you should not extend the ".szfacename" member by two bytes, but add an additional 2 byte dummy member to the end of the structure.



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Borje Hagsten
    replied
    It seems like RichEdit uses szFaceName + 2 bytes, so you need to
    declare and use the following instead:

    Code:
    TYPE CHARFORMAT2
      cbSize AS LONG
      dwMask AS DWORD
      dwEffects AS DWORD
      yHeight AS LONG
      yOffset AS LONG '* > 0 for superscript, < 0 for subscript *
      crTextColor AS DWORD
      bCharSet AS BYTE
      bPitchAndFamily AS BYTE
      szFaceName AS ASCIIZ * %LF_FACESIZE + 2
    END TYPE
    Then you can use the following example to get the format for
    selected text (taken from a rebuild of PBpad):

    Code:
      LOCAL cf AS CHARFORMAT2
      CALL SendMessage(GetEdit, %EM_GETCHARFORMAT, _
                                  %SCF_SELECTION, VARPTR(cf))
    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    If the UDT structure change did not fix your problem (I gather you read to the bottom of the thread?), then you will need to post compilable code so we can duplicate your problem.

    Thanks!

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • RyanCross
    replied
    No that didn't help, unless I missed something. I can EM_SETCHARFORMAT perfectly fine, just getting CHARFORMAT is the problem.

    ------------------
    Thank you,
    Ryan M. Cross
    Head Webmaster Nofee Inc. Internet Services
    President Likuid Creations Ltd.

    Leave a comment:


  • Lance Edmonds
    replied
    a search of the bbs for "charformat" reveals the following thread that may interest you:



    ------------------
    lance
    powerbasic support
    mailto:[email protected][email protected]</a>

    Leave a comment:


  • RyanCross
    started a topic Problem getting CHARFORMAT from Rich Edit, HELP!

    Problem getting CHARFORMAT from Rich Edit, HELP!

    Okay I'm trying to retrieve the CHARFORMAT of the Selected text of a Rich edit control but for someon reason the code I have won't fill in the CHARFORMAT type:

    CASE %WM_NOTIFY
    SELECT CASE CBWPARAM
    CASE 105
    nh = CBLPARAM
    SELECT CASE @nh.code
    CASE %EN_SELCHANGE
    mask& = SendMessage(GetDlgItem(CBHNDL, 105), %EM_GETCHARFORMAT, 1, VARPTR(cf)))
    END SELECT
    END SELECT

    mask& returns 0 no matter what and all other information returns 0 or "". So the CHARFORMAT type must not be getting filled in. Can anyone post an exnample or please tell me what I'm doing wrong.



    -------------
    Thank you,
    Ryan M. Cross
    Head Webmaster Nofee Inc. Internet Services
    President Likuid Creations Ltd.

Working...
X