The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: travism on May 15, 2009, 10:05:27 AM

Title: CreateCaret Disappearing problems...
Post by: travism on May 15, 2009, 10:05:27 AM
So I read some of the CreateCaret stuff on this site and then I figured Id have a go at it, I just have a textbox on my form and in the WM_SETFOCUS i have: (Mind you im using goasm)


invoke CreateCaret,[hWnd],NULL,10,20
invoke ShowCaret,[hWnd]


It works when i run the program and shows a block caret but as soon as I click on the edit box it goes away.. any idea how to make it stay there?
Title: Re: CreateCaret Disappearing problems...
Post by: travism on May 15, 2009, 01:54:08 PM
Ok well I thought I got it working with invoke SetFocus on the editbox but that still doesnt work... Any other ways?
Title: Re: CreateCaret Disappearing problems...
Post by: Tedd on May 15, 2009, 02:57:10 PM
It should work..

on WM_SETFOCUS:
    invoke CreateCaret, .....
    invoke ShowCaret, ...
on WM_KILLFOCUS:
    invoke DestroyCaret


However, that assumes it's your control, if you're trying to do this on an edit control, it will already be handling the caret as well, so there will be some interference.
Title: Re: CreateCaret Disappearing problems...
Post by: travism on May 15, 2009, 03:10:54 PM
Ya I want the caret to be shown as a block in the edit control.. I will try that code some bit, thanks! :)

EDIT: So i tried it and it still doesnt work, as soon as the editbox gets control the caret created goes back to normal. and sometimes depending on if i have the edit set to be focused when the form loads it doesnt even show the created caret. :(
Title: Re: CreateCaret Disappearing problems...
Post by: travism on May 15, 2009, 04:03:25 PM
Hmm ok now its not even working :\...... Is it even possible to keep the caret changed ina  textbox? ive searched the forums and there is like nothing on it..