1 (edited by AD1408 2024-04-16 23:30:24)

Topic: Combo to memo and RTF insert

Hi All,
I was trying to insert combobox item (in this case text) into memo and rtf fields but couldn't do it.
Any help would be appreciated.


Please see the attached sample project:
.

Post's attachments

Attachment icon InsertCB.zip 7.22 kb, 20 downloads since 2024-04-16 

Adam
God... please help me become the person my dog thinks I am.

Re: Combo to memo and RTF insert

Hi AD1408

Use onChange event handler for combo:

procedure frmItems_ComboBox2_OnChange (Sender: TObject);
begin
  frmItems.RichEdit1.Text := frmItems.ComboBox2.Text;
end;

procedure frmItems_ComboBox1_OnChange (Sender: TObject);
begin
  frmItems.Memo1.Text := frmItems.ComboBox1.Text;
end;
Post's attachments

Attachment icon InsertCB.rar 1.02 mb, 32 downloads since 2024-04-16 

Визуальное программирование: блог и телеграм-канал.

Re: Combo to memo and RTF insert

Hi k245,
First of all, thank you very much for your help.........


I think I failed to explain properly what I was trying to do, for this please accept my apologies.
I like to insert more than one combo item at a cursor point on a empty or with a text memo / rtf, where needed.

Adam
God... please help me become the person my dog thinks I am.

Re: Combo to memo and RTF insert

Hi Adam, Hi Konstantin,
Is this the sort of thing you are trying to do? (see attached).
Looking at your project, I couldn't see why you can't just use one table ('phrases') rather than two discrete tables ('phraseplain' and 'phrasertf');  in your example, phrases in both tables are held as plain text and it's only when you copy something into 'frmitems.rtf1' that you can add 'rtf' formatting etc so it just seemed easier to simplify things with one 'phrases' table.
Also, I wasn't sure why you needed to have relationships between the 'items' and the 'phraseplain' and 'phrasertf' tables when they work more as 'standalone lookups'
Or am I missing something in the greater scheme of things!  Probably! big_smile
One issue I can't seem to find a way around is that if you amend the 'rtfnote' field on an existing record by copying in more phrases, it loses any previous formatting that you had - but I seem to remember something like that happening before with one of your projects from a couple of years back.
Regards,
Derek.

Post's attachments

Attachment icon InsertCB1b.zip 340.76 kb, 27 downloads since 2024-04-17 

5 (edited by AD1408 2024-04-17 07:55:15)

Re: Combo to memo and RTF insert

Hi Derek,


Thank you very much........
RTF and memo had a different use scenarios. They needed a different tables (imho) to store different phrases to avoid misuse of phrases.
Due to formatting issue on RTF as you have pointed out, I'll have to think of a different solution.
Once again thanks a lot for your kind help....

Adam
God... please help me become the person my dog thinks I am.