0

moving textbox

asked 2017-04-11 17:01:08 +0800

vicnetepc gravatar image vicnetepc
96

Is it possible to use the mouse to move zk textbox from one position in a container to another in the same container? how do I do that? Does anyone have an example? Thanks

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2017-04-16 08:10:57 +0800

Darksu gravatar image Darksu
1991 1 4

Hello vicnetepc,

Got the following script from this forum post:

http://forum.zkoss.org/question/96340/drag-and-drop-in-textbox/

<?page title="Drop Test" contentType="text/html;charset=UTF-8"?>
<zk> 
<vlayout>
    <label draggable="true" style="cursor: pointer;">Drag me into the textbox </label>

    <panel onDrop="dropped(event.dragged)" droppable="true" width="50%" border="normal">
       <panelchildren>
        <div align="center">
            <textbox id="globalSearch" width="100%" placeholder="drag here your question" />
        </div>
       </panelchildren> 
    </panel>

</vlayout>

<zscript><![CDATA[
    public void dropped(Component dragged) {
        if (dragged instanceof Label)
            globalSearch.setValue( ((Label)dragged).getValue() );
    }
]]></zscript>
</zk>

Best,

Darksu

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2017-04-11 17:01:08 +0800

Seen: 34 times

Last updated: Apr 16 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More