Clear text in media object control

Randall Whiteman

Member
I've added a Media Object control to my form so I can retrieve text from various media object attachments and combine them for the user to view.

I am succesfully using the Insert Text system function to add text to the end of the media object control, then using the Set Cursor Position function to reposition the cursor at the top.

I cannot work out how to clear the text from the media object control. When the user selects a particular grid record they should only see text associated with the selected record but currently the text just adds to the end.

This is frustrating me to no end... hopefully somebody has a simple solution. Thanks in advance.

Regards,
Randall Whiteman
 
Could it be that your Insert Text isn't clearing the 'start' of the text string you build up?

Try setting the first line to ----------- for example, then build your string as you do now?
 
Thanks for your post and suggested solution but it's my understanding (backed up by the code below) that the Insert Text system function simply appends the text to the Media Object control.

In the code below I am clearing the szAttachmentText_ADDTEXT variable before fetching the text from the attachment and subsequently inserting into the Media Object control. The result is the work order and routing attachment text being appended to the end of the media object control when selecting a new grid row rather than clearing the control and only displaying text associated with the newly selected row:
--------------------
=======================================================================
FORM: Work Order Workbench [FIND BROWSE] (W560006A)
=======================================================================
CONTROL: GRID Grid
EVENT: Row is Entered
-----------------------------------------------------------------------

0079 //
0080 // get the work order attachment text and (if found) insert into
0081 // TextAttachments control
0082 VA evt_szAttachmentText_ADDTEXT = ""
0083 Media Object Structures(GT4801, <Default Media Object>, <Get Text>, <Default Text Object>, VA evt_szAttachmentText_ADDTEXT, GC OrderNumber, GC OrTy, GC OrdSuf, FC RecordType_EV01)
0084 If VA evt_szAttachmentText_ADDTEXT is not equal to <Blank> And VA evt_szAttachmentText_ADDTEXT is not equal to <Null>
0085 Insert Text(FC TextAttachments, <Default Text Object>, VA evt_szAttachmentText_ADDTEXT)
0086 End If
0087 //
0088 // loop through the routing and append operation attachment text to the
0089 // TextAttachments control
0090 F3112.Select
GC Order Number = TK Document (Order No, Invoice, etc.)
0091 F3112.Fetch Next
VA evt_szF3112WorkCenter_MCU <- TK Business Unit
VA evt_mnF3112OperationSeq_OPSQ <- TK Sequence Number - Operations
VA evt_szF3112OperationType_OPSC <- TK Type Operation Code
0092 While SV File_IO_Status is equal to CO SUCCESS
0093 VA evt_szAttachmentText_ADDTEXT = ""
0094 Media Object Structures(GT3112A, <Default Media Object>, <Get Text>, <Default Text Object>, VA evt_szAttachmentText_ADDTEXT, VA evt_szF3112WorkCenter_MCU, VA evt_mnF3112OperationSeq_OPSQ, ...)
0095 If VA evt_szAttachmentText_ADDTEXT is not equal to <Blank> And VA evt_szAttachmentText_ADDTEXT is not equal to <Null>
0096 Insert Text(FC TextAttachments, <Default Text Object>, VA evt_szAttachmentText_ADDTEXT)
0097 End If
0098 //
0099 F3112.Fetch Next
VA evt_szF3112WorkCenter_MCU <- TK Business Unit
VA evt_mnF3112OperationSeq_OPSQ <- TK Sequence Number - Operations
VA evt_szF3112OperationType_OPSC <- TK Type Operation Code
0100 End While
0101 Set Cursor Position(FC TextAttachments, <Default Text Object>, <HOME>)
0102 //
--------------------

I've tried the following:
- setting the TextAttachments control to empty string "" in variable assignment (validation error: Form Control with NO szDict assigned)
- using system function Delete Item (didn't work and I've since read that this deletes media object records from the F00165 table but I'm not saving the media object, just using it to combine text from various attachments to display to the user)
- searching JDEList forums
- searching Oracle Metalink
- using an Edit control instead (this could work but text was appended without carriage return so it was not possible to differentiage between the different attachment text. Haven't worked out how to include a carriage return in the edit control)

Any other ideas?

Thanks,
Randall.
 
Hello Randall,
Surely it is no longer relevant for you but it might be relevant for somebody in 8 years :)

In Dialog Initialized event
Code:
Hide the Viewer Icon Panel(FC Media Object WC, <Yes>)

In media object text change event
Code:
//
// Clear Media Object Control
VA evt_status = 0
VA evt_KeyValueSerialNumber = -999
Media Object Structures(GT01131, FC Media Object WC, <Display>, <First Text Item>, VA evt_KeyValueSerialNumber, VA evt_KeyValueSerialNumber)
//
Dynamic Multi-Level Error Msg Template Substitution
Insert Text(FC Media Object WC, <Default Text Object>, VA evt_PPATText)
//
 
Back
Top