[lazarus] Need your thoughts on Caret

Micha Nelissen M.Nelissen at student.tue.nl
Mon Aug 11 17:06:27 EDT 2003


Marc Weustink wrote:

> At 20:56 11-8-2003 +0200, Micha Nelissen wrote:
> 
>> Hi,
>>
>> The SynEdit creates a caret to display. This is implemented in the 
>> win32 interface, but the win32 interface needs it to be created on 
>> *every* setfocus. That is, when you lose focus, you hide & destroy 
>> your caret, then when you get focus, you need to create & show the 
>> caret. Help from win32sdk on ShowCaret:
>>
>> <snip>
>> ShowCaret shows the caret only if the specified window owns the caret, 
>> the caret has a shape, and the caret has not been hidden two or more 
>> times in a row. If one or more of these conditions is not met, 
>> ShowCaret does nothing and returns FALSE.
>> </snip>
>>
>> If you trace code flow you will see that ShowCaret indeed returns 
>> false most of the time if not always.
> 
> 
> What is the case, why is it false ?
> You're not the owner ?

Yes.

> It has no shape ?

No, CreateCaret returns true when it's called, but that's only once.

> It't is pretty good hidden ?

If Hide / Show are balanced well, this should not be a problem.

>> Since this involves more than simply adjusting the win32 interface, I 
>> ask for your thoughts on this.
> 
> 
> Why adjusting the interface ?

It's the win32 api that is quirky on this, I mean the fact that you have 
to recreate and destroy your caret continously.

Regards,

Micha.






More information about the Lazarus mailing list