Thread: Say what is going on with this edit field?

  1. #31
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    ok, got an update on inserting text, courtesy of adrianxw. send the EM_REPLACESEL message. if nothing is selected, it inserts the string at the cursor. a text selection will be replaced by the string.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #32
    Emotionally Unstable DarkViper's Avatar
    Join Date
    Oct 2002
    Posts
    343
    wow benny...your my new best friend

    k, ill save hiliting for next version.

    after this, im ready to post the full version.

    im probably going to be selling this thing a couple versions from now (i was thinking of v2, but then i thought...nah), so this ones gonna be for free. but i still want you guys to be downloading it at my site, im going take down my source so others cant get their hands on it and steal it. but for you two that did help, thanks for everything! its helped alot.

    ok, this EM_REPLACE is really new to me, as ive never heard of it before. how would i be able to use it. because it sounds a little easyer than the other way.

    but everything else i understand. thank you.
    Last edited by DarkViper; 01-14-2003 at 10:39 AM.
    ~DJ DarkViper signing out
    ----------------------------------------
    My Site:
    Black Jaguar Studios

    Languages:
    Fluent English, Starter German, HTML, Javascript, Actionscript, Intermediate PHP

    Verteran Despiser of: ASP, Java, BASIC, Pascal, Cobalt

  3. #33
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>> this EM_REPLACE is really new to me,

    The attached program demonstrates a couple of key edit box messages you will probably want to know about.

    EM_REPLACESEL does exactly what the name suggests - it replaces the currently selected text in an edit box with the text you supply. You may need to use that feature at some time. If there is no currently selected text, the message inserts the text at the cursor position, something else you'll want to do.

    EM_SETSEL is used for selecting text, again, as the names suggests. Again, you may want to that at some time. You can also use EM_SETSEL to move the cursor, so if you want to put the cursor at position 10, use EM_SETSEL with a zero length select range - the cursor will be positioned at the end of the select range, i.e. where you want it.

    There are loads of EM_xxxx messages, have a look at them, if you're going to do a lot of work with edit boxes, you'll need them.

    You may want to fool around with this to get comfortable with the messages. (If you comment out the EM_SETSEL for example - you can position the cursor yourself, and see the insertion work).

    There are no headers or resource files needed.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #34
    Emotionally Unstable DarkViper's Avatar
    Join Date
    Oct 2002
    Posts
    343
    KICK ASS! see, this was extremely helpful, i cant talk right now, i now have ALOT of work to do



    thank you for makeing me understand SendMessage, as it will help me quite a bit in the understanding of alot of functions. thank you VERY much youve made me VERY happy
    ~DJ DarkViper signing out
    ----------------------------------------
    My Site:
    Black Jaguar Studios

    Languages:
    Fluent English, Starter German, HTML, Javascript, Actionscript, Intermediate PHP

    Verteran Despiser of: ASP, Java, BASIC, Pascal, Cobalt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Capture Enter key press in EDIT Box
    By richiev in forum Windows Programming
    Replies: 4
    Last Post: 07-14-2005, 12:03 AM
  2. Buttons + Edit Control
    By jay kay in forum Windows Programming
    Replies: 6
    Last Post: 03-09-2005, 05:36 PM
  3. Subclassed edit not doing what it's supposed to
    By tyouk in forum Windows Programming
    Replies: 8
    Last Post: 01-21-2005, 10:25 PM
  4. Used to be Say what is going on with this edit field?
    By bennyandthejets in forum Windows Programming
    Replies: 5
    Last Post: 01-11-2003, 06:38 AM
  5. Difficulty superclassing EDIT window class
    By cDir in forum Windows Programming
    Replies: 7
    Last Post: 02-21-2002, 05:06 PM