Search Results

Search found 2 results on 1 pages for 'bryantsai'.

Page 1/1 | 1 

  • SWT Drag and Drop support for Text widget

    - by bryantsai
    I've written an application recently using SWT. In one of its dialog box, I have a few widgets, one of which is Text, which is designed to support DND with other widgets. I've first added DND support for the 2 Tree widgets on the same dialog box (both drag source and drop target). Before I added DND support for that Text widget, I noticed that on Linux platform (gtk), SWT Text widget automatically get drag and drop support. That is, I can already drag from the other Tree widgets and drop on this Text (at any position to inserted there), as well as selecting and dragging any text from this Text to other Tree or Text widget. However, this is only working on Linux platform but not on Windows. The same program, if running on Windows, will not have any DND support for that Text widget (Tree widgets of course have DND support since I specifically write for them). So here's what I want to achieve on Windows as well: drop text at any position in Text widget. before dropping and while hovering, able to see the caret position clearly where the intended position to drop. caret position should move along with the mouse cursor. support multi-line in Text widget SOLUTION: DropTarget target = new DropTarget(sytledText, DND.DROP_MOVE | DND.DROP_COPY); target.setTransfer(new Transfer[] { TextTransfer.getInstance() }); target.addDropListener(new StyleTextDropTargetEffect(sytledText)); Use StyledText instead of Text widget Use StyledTextDropTargetEffect (or extend it) and add it as dr op listener

    Read the article

  • When would JavaScript == make more sense than ===?

    - by bryantsai
    As 359494 indicates they are basically identical except '===' also ensures type equality and hence '==' might perform type conversion. In Douglas Crockford's JavaScript: The Good Parts, it is advised to always avoid '=='. However, I'm wondering what the original thought of designing two set of equality operators was. Have you seen any situation that using '==' actually is more suitable than using '==='?

    Read the article

1