Announcement

Collapse
No announcement yet.

Set Position In Rich Edit

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

  • Danny Faris
    replied
    Borje:

    I have no idea how you keep all those edit messages straight.
    LineFromChar, LineIndex, ExLineFromChar... There must be a
    hundred... Or more! Anyway, I'm sure this will really surprise
    you but... It worked! Thank you so very, very much for your help.

    I'm so sorry it took me so long to get back to you. The morning
    after you posted, I contracted a killer flu that felt like I got
    run over by a 10-ton truck and I'm just getting back to things
    now.

    Anyway, thank you again for all your help. You've saved this
    crazy editor of mine 2 or 3 times from certain doom and
    distruction, and I really appreciate it!

    yDanny.

    Leave a comment:


  • Borje Hagsten
    replied
    Use %EM_EXSETSEL for Rich edit. Following is extracted from POFFS,
    which contains a complete search dialog and code for searching a
    Rich Edit control. Code is Public Domain, free to download from: http://www.tolken99.com/pb/pbfile_e.htm
    Code:
      LOCAL selStart AS LONG, selEnd AS LONG, selLine  AS LONG, visLine AS LONG
      LOCAL selData AS CHARRANGE
     
      SelData.cpMin = SelStart : SelData.cpMax = SelEnd
      CALL SendMessage(hEdit, %EM_EXSETSEL, 0, VARPTR(selData))    '<- set selection
     
      selLine = SendMessage(hEdit, %EM_LINEFROMCHAR, selStart, 0)  '<- get current line
      visLine = SendMessage(hEdit, %EM_GETFIRSTVISIBLELINE, 0, 0)  '<- get top line
      selLine = selLine - visLine - 2                              '<- 2 lines down
      SendMessage hEdit, %EM_LINESCROLL, 0, selLine                '<- scroll to line
    ------------------

    Leave a comment:


  • Danny Faris
    started a topic Set Position In Rich Edit

    Set Position In Rich Edit

    yGreetings everyone.

    I have driven myself half crazy with this one. You guessed it, I'm
    still trying to make that editor I bothered everyone about in the
    summer do things it just doesn't want to do. Only now it's even
    more foreign--i'm dealing with a rich-edit control!

    You see, I'm writing (or trying to write) a small editor. It
    consists of a dialog with 8 pulldowns and a rich-edit control.
    This is so I can open files over 65 K in size.

    OK, for the question. How on Earth do I set the current position
    in the box? I know, why would anyone ever want to do something
    strange like that? Because I have a Go-To-Line feature that jumps
    the user up or down to a specific line. I posted asking how to do
    this before, and one of you clever programmers gave me:

    SendMessage hEdit, %EM_SETSEL, 300, 300

    which used to jump the caret to the three-hundredth character in
    the box. But it doesn't work properly with a rich-edit control,
    the screen doesn't update and it fails to do anything when I
    specify a character over 32768. Does anyone have any ideas at all?

    Thank you! I've spent the last 3 days waiding through stacks of
    API calls that either did nothing, GPFed or were otherwise
    useless. And now I just don't know what to do!

    Danny.
Working...
X