Does trichview support creation of forms?

General TRichView support forum. Please post your questions here
Post Reply
ove@wis.no
Posts: 9
Joined: Wed Sep 21, 2005 12:17 pm

Does trichview support creation of forms?

Post by ove@wis.no »

Similar to pdf forms or html forms?
I know of the support for OLE editors, but miss something simpler to use if end users should modify their forms.

Best regards
Ove
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can insert any Delphi control in TRichView, not only OleContainer.
It may be a button (TButton), edit box (TEdit), and even a panel with bunch of other components inside.
ove@wis.no
Posts: 9
Joined: Wed Sep 21, 2005 12:17 pm

Post by ove@wis.no »

Hmm, I don't think you understand what I'm looking for.

I'm trying to create something like:
https://skjema.dokumentsikkerhet.no/dok ... BlkID=3661

Is it possible to this with trichview? Do you have any examples similar to this?

Best regards
Ove
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This page contains a number of edit fields (<input type=text>) and bordered areas (<div>), all of them positioned absolutely.
The same effect can be achieved in TRichView using TEdit and tables.
wvd_vegt
Posts: 83
Joined: Tue Aug 30, 2005 7:39 am

Post by wvd_vegt »

Hi,

What is the procedure to insert a delphi control like TEdit into a TRichViewEit?

Btw is it possible to insert a TRichViewEdit too?
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Code: Select all

var edit: TEdit;

edit := TEdit.Create(nil);
edit.Width := 100;
RichViewEdit1.InsertControl('', edit, rvvaBaseline);
Instead of '' you can specify some string identifying this editor.

If you insert a TCheckbox, set its ParentColor = False.

In order to load controls from files of RVF format (this includes copy-pasting and drag&drop) you need to register their classes - one time before the first loading, for example in the initialization section of unit:

Code: Select all

RegisterClass(TEdit).
Events are not stored in the file, so you need to use OnControlAction event to reassign them.
Example of this event can be found in Demos\Delphi\Editors\Editor 1\.

Yes, RichViewEdits can be inserted too, but you need to solve the problem with RVStyle somehow (it cannot be inserted in TRichView, because it is not a visual control). For example, you can create and destroy them using OnControlAction event. Important note: the initial property settings of TRichViewEdit placed on the form at designtime can be different from the initial settings of TRichViewEdits created from code. It is because at designtime they are overriden by the component editor settings (right click, choose "Settings" in the popup menu). At run time, the initial propety settings are set neither in "allow adding styles dynamically" nor in "use a predefined set of styles" mode. The required changes in property values for both modes are shown in this designtime component editor window.

One more issue - drag&drop of inserted components. Unlike all other content, they cannot be dragged automatically (only as a part of larger selection), some code is required for this. I'll post an example in the "Examples, Demos" group today.
ove@wis.no
Posts: 9
Joined: Wed Sep 21, 2005 12:17 pm

Post by ove@wis.no »

Sergey Tkachenko wrote:This page contains a number of edit fields (<input type=text>) and bordered areas (<div>), all of them positioned absolutely.
The same effect can be achieved in TRichView using TEdit and tables.
Yes, I know, but what I'm looking for is that everything is readonly except for the input fields, and that the user can tab between the input fields(I'd rather not use delphi components, but change readonly property of paragraphs)

Sorry for the delay in the tread:-)

Best regards
Ove Halseth
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can use TRichView component (it's read-only). If you insert TEdits in it, user can navigate between them using Tab key.

It's possible to make some part of text read-only in TRichViewEdit. But user still will be able to place caret inside read-only text.
ove@wis.no
Posts: 9
Joined: Wed Sep 21, 2005 12:17 pm

Post by ove@wis.no »

We do not want to use edit controls because, the schema template will be editable to the end user. So we want to keep it simple. The user will use predefined formats on the text in his template(wich behind the scene is tied to readonly/editable) and he will also be able to put merge fields in the schema.

We are almost there with rv/re and schemas, the one thing we miss now is being able to tab between the editable fields. The problem is that it is no way to cancel a KeyDown event. We check for tab in the KeyDown event and want to set focus to the next editable field, and set Key := 0;
But the editor get hold of the TAB keypress any way. We also tried to catch TAB at Form level, but it seems like re does not obey KeyPreview:-(
Any hints?

Best regards
Ove Halseth
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Use OnKeyPress
Post Reply