1. Olan Knight
  2. PowerBuilder
  3. Wednesday, 27 July 2022 22:30 PM UTC

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)


 

 

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 28 July 2022 06:04 AM UTC
  2. PowerBuilder
  3. # 1

Hi Olan,

About the Modified() event not being triggered, please read this https://community.appeon.com/index.php/qna/q-a/how-to-detect-a-change-in-the-contents-of-a-richtext-edit-control?limitstart=0#reply-24425 Especially the part "in green color" which is marked the answer.

When I wake up, a couple more coffees, I'll try to find a sample app that I should have somewhere. (though I think there might be also some sample attached in the link above). (Really need to wake-up first :) ).

About saving the rte contents: please use a blob to do that. In the past I've seen that some characters can be changed when saving / retrieving (depending on which database), I'll try to find that link too, but that's going to be more difficult.

Speak to you later!

Comment
  1. Olan Knight
  2. Thursday, 28 July 2022 19:55 PM UTC
Thank you for your response! I'll implement those changes and report back!
  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.