Ken, 1. Is this your requirement? a) A user wants to be able to click on an area of text in a Label b) then drag the mouse around to expand the selection c) and then be able to copy the selected text to the clipboard
The short answer is that the Label skin provided with Pivot (org.apache.pivot.wtk.skin.terra.TerraLabelSkin) does not support this. If desired you could extend or modify TerraLabelSkin, or create a totally new skin which implements org.apache.pivot.wtk.skin.terra.LabelSkin. However TextInput supports most of this functionality already (selectable text & using the mouse to drag the selection), but is editable and does not look like a Label. One solution might be to create a custom Component that extends TextInput, and also a custom Skin based on TerraTextInputSkin. The component would override Component#isFocusable() to always return false (thus keeping it an an 'enabled' state, but not being editable and not showing the caret) The skin would be a copy of TerraTextInputSkin with a modified paint() method. (copied because paint requires access to all of the private 'style' properties) It would not paint the border, bevel or background to match the look of a Label. If could also ignore the active/inactive, disabled/enabled states and just paint using the main 'color', 'selectionBackgroundColor', 'selectionColor' styles. I think this would then look and behave as you wish, with the exception being that keypresses such as CONTROL+C to copy would not work as the new component would never be focused. One much easier option might be to just show a pop-up context menu on Labels when they are right-clicked. This would have a 'Copy' menu item which would copy *all* of the label text to the clipboard. See here for an example - http://pivot.apache.org/tutorials/context-menus.html 2. See attached file as a demonstration of how to make a TextInput non-editable using strict validation. Chris On 24 December 2010 11:28, <[email protected]> wrote: > > Hi all, > > > How about below features in pivot 2.0? > > 1. does label can support copy function like HTML. > 2. does TextInput can support editable like Textarea. > > There are actual experience and feedback come from end user,they use to > HTML mode for long time. > So they would like use copy function everywhere. > Is there any advise? > > > Best regards, > Ken Jiang > > ******************************************* > Murata Electronics Trading (Shenzhen) Co.,Ltd > Tel:86-755-82847251 > E-mail:[email protected] <e-mail%[email protected]> > ******************************************* > >
LockableTextInput.java
Description: Binary data
