Recent

Author Topic: [Solved] lzRichEdit  (Read 5610 times)

JSN

  • Jr. Member
  • **
  • Posts: 53
[Solved] lzRichEdit
« on: August 21, 2014, 02:31:05 am »
I have installed the component lzRichEdit. The example included loads from a file and saves to a file. I need to be able to load/save RichEdit content within a table in Firebird.

Is there a Tutorial that loads and saves lzRichEdit content within a table?

Lazarus Version 1.2.4
Firebird Version 2.5.3.26778.0
« Last Edit: August 24, 2014, 06:21:39 am by JSN »

JSN

  • Jr. Member
  • **
  • Posts: 53
Re: lzRichEdit
« Reply #1 on: August 23, 2014, 01:56:01 am »
In addition to needing an example or tutorial on how to read/save RichEdit content to a database, I need to change the Color of TlzRichEdit. I tried Typecasting TlzRichEdit and nothing I do is changing the color. Obviously I am not a component writer.

Can someone help me with read/save RichEdt content to database and changing the Color of TlzRichEdit?

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: lzRichEdit
« Reply #2 on: August 23, 2014, 02:07:33 am »
Can someone help me with  changing the Color of TlzRichEdit?

Here an example:

Code: [Select]
SendMessage( lzRichEdit1.Handle, EM_SETBKGNDCOLOR, 0, RGB( 123,43,143 ) );

or

Code: [Select]
SendMessage( lzRichEdit1.Handle, EM_SETBKGNDCOLOR, 0, ColorToRGB(clYellow) );
« Last Edit: August 23, 2014, 02:09:51 am by typo »

JSN

  • Jr. Member
  • **
  • Posts: 53
Re: lzRichEdit
« Reply #3 on: August 23, 2014, 02:16:40 am »
Where is SendMessage defined?

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: lzRichEdit
« Reply #4 on: August 23, 2014, 02:22:14 am »
On Windows unit, but you can find it by yourself by right-clicking the compiler message and choosing Find Identifier.

JSN

  • Jr. Member
  • **
  • Posts: 53
Re: lzRichEdit
« Reply #5 on: August 23, 2014, 02:30:18 am »
If I include Windows in the uses clause, it reports a Syntax Error on "ClientToScreen(Point(X,Y));". Without Windows, "ClientToScreen(Point(X,Y));" compiles as expected. What gives?

JSN

  • Jr. Member
  • **
  • Posts: 53
Re: lzRichEdit
« Reply #6 on: August 23, 2014, 02:46:09 am »
If I right-click SendMessage when it doesn't compile, I click on "Find Declaration" and nothing happens.

What am I doing wrong? Why does a simple call to change a component color have to be rocket science?

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: lzRichEdit
« Reply #7 on: August 23, 2014, 02:48:31 am »
State Point like this:

Code: [Select]
ClientToScreen(Classes.Point(X, Y)); 

What am I doing wrong? Why does a simple call to change a component color have to be rocket science?

You are doing nothing wrong, the problem is that BackgrondColor is not implemented yet on lzRichEdit.

If I right-click SendMessage when it doesn't compile, I click on "Find Declaration" and nothing happens.

A dialog box should appear (not modal).
« Last Edit: August 23, 2014, 02:55:20 am by typo »

JSN

  • Jr. Member
  • **
  • Posts: 53
Re: lzRichEdit
« Reply #8 on: August 23, 2014, 02:57:21 am »
Thank you very much, Typo, that works beautifully. Still scratching my head, but thank you for holding my hand.

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: lzRichEdit
« Reply #9 on: August 23, 2014, 09:16:50 pm »
On the loading/saving from/to database matter, perhaps this can help:

http://stackoverflow.com/questions/4074383/loading-rtf-text-from-database-into-trichedit

You can see a loading/saving example from/to a Memo control in the zip file attached.

JSN

  • Jr. Member
  • **
  • Posts: 53
Re: lzRichEdit
« Reply #10 on: August 24, 2014, 01:46:49 am »
Thank you for the link and example, Typo. I will be studying all of this information and then try to implement it into the appI am working on. I'll let you know what results I get.

Thanks, again.

rvk

  • Hero Member
  • *****
  • Posts: 6163
Re: lzRichEdit
« Reply #11 on: August 24, 2014, 02:18:55 am »
If I include Windows in the uses clause, it reports a Syntax Error on "ClientToScreen(Point(X,Y));". Without Windows, "ClientToScreen(Point(X,Y));" compiles as expected. What gives?
B.T.W. instead of putting Classes. before Point (Like typo showed you) you could also put windows before Classes in the uses clause. The Windows-unit also defines a type named Point which conflict with the one from Classes. So if you put windows before Classes in the uses clause the Point of Classes is taken (instead of the one from windows). When having a big unit (or lots of units) this is an easier approach than changing all the Point's to Classes.Point.

JSN

  • Jr. Member
  • **
  • Posts: 53
Re: lzRichEdit
« Reply #12 on: August 24, 2014, 06:20:33 am »
On the loading/saving from/to database matter, perhaps this can help:

http://stackoverflow.com/questions/4074383/loading-rtf-text-from-database-into-trichedit

You can see a loading/saving example from/to a Memo control in the zip file attached.

Once I understood what was happening, your suggestion worked great. Thank you, Typo.

If I include Windows in the uses clause, it reports a Syntax Error on "ClientToScreen(Point(X,Y));". Without Windows, "ClientToScreen(Point(X,Y));" compiles as expected. What gives?
B.T.W. instead of putting Classes. before Point (Like typo showed you) you could also put windows before Classes in the uses clause. The Windows-unit also defines a type named Point which conflict with the one from Classes. So if you put windows before Classes in the uses clause the Point of Classes is taken (instead of the one from windows). When having a big unit (or lots of units) this is an easier approach than changing all the Point's to Classes.Point.

Thank you for the tip, RVK, I tried it and it works.

 

TinyPortal © 2005-2018