[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Usage of Headings (styles) in a TDBRichEdit.

Posted on 2004-11-09
18
Medium Priority
?
325 Views
Last Modified: 2010-04-06
Hi,

Can anybody tell me how to implement the usage of Headings (styles) in a TDBRichEdit.
(I don't mean headers and footers)

Heading 1 (=Font Arial size 12)
Heading 2 (=Font Arial size 10)

Thanks, please supply code.
Stef
0
Comment
Question by:Stef Merlijn
  • 9
  • 6
  • 3
18 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 12532691
You may develop for yourself a DB-Rich-Editor ....
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 12532784
TDBRichEdit nor TRichedit do not support Styles like Winword :-(

0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12533439
But support Font-attributes like Color, Italic, Bold, Size, Undelined ....
I have an application that stores that into an InterBase database.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Stef Merlijn
ID: 12583198
Emil, I've that already.
I just wanted to add some more functionality to the editor.

Does Richedit support protection for deletion of some of the text in the Richedit?

Like:
Default for a new record I load a RTF-document into the datafield which is related to the Richedit.
  DM.TLogboekOmschrijvingDetail.LoadFromFile(ProgMap + '\Sjablonen\LogboekBasisIndeling.rtf');

I would like to protect only the text which is loaded. These are headings like: What have you learned? or What actions must be taken?
The user can fill in the rest, but shouldn't be able to remove these headings.

Glad to hear from you again.
Stef
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12583449
Hi Stef,

There is an application developed by Borland at:    X:\Program Files\Borland\Delphi7\Demos\RichEdit\richedit.dpr
It is not Database oriented, but it could be easy changed to work with DB ....
It can load and save .rtf files, can change the font attributes of the selected part of the text by using it's Menu Item
Edit, Font which uses FontDialog1 ....
About a protection of part of the text from editting I don't know, it may be possible but ....

Best Regards,
Emil
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 12583470
about protection there is a solution from me here . . . still searching
0
 

Author Comment

by:Stef Merlijn
ID: 12583509
I can wait a little. :-)

Maybe the protection must be done in the loaded RTF already. (fieldcodes or something??)
Then I'll be able to see if the Richedit supports it???

Best regards and fine greetings, Stef
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 1000 total points
ID: 12583531
here it comes, its a solution to protect the first x-lines, maybe its axpandable to your needs

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20887455.html#10380217
0
 

Author Comment

by:Stef Merlijn
ID: 12584086
Well that works if the text to protect is always on the same position. But my users add text between the protected parts.

What have you learned?         <- protected
blablabla blabla bla bla blabla <- added by user
blablabla blabla bla bla blabla <- added by user
blablabla blabla bla bla blabla <- added by user

What actions must be taken?  <- protected
blablabla blabla bla bla blabla <- added by user
blablabla blabla bla bla blabla <- added by user

So the protection must be based on the actual string (f.e. What have you learned?) and not on the position in the Richedit, because the position changes when the user is adding his/her text.
0
 

Author Comment

by:Stef Merlijn
ID: 12612173
Emil and Kretzschmar,

Thanks for thinking with me but I guess I want get an answer to this question.
Shall we split points or withdraw the question?

Regards, Stef
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 12612200
oops, sorry for not responding

do you have any unique token where could be detect,
that the user is in a should prtotected line?

meikl ;-)
0
 

Author Comment

by:Stef Merlijn
ID: 12612277
It's OK. I'm just very disapointed :-)

Yes, I have multiple tokens (see below between ===).
In the lines between the tokens the user can add text freely.
The tokens are already rich-formatted (bold, navy, Arial 10).

============================================
Met welke vraag is de cliënt gekomen?
>> users text

Wat ben je tegen gekomen tijdens de sessie?

Welke aandachtspunten zijn er m.b.t. de technieken?

Wat heb je geleerd van deze sessie?

Welke aandachtpunten zijn er m.b.t. overdracht en tegenoverdracht?

Aanvullende opmerkingen?
============================================

Have a go (in dutch: leef je uit).
Stef
0
 
LVL 27

Assisted Solution

by:kretzschmar
kretzschmar earned 1000 total points
ID: 12612349
well, ok, you could try following

procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if richedit1.selattibutes.color = clNavy then  
    richedit1.ReadOnly := true
  else
    richedit1.ReadOnly := false;
end;

not tried myself

meikl ;-)
0
 

Author Comment

by:Stef Merlijn
ID: 12612402
We have a startingpoint.
But, the user can add his/her text also in navy. And then wouldn't be able to change this afterwards.

Maybe when the user starts editing, somehow the text in the current line will be grabbed and checked if it contains one of the tokens I mentioned. If so, the changes are omitted and user gets message (like: "This line can't be changed").
Just don't know if this will work with rich-formatted tokens.

Stef............
0
 

Author Comment

by:Stef Merlijn
ID: 12612421
I came up with some other problem regarding this.
What if the user selects multiple lines and wants to change some attribute.
How to determine if the protected lines are part of the selection.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 12612510
>What if the user selects multiple lines and wants to change some attribute.

well, this cannot be handled this way.
the richedit api provides also to protect chars,
but i never worked with this.

will do a test this evening

meikl ;-)

0
 

Author Comment

by:Stef Merlijn
ID: 12612525
We'll be in touch. :-)
0
 

Author Comment

by:Stef Merlijn
ID: 12633403
Hi Meikl,
It's becoming a very long evening :-)

Did you come up with something new or is it a headbreaker?

Stef ;;;;;;;
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Loops Section Overview
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month18 days, 16 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question