PB2019R3
Windows 10, 64 bit platform
PostgreSQL 12 database
I want to create an object where the user can create a formatted NOTICE or ANNOUNCEMENT. The control should be displayed and the user should be able to enter a header, a detail string, and a footer - all in a freeform manner. Just click onto the control and start typing.
I want to keep the data inside the database, not in an external file. Ideally I would save all three bands as three strings in the database
I've been experimenting with the RTE CONTROL, trying to get ONE string to display, be editable, and then saved. The Control does NOT behave as I would expect. I've tried it with and without the DataSource option engaged. The worst issue is that the rte.Modify event never fires.
// Use the DW as the data source for the RTE
ll_rc = rte_1.DataSource (dw_notice)
ll_rc = rte_1.SelectText (1,1,0,0, Detail!)
ll_rc = rte_1.InputFieldInsert ("text")
Is there a set of sample code somewhere that intelligently shows how to make this happen?
(Yes, I have pounded through the Help for hours.)
Thank You.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Current code:
// Constructor event of the RTE Control
// Use the DW as the data source for the RTE
ll_rc = rte_1.DataSource (dw_notice)
ll_rc = rte_1.SelectText (1,1,0,0, Detail!)
ll_rc = rte_1.InputFieldInsert ("text")
GetFocus event of the RTE Control
this.ScrollToRow (1)
this.displayonly = FALSE
this.Enabled = TRUE
this.HeaderFooter = TRUE
Modified event of the RTE Control
// OKnight, 27-JUL-2022, #5440515: Get the RTE data.
ls_header = rte_1.CopyRtf (FALSE, Header!)
ls_detail = rte_1.CopyRtf (FALSE, Detail!)
ls_footer = rte_1.CopyRtf (FALSE, Footer!)
// Save the data
ll_rc = dw_notice.SetItem (1, "text", ls_detail)
PFC_RETRIEVE event of the DW
ll_rowcount = This.retrieve (is_billFccid)
<more code>
// Populate the RTE
ls_text = this.GetItemString (1, "text")
rte_1.DisplayOnly = FALSE
ll_rc = cb_clear.EVENT Clicked ()
IF (ls_text <> "") THEN
ll_rc = rte_1.PasteRTF (ls_text, Detail!)
END IF
ll_rc = rte_1.ScrollToRow (1)
PFC_PREUPDATE event of the DW
ls_detail = rte_1.CopyRtf (FALSE, Detail!)
CB_CLEAR command button on the tabpage
parent.SetRedraw (FALSE)
ll_rc = rte_1.SelectTextAll (Header!)
ll_rc = rte_1.Clear (TRUE)
ll_rc = rte_1.SelectTextAll (Detail!)
ll_rc = rte_1.Clear (TRUE)
ll_rc = rte_1.SelectTextAll (Footer!)
ll_rc = rte_1.Clear (TRUE)
parent.SetRedraw (TRUE)