📄 dragtest.xml
字号:
<Application xmlns:xhtml="http://www.w3.org/1999/xhtml"> <Window caption="Test" width="350" height="250"> <Label id="source" left="10" top="10" padding="2" backColor="Window" border="1px solid threedshadow"> Drag me! </Label> <Label id="d-1" left="10" top="40" right="10" height="50" padding="2" backColor="Window" border="1px solid threedshadow" userData="text/plain"> Drop here [text/plain] </Label> <Label id="d-2" left="10" top="100" right="10" height="50" padding="2" backColor="Window" border="1px solid threedshadow" userData="text/html"> Drop here [text/html] </Label> <Label id="d-3" left="10" top="160" right="10" height="50" padding="2" backColor="Window" border="1px solid threedshadow" userData="bindows/image"> Drop here [bindows/image] </Label> </Window> <Resources> <Script><![CDATA[function DragTest(){ function handleDragStart( e ) { e.addData( "text/plain", "Plain text" ); e.addData( "text/html", "Some <strong>HTML</strong>" ); e.addData( "bindows/image", new BiImage( "images/folder.open. 32.png" ) ); e.addAction( "copy" ); e.startDrag(); } function handleDragDrop( e ) { var type = e.getDropDataTypes()[0]; var data = e.getData( type ); // clear old content this.removeAll(); switch ( type ) { case "text/plain": this.setText( data ); break; case "text/html": this.setHtml( data ); break; case "bindows/image": this.setText( "" ); // clear text this.add( data ); } } function handleDragOver( e ) { var c = e.getTarget(); var b = c.getBorder(); b.setColor( "highlighttext" ) c.setBorder( b ); c.setBackColor( "highlight" ); c.setForeColor( "highlighttext" ); } function handleDragOut( e ) { var c = e.getTarget(); var b = c.getBorder(); b.setColor( "threedshadow" ) c.setBorder( b ); c.setBackColor( "window" ); c.setForeColor( "windowtext" ); } function handleDragEnd( e ) { // we don't need to do anything here // If we had a succesful move action we might have removed // the source here or something else } var c = application.getComponentById( "source" ); c.addEventListener( "dragstart", handleDragStart ); //c.addEventListener( "dragend", handleDragEnd ); var ids = ["d-1", "d-2", "d-3"]; var l; for ( var i = 0; i < ids.length; i++ ) { l = application.getComponentById( ids[i] ); l.setDropDataTypes( [l.getUserData()] ); l.addEventListener( "dragdrop", handleDragDrop ); l.addEventListener( "dragover", handleDragOver ); l.addEventListener( "dragout", handleDragOut ); }}_p = DragTest.prototype;_p._className = "DragTest";DragTest.main = function (){ new DragTest;}; ]]></Script> </Resources></Application>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -