Lazarus

Programming => Packages and Libraries => Ported from Delphi/Kylix => Topic started by: antonio on June 24, 2007, 01:41:46 am

Title: How do I implement a cross-platform caret?
Post by: antonio on June 24, 2007, 01:41:46 am
I have a component where I implement a caret for a window by Windows API calls (CreateCaret, ShowCaret, etc). What should I do to make this component work on Linux?
Title: RE: How do I implement a cross-platform caret?
Post by: theo on June 24, 2007, 03:10:17 am
Why not make it a simple Fillrect basically?
Title: RE: How do I implement a cross-platform caret?
Post by: antonio on June 24, 2007, 03:49:30 am
Drawing the caret myself? Do you think it's a good approach?
Title: Re: RE: How do I implement a cross-platform caret?
Post by: theo on June 24, 2007, 05:03:10 am
Quote from: "antonio"
Drawing the caret myself? Do you think it's a good approach?


Why not? I do this in my RichEdit thingie and I see no problems.
Invalidate just the Rect where the caret is blinking.
I can't see any "magic" in this. It's just a vertical line.
Title: RE: Re: RE: How do I implement a cross-platform caret?
Post by: antonio on June 24, 2007, 07:50:59 am
How do you handle the selection on this control?
Title: Re: RE: Re: RE: How do I implement a cross-platform caret?
Post by: theo on June 24, 2007, 11:52:20 am
Quote from: "antonio"
How do you handle the selection on this control?


What exactly do you want to know?
Title: RE: Re: RE: Re: RE: How do I implement a cross-platform car
Post by: antonio on June 24, 2007, 05:16:36 pm
About the algorithm. In my control, I didn't handle selection at all.
Title: RE: Re: RE: Re: RE: How do I implement a cross-platform car
Post by: theo on June 24, 2007, 06:57:58 pm
Have a look at the Synedit sources.
There the CreateCaret etc. functions from LCLIntf are used.
Title: RE: Re: RE: Re: RE: How do I implement a cross-platform car
Post by: antonio on June 24, 2007, 10:01:04 pm
Thanks.
Title: RE: Re: RE: Re: RE: How do I implement a cross-platform car
Post by: Marc on June 25, 2007, 03:22:00 pm
Indeed, in order to get synedit to work, we needed to implement our own Caret handling functions :)
Title: RE: Re: RE: Re: RE: How do I implement a cross-platform car
Post by: antonio on June 25, 2007, 04:10:22 pm
Is the caret implemented in a different way to Linux and Windows?
Title: RE: Re: RE: Re: RE: How do I implement a cross-platform car
Post by: Marc on June 25, 2007, 04:34:44 pm
in windows the real caret is used, in linux it is simulated. The LCLIntf winapi functions are a replacement for common used winapifunctions. On windows they are redirected tothe real winapi function, on other widgetsets they are implemented ourselves, but should behave the same.
Note that you cannot set the caret on all controls on linux.
Title: RE: Re: RE: Re: RE: How do I implement a cross-platform car
Post by: antonio on June 25, 2007, 04:44:21 pm
Thanks.
TinyPortal © 2005-2018