Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Clearing a wrapped form field
Clearing a wrapped form field [message #1741780] Mon, 29 August 2016 13:35 Go to next message
Samuel   is currently offline Samuel Friend
Messages: 22
Registered: January 2012
Junior Member
Dear all,

In my form, I have a table containing some lines.
Below this table, I have a wrapped form field.
The form field shows additional details for the selected line.
I.e. when a line in the table is clicked, the application loads additional data from the server and fills the data into the wrapped form field.
On some lines, there is no additional data. In this case, I want the wrapped form field to be cleared, i.e. all fields in this wrapped form field must be emptied.

What is the recommended way to do this?

My ideas:
- Loop through all value fields in the wrapped form field and set each value to null.
- Create an empty form field and import this empty form field. However, in order to make it work, all fields in the form data must have the property "m_valueSet" set to true. Also this idea requires some sort of loop over all fields.

Both ideas work, however, are there any simpler methods to clear a wrapped form field?

Best regards, Samuel
Re: Clearing a wrapped form field [message #1741839 is a reply to message #1741780] Tue, 30 August 2016 06:24 Go to previous messageGo to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
When a form is first filled, these values are stored as "initial values". These are used to determine if there are any changes in the form if you cancel a form or if there are any changes to be saved when closing it.

You can use AbstractForm.doClear() to reset all value fields to these initial values. You could set all form fields on the wrapped form to empty at startup, then call wrappedForm.markSaved() to store the empty values as initial values and afterwards call wrappedForm.doReset() to revert to the empty content. This works with a standalone form but I've never tried it with an embedded/wrapped form. I guess it's worth a try.
Re: Clearing a wrapped form field [message #1741909 is a reply to message #1741839] Tue, 30 August 2016 14:34 Go to previous message
Samuel   is currently offline Samuel Friend
Messages: 22
Registered: January 2012
Junior Member
Thanks for your quick reply. Indeed, AbstractForm.doClear() was the method I was looking for. And it works also with wrapped form fields.
Previous Topic:Eclipse Scout User Group Meeting 2016
Next Topic:Neon Version of Scout - Scout SDK Tooling
Goto Forum:
  


Current Time: Wed Sep 25 15:00:11 GMT 2024

Powered by FUDForum. Page generated in 0.03466 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top