Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » How to create a read only field
How to create a read only field [message #1194095] Mon, 18 November 2013 05:33 Go to next message
Eclipse UserFriend
Is it possible to create read only fields with scout? In SWT there is the Property SWT.READ_ONLY which changes for example the Text Fields behavier to show the text and makes it possible to do copy it into another app, but the user is not able to change it.

Example in SWT:
Text textField = new Text(parent, SWT.READ_ONLY | SWT.BORDER);
textField.setText("This is a read only field");
Re: How to create a read only field [message #1194158 is a reply to message #1194095] Mon, 18 November 2013 06:16 Go to previous messageGo to next message
Eclipse UserFriend
Yes, a field has an Enabled property. If false, the field is disabled for changes. You can still copy the value.
Re: How to create a read only field [message #1194232 is a reply to message #1194158] Mon, 18 November 2013 07:00 Go to previous messageGo to next message
Eclipse UserFriend
Ok, this is correct. But the controls do not look like Read Only Controls. SWT Read Only controls do have the text painted black, disabled controls do have painted the text gray, which is realy hard do read.
Re: How to create a read only field [message #1196227 is a reply to message #1194232] Tue, 19 November 2013 05:02 Go to previous messageGo to next message
Eclipse UserFriend
The Scout Model is also a simplified view of the UI Widget. I assume that the people who designed scout didn't want to have "Editable" and "Enabled" properties in the Scout Field to keep the API simple.

I think the design choice still holds today.

For your use case, it is solved in SWT UI with the UiDecorationExtensionPoint. In the SWT plugin of your application, you can use:

   <extension
         point="org.eclipse.scout.rt.ui.swt.lookAndFeel">
      <properties
            scope="global">
         <property
               name="color.forground.disabled"
               value="FF9900">
         </property>
      </properties>
   </extension>


This will override the SWT default for disabled. With the Scout Version 3.10 there is a similar property for the background color of a disabled field in SWT (see Bug 407261)
Re: How to create a read only field [message #1200283 is a reply to message #1196227] Thu, 21 November 2013 01:55 Go to previous messageGo to next message
Eclipse UserFriend
And just to keep you from stumbling across the same rock that I hit when I first tried this: The property contains the word "forground" instead of "foreground". Even though Eclipse flagged the line with a warning when I spellt the property name "correctly" I didn't notice that this was the problem and spent about an hour wondering why setting the colour didn't work Smile
Re: How to create a read only field [message #1211008 is a reply to message #1200283] Tue, 26 November 2013 03:03 Go to previous message
Eclipse UserFriend
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=422545 for the typo correction.
Previous Topic:Access logging in database
Next Topic:Browser field error in RAP client
Goto Forum:
  


Current Time: Wed Jul 23 03:07:16 EDT 2025

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

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

Back to the top