XML
  Home arrow XML arrow Page 2 - Back to XUL: Completing the JavaScript Log...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

Back to XUL: Completing the JavaScript Logic
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2006-02-13

    Table of Contents:
  • Back to XUL: Completing the JavaScript Logic
  • Defining a Function
  • The Help Menu
  • The About Window
  • Making the Toolbar Work
  • Finishing up the Functions

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Back to XUL: Completing the JavaScript Logic - Defining a Function


    (Page 2 of 6 )

    Next, we need to define a function that will allow us to retrieve data from the clipboard and paste it into the document.  Because you don’t need to get a selection, there is even less code than the previous function:

    function pasteFromClip() {

      var editor = document.getElementById('mainContent');
      editor = editor.getEditor(editor.contentWindow).QueryInterface
    (Components.interfaces.nsIPlaintextEditor);
      editor.paste(1);

    }

    You can just get the editor into the nsIPlaintextEditor interface in the same way as before, and call the paste() method on it instead.  The 1 value is just a flag for the type of text on the clipboard, in this case eEditorPlaintextMask.

    The cut function is almost identical to the copy function, you just call the cut() method instead of the copy() method:

    function cutToClip() {

      var editor = document.getElementById('mainContent');
      var selected = editor.contentDocument.getSelection();
      editor = editor.getEditor(editor.contentWindow).QueryInterface
    (Components.interfaces.nsIPlaintextEditor);
      editor.cut(selected);

    }

    More XML Articles
    More By Dan Wellman


       · Hi,This article follows on neatly from the last and shows you the code needed to...
     

    XML ARTICLES

    - Datatypes and More in RELAX NG
    - Providing Options in RELAX NG
    - An Introduction to RELAX NG
    - Path, Predicates, and XQuery
    - Using Predicates with XQuery
    - Navigating Input Documents Using Paths
    - XML Basics
    - Introduction to XPath
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE
    - UI Design with Java and XML Toolkits
    - Displaying ADO Retrieved Data with XML Islan...
    - Widget Walkthrough
    - Introduction to Widgets
    - The Why and How of XML Data Islands






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT