{"id":1391,"date":"2019-03-25T17:34:54","date_gmt":"2019-03-25T20:34:54","guid":{"rendered":"http:\/\/xexeu.elipse.com.br\/pt\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/"},"modified":"2021-11-04T16:38:39","modified_gmt":"2021-11-04T19:38:39","slug":"kb33026-dragging-screen-objects-with-the-mouse-at-run-time","status":"publish","type":"post","link":"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/","title":{"rendered":"KB-33026: Dragging screen objects at run time."},"content":{"rendered":"<div style=\"text-align: justify;\">\n<h3><span style=\"font-weight: bold;\">Question:<\/span><\/h3>\n<p>How can I drag screen objects with the mouse at run time?<\/p>\n<h3><span style=\"font-weight: bold;\">Solution:<\/span><\/h3>\n<p>First of all, in order to solve this you will need to establish which version of <strong><a href=\"https:\/\/www.elipse.com.br\/en\/produto\/elipse-e3\/\" target=\"_blank\" rel=\"noopener noreferrer\">Elipse E3<\/a><\/strong> is being used. Then, you will be able to decide how to drag screen objects at run time.<\/p>\n<p>From <strong>version 3.5<\/strong> on, you can create a <em>WhileRunning<\/em> script on the Screen, and subsequently use\u00a0 <em><strong>GetMouseX<\/strong> e<\/em> <em><strong>GetMouseY <\/strong><\/em>methods to retrieve the mouse&#8217;s position. For example:<\/p>\n<pre><code>Sub Screen1_WhileRunning()\r\n\tItem(\"Circle1\").X = FromPixelX(Application.GetMouseX())\r\n\tItem(\"Circle1\").Y = FromPixelY(Application.GetMouseY())\r\nEnd Sub\r\n<\/code><\/pre>\n<p><em>FromPixelX<\/em> and <em>FromPixelY<\/em> methods convert coordinates from pixels to himetric.<\/p>\n<p><strong>NOTE:<\/strong> Please bear in mind that this kind of script (<em>WhileRunning<\/em>) can hinder the application&#8217;s performance, depending on the case.<\/p>\n<p>As for <strong>prior versions of the software<\/strong>, there are two possibilities. You can:<\/p>\n<ol>\n<li>Create a Translation or Rotation Animation for the object. The <strong>downside<\/strong> is that the object&#8217;s limit is the animation&#8217;s path. On the other hand, the <strong>upside<\/strong> is that in this case the mouse will actually drag the object; or<\/li>\n<li>Change the object&#8217;s position via script. The upside is that can actually move the object to any position on screen.<\/li>\n<\/ol>\n<p>To do so, follow these procedures:<\/p>\n<\/div>\n<p>1. Create a script in <span style=\"font-style: italic;\">MouseDown <\/span>event of the object to be dragged. Set the object&#8217;s <span style=\"font-style: italic;\">Name <\/span>property to an Internal Tag (using the tag as a global variable). For example:<\/p>\n<pre style=\"text-align: left;\"><span style=\"font-family: Courier New; color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0 Sub Rectangle1_MouseDown(Button, ShiftState, MouseX, MouseY)<\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0 \u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0 Application.Item(\"InternalTag1\").Value = Name<\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0 \u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0 'Saves the exact position where the object was clicked <\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 Application.Item(\"MouseX\").Value = MouseX - X <\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0 \u00a0 \u00a0 \u00a0\u00a0\u00a0 Application.Item(\"MouseY\").Value = MouseY - Y<\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0\u00a0\u00a0\u00a0 End Sub<\/span><\/pre>\n<p>2. Create a script in <span style=\"font-style: italic;\">MouseUp <\/span>event of the screen where the object is inserted. In this script, pass the <span style=\"font-style: italic;\">MouseUp<\/span>&#8216;s <span style=\"font-style: italic;\">MouseY <\/span>and <span style=\"font-style: italic;\">MouseX <\/span>variables that have the <span style=\"font-style: italic;\">X <\/span>and <span style=\"font-style: italic;\">Y<\/span> position of the mouse&#8217;s cursor to the X and Y properties of the object. For example:<\/p>\n<div style=\"text-align: justify;\">\n<pre style=\"text-align: left;\"><span style=\"font-family: Courier New; color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0 dim objname<\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0 set obj = Application.Item(\"InternalTag1\")<\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0 objname = obj.Value<\/span><br style=\"font-family: Courier New; color: #000000;\" \/><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0 if objname <> \"\" then<\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0 \u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0 Item(objname).X = MouseX - Application.Item(\"MouseX\").Value<\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 Item(objname).Y = MouseY - Application.Item(\"MouseY\").Value<\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0 \u00a0 \u00a0 \u00a0\u00a0\u00a0 obj.Value = \"\"<\/span><br style=\"font-family: Courier New; color: #000000;\" \/><span style=\"font-family: Courier New; color: #000000;\">\u00a0\u00a0\u00a0\u00a0\u00a0 end if<\/span><\/pre>\n<p>Attached to this article is an application developed in <strong>Elipse<\/strong> <span style=\"font-weight: bold;\">E3 <\/span>version 3.2 build 260 that illustrates the procedures described above.<\/p>\n<\/div>\n<h3>Attachments:<\/h3>\n<p><a href=\"\/wp-content\/uploads\/2019\/03\/MouseMove-1.zip\">MouseMove<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Question: How can I drag screen objects with the mouse at run time? Solution: First of all, in order to solve this you will need to establish which version of&hellip;<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0},"categories":[762,763],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>KB-33026: How to drag screen objects at run time.<\/title>\n<meta name=\"description\" content=\"This article shows how you can drag screen objects at run time in Elipse E3, the supervisory developed by Elipse Software.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"KB-33026: How to drag screen objects at run time.\" \/>\n<meta property=\"og:description\" content=\"This article shows how you can drag screen objects at run time in Elipse E3, the supervisory developed by Elipse Software.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/\" \/>\n<meta property=\"og:site_name\" content=\"Elipse Knowledgebase\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/elipsesoftware\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-25T20:34:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-11-04T19:38:39+00:00\" \/>\n<meta name=\"author\" content=\"C\u00e9zar Lumiatti Teixeira\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"C\u00e9zar Lumiatti Teixeira\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/\"},\"author\":{\"name\":\"C\u00e9zar Lumiatti Teixeira\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/person\/843cbcdf9865f72399446377cf0cfc2b\"},\"headline\":\"KB-33026: Dragging screen objects at run time.\",\"datePublished\":\"2019-03-25T20:34:54+00:00\",\"dateModified\":\"2021-11-04T19:38:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/\"},\"wordCount\":580,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#organization\"},\"articleSection\":[\"Screen Objects\",\"Scripts\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/\",\"url\":\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/\",\"name\":\"KB-33026: How to drag screen objects at run time.\",\"isPartOf\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#website\"},\"datePublished\":\"2019-03-25T20:34:54+00:00\",\"dateModified\":\"2021-11-04T19:38:39+00:00\",\"description\":\"This article shows how you can drag screen objects at run time in Elipse E3, the supervisory developed by Elipse Software.\",\"breadcrumb\":{\"@id\":\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\/\/kb.elipse.com.br\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"KB-33026: Dragging screen objects at run time.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kb.elipse.com.br\/#website\",\"url\":\"https:\/\/kb.elipse.com.br\/\",\"name\":\"Elipse Knowledgebase\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kb.elipse.com.br\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kb.elipse.com.br\/#organization\",\"name\":\"Elipse Software\",\"url\":\"https:\/\/kb.elipse.com.br\/\",\"sameAs\":[\"http:\/\/www.facebook.com\/elipsesoftware\"],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png\",\"contentUrl\":\"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png\",\"width\":161,\"height\":58,\"caption\":\"Elipse Software\"},\"image\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/person\/843cbcdf9865f72399446377cf0cfc2b\",\"name\":\"C\u00e9zar Lumiatti Teixeira\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8ab17a30c6ba62b79eaefe2a0a0b8b1b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8ab17a30c6ba62b79eaefe2a0a0b8b1b?s=96&d=mm&r=g\",\"caption\":\"C\u00e9zar Lumiatti Teixeira\"},\"url\":\"https:\/\/kb.elipse.com.br\/en\/author\/teixeira\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"KB-33026: How to drag screen objects at run time.","description":"This article shows how you can drag screen objects at run time in Elipse E3, the supervisory developed by Elipse Software.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/","og_locale":"en_US","og_type":"article","og_title":"KB-33026: How to drag screen objects at run time.","og_description":"This article shows how you can drag screen objects at run time in Elipse E3, the supervisory developed by Elipse Software.","og_url":"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/","og_site_name":"Elipse Knowledgebase","article_publisher":"http:\/\/www.facebook.com\/elipsesoftware","article_published_time":"2019-03-25T20:34:54+00:00","article_modified_time":"2021-11-04T19:38:39+00:00","author":"C\u00e9zar Lumiatti Teixeira","twitter_card":"summary_large_image","twitter_misc":{"Written by":"C\u00e9zar Lumiatti Teixeira","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/#article","isPartOf":{"@id":"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/"},"author":{"name":"C\u00e9zar Lumiatti Teixeira","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/person\/843cbcdf9865f72399446377cf0cfc2b"},"headline":"KB-33026: Dragging screen objects at run time.","datePublished":"2019-03-25T20:34:54+00:00","dateModified":"2021-11-04T19:38:39+00:00","mainEntityOfPage":{"@id":"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/"},"wordCount":580,"commentCount":0,"publisher":{"@id":"https:\/\/kb.elipse.com.br\/#organization"},"articleSection":["Screen Objects","Scripts"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/","url":"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/","name":"KB-33026: How to drag screen objects at run time.","isPartOf":{"@id":"https:\/\/kb.elipse.com.br\/#website"},"datePublished":"2019-03-25T20:34:54+00:00","dateModified":"2021-11-04T19:38:39+00:00","description":"This article shows how you can drag screen objects at run time in Elipse E3, the supervisory developed by Elipse Software.","breadcrumb":{"@id":"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kb.elipse.com.br\/en\/kb33026-dragging-screen-objects-with-the-mouse-at-run-time\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/kb.elipse.com.br\/en\/"},{"@type":"ListItem","position":2,"name":"KB-33026: Dragging screen objects at run time."}]},{"@type":"WebSite","@id":"https:\/\/kb.elipse.com.br\/#website","url":"https:\/\/kb.elipse.com.br\/","name":"Elipse Knowledgebase","description":"","publisher":{"@id":"https:\/\/kb.elipse.com.br\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kb.elipse.com.br\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/kb.elipse.com.br\/#organization","name":"Elipse Software","url":"https:\/\/kb.elipse.com.br\/","sameAs":["http:\/\/www.facebook.com\/elipsesoftware"],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/","url":"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png","contentUrl":"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png","width":161,"height":58,"caption":"Elipse Software"},"image":{"@id":"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/person\/843cbcdf9865f72399446377cf0cfc2b","name":"C\u00e9zar Lumiatti Teixeira","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8ab17a30c6ba62b79eaefe2a0a0b8b1b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8ab17a30c6ba62b79eaefe2a0a0b8b1b?s=96&d=mm&r=g","caption":"C\u00e9zar Lumiatti Teixeira"},"url":"https:\/\/kb.elipse.com.br\/en\/author\/teixeira\/"}]}},"_links":{"self":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts\/1391"}],"collection":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/comments?post=1391"}],"version-history":[{"count":5,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts\/1391\/revisions"}],"predecessor-version":[{"id":12617,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts\/1391\/revisions\/12617"}],"wp:attachment":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/media?parent=1391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/categories?post=1391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/tags?post=1391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}