Search Results

Search found 40 results on 2 pages for 'onmousemove'.

Page 1/2 | 1 2  | Next Page >

  • OnmouseMove not work with SetTimeOut and Alerts in Chome

    - by Diogo Fernandes
    What's wrong with this code? It works in IE and FireFox, but Chrome does not work. The idea is that the function fnTimeOut will be triggered in 5 seconds after onmousemove. It´s ok. But when, in Chrome, I click on the button "ok" to function fnAlert is triggered instantly. It should be shot just 5 seconds after I move the mouse ... help me please. <input type="button" onclick="alert(1);" value="ok"> <script> document.onmousemove = fnTimeOut; var t = null; function fnAlert() { alert(2); } function fnTimeOut() { clearTimeout( t ); t = setTimeout( fnAlert, 5000 ); } </script>

    Read the article

  • Responding to the onmousemove event outside of the browser window in IE

    - by Matthew Lock
    In Internet Explorer 7 body onmousemove or document.onmousemove events only seem to fire while the mouse is inside the browser window, not when it's outside. Yet in Firefox the onmousemove event is called correctly when I move outside of the browser window. How can I setup an event to be called outside of the browser window in IE? Google Maps does this in IE. If you hold the mouse button down and move the mouse outside of the browser window you can see that the map still moves.

    Read the article

  • Onmousemove event not working in chrome

    - by user1316760
    I have coding for onmousemove event working well in firefox and IE......but not in chrome var mouse; function storeMouse(e) { if (!e) e = window.event; mouse = { clientX: e.clientX, clientX: e.clientY }; } function test(e) { alert(mouse.clientX); if (mouse.clientX < 150) { var agree = confirm("Are you sure to leave this page"); if (!agree) { return false; } else { } } } Can anyone help me.

    Read the article

  • Pocket IE onmousedown onmousemove onmouseup ?

    - by eidylon
    Hello all, I have a control which I wrote for capturing signatures on a web page, by using onmousedown, onmousemove and onmouseup on a div to track the mouse, and capture points comprising a signature. Now we need this to work on Windows Mobile 6.5 powered devices... but it seems that the div element does not support the mouse events in Pocket IE, which would seem to be supported by this blog. But according to MSDN, the WinCE (which WinMo/PPC is based off of) version of IE does support these mouse events for some unknown list of elements. So can anyone tell me, are there any elements: img, a, span or whatever that support onmouse[down|move|up] in WinMo 6.5 Pocket IE? Thanks! If not, anyone have any other ideas for capturing a signature on a web page in Pocket IE?

    Read the article

  • Inserting THEAD element into embedded HTML using jQuery

    - by robalot
    I'm trying to use jQuery to insert HTML into a table element. I've been messing variations of the selector (below) with no luck. Can someone help me? My Selector: $j('#ctl00_body_gridData_dom').children('table:first').append("<thead><tr><td colspan='6'>&nbsp;</td><td align='center' colspan='7'>EM SPECS</td><td align='center' colspan='7'>FISH</td><td colspan='11'>&nbsp;</td></tr></thead>"); Here's what I am trying to do... I want to insert this: <thead> <tr> <td colspan="6"> &nbsp; </td> <td align="center" colspan="7"> EM SPECS </td> <td align="center" colspan="7"> FISH </td> <td colspan="11"> &nbsp; </td> </tr> </thead> The sample below is what I want the end result to look like... So It Looks Like This: Jquery Event Pool <table id="ctl00_body_gridData" style="width: 2000px; -moz-user-select: none;" border="1" cellpadding="0" cellspacing="0"> <tbody> <tr> <td id="ctl00_body_gridData_dom" class="GridData" style="vertical-align: top; height: 245px;" valign="top"> <table style="width: 100%;" border="0" cellpadding="0" cellspacing="0"> <thead> <tr> <td colspan="6"> &nbsp; </td> <td align="center" colspan="7"> EM SPECS </td> <td align="center" colspan="7"> FISH </td> <td colspan="11"> &nbsp; </td> </tr> </thead> <tbody> <tr id="ctl00_body_gridData_top_head" class="headerlineGrid"> <td width="16"> <div style="width: 16px;"></div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,4,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,4,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,0,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,4,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,4,0)" style="width: 89px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 89px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Work<br>Package</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,6,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,6,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,1,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,6,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,6,0)" style="width: 62px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 62px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Work<br>Order</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,9,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,9,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,2,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,9,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,9,0)" style="width: 66px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 66px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> FCR<br>Group</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,12,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,12,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,3,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,12,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,12,0)" style="width: 105px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 105px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center">Contractor</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,15,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,15,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,4,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,15,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,15,0)" style="width: 159px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 159px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Capital/Expense<br>Group</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,19,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,19,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,5,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,19,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,19,0)" style="width: 99px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 99px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center">Cost Type</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,20,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,20,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,6,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,20,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,20,0)" style="width: 81px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 81px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Commit<br>Dollars</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,21,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,21,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,7,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,21,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,21,0)" style="width: 81px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 81px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Commit<br>Hours</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,22,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,22,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,8,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,22,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,22,0)" style="width: 86px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 86px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Commit<br>Quantity</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,23,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,23,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,9,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,23,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,23,0)" style="width: 76px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 76px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Control<br>Budget</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,24,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,24,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,10,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,24,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,24,0)" style="width: 46px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 46px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center">FTC</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,25,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,25,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,11,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,25,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,25,0)" style="width: 88px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 88px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Total<br>Forecast</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,26,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,26,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,12,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,26,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,26,0)" style="width: 50px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 50px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Ctr<br>COB</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,27,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,27,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,13,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,27,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,27,0)" style="width: 49px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 49px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Ctr<br>CCB</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,28,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,28,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,14,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,28,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,28,0)" style="width: 81px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 81px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Ctr<br> Commit<br>$</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,29,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,29,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,15,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,29,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,29,0)" style="width: 81px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 81px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Ctr<br> Commit<br>Hours</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,30,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,30,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,16,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,30,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,30,0)" style="width: 86px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 86px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Ctr<br> Commit<br>Quantity</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,31,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,31,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,17,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,31,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,31,0)" style="width: 95px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 95px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Ctr<br>% Compl.</td> </tr> </tbody> </table> </div> </td> <td onclick="ctl00_body_gridData.ClickHandler(event,this,32,0)" ondblclick="ctl00_body_gridData.DblClickHandler(event,null,32,0)" onmousemove="ctl00_body_gridData.MoveHandler(event,this,18,0)" onmouseover="ctl00_body_gridData.OverHandler(event,this,0)" onmouseout="ctl00_body_gridData.OutHandler(event,this,0)" onmousedown="ctl00_body_gridData.DownHandler(event,this,32,0)" onmouseup="ctl00_body_gridData.UpHandler(event,this,32,0)" style="width: 105px;" class="HeadingCell" align="center"> <div style="text-align: center; overflow: hidden; width: 105px;"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; text-align: center;" class="HeadingCellText" align="center"> Contractor<br>CFTC</td> </tr> </tbody> </table> </div> </td> </tr> <tr> <td id="ctl00_body_gridData_expcolgrp_0" width="16" align="center"></td> <td class="GroupHeading" colspan="20"> FCR<br>Group: Engineering</td> </tr> <tr> <td id="ctl00_body_gridData_expcolgrp_1" width="16" align="center"></td> <td class="GroupHeading" colspan="20"> FCR<br>Group: Pipe</td> </tr> <tr> <td id="ctl00_body_gridData_expcolgrp_2" width="16" align="center"></td> <td class="GroupHeading" colspan="20"> FCR<br>Group: Concrete</td> </tr> <tr> <td id="ctl00_body_gridData_expcolgrp_3" width="16" align="center"></td> <td class="GroupHeading" colspan="20"> FCR<br>Group: Insulation</td> </tr> <tr> <td id="ctl00_body_gridData_expcolgrp_4" width="16" align="center"></td> <td class="GroupHeading" colspan="20"> FCR<br>Group: Buildings</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </body> </html>

    Read the article

  • Panning weirdness on an UserControl

    - by Matías
    Hello, I'm trying to build my own "PictureBox like" control adding some functionalities. For example, I want to be able to pan over a big image by simply clicking and dragging with the mouse. The problem seems to be on my OnMouseMove method. If I use the following code I get the drag speed and precision I want, but of course, when I release the mouse button and try to drag again the image is restored to its original position. using System.Drawing; using System.Windows.Forms; namespace Testing { public partial class ScrollablePictureBox : UserControl { private Image image; private bool centerImage; public Image Image { get { return image; } set { image = value; Invalidate(); } } public bool CenterImage { get { return centerImage; } set { centerImage = value; Invalidate(); } } public ScrollablePictureBox() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); Image = null; AutoScroll = true; AutoScrollMinSize = new Size(0, 0); } private Point clickPosition; private Point scrollPosition; protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); clickPosition.X = e.X; clickPosition.Y = e.Y; } protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.Button == MouseButtons.Left) { scrollPosition.X = clickPosition.X - e.X; scrollPosition.Y = clickPosition.Y - e.Y; AutoScrollPosition = scrollPosition; } } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.FillRectangle(new Pen(BackColor).Brush, 0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height); if (Image == null) return; int centeredX = AutoScrollPosition.X; int centeredY = AutoScrollPosition.Y; if (CenterImage) { //Something not relevant } AutoScrollMinSize = new Size(Image.Width, Image.Height); e.Graphics.DrawImage(Image, new RectangleF(centeredX, centeredY, Image.Width, Image.Height)); } } } But if I modify my OnMouseMove method to look like this: protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.Button == MouseButtons.Left) { scrollPosition.X += clickPosition.X - e.X; scrollPosition.Y += clickPosition.Y - e.Y; AutoScrollPosition = scrollPosition; } } ... you will see that the dragging is not smooth as before, and sometimes behaves weird (like with lag or something). What am I doing wrong? I've also tried removing all "base" calls on a desperate movement to solve this issue, haha, but again, it didn't work. Thanks for your time.

    Read the article

  • drag to pan on an UserControl

    - by Matías
    Hello, I'm trying to build my own "PictureBox like" control adding some functionalities. For example, I want to be able to pan over a big image by simply clicking and dragging with the mouse. The problem seems to be on my OnMouseMove method. If I use the following code I get the drag speed and precision I want, but of course, when I release the mouse button and try to drag again the image is restored to its original position. using System.Drawing; using System.Windows.Forms; namespace Testing { public partial class ScrollablePictureBox : UserControl { private Image image; private bool centerImage; public Image Image { get { return image; } set { image = value; Invalidate(); } } public bool CenterImage { get { return centerImage; } set { centerImage = value; Invalidate(); } } public ScrollablePictureBox() { InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); Image = null; AutoScroll = true; AutoScrollMinSize = new Size(0, 0); } private Point clickPosition; private Point scrollPosition; protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); clickPosition.X = e.X; clickPosition.Y = e.Y; } protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.Button == MouseButtons.Left) { scrollPosition.X = clickPosition.X - e.X; scrollPosition.Y = clickPosition.Y - e.Y; AutoScrollPosition = scrollPosition; } } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.FillRectangle(new Pen(BackColor).Brush, 0, 0, e.ClipRectangle.Width, e.ClipRectangle.Height); if (Image == null) return; int centeredX = AutoScrollPosition.X; int centeredY = AutoScrollPosition.Y; if (CenterImage) { //Something not relevant } AutoScrollMinSize = new Size(Image.Width, Image.Height); e.Graphics.DrawImage(Image, new RectangleF(centeredX, centeredY, Image.Width, Image.Height)); } } } But if I modify my OnMouseMove method to look like this: protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.Button == MouseButtons.Left) { scrollPosition.X += clickPosition.X - e.X; scrollPosition.Y += clickPosition.Y - e.Y; AutoScrollPosition = scrollPosition; } } ... you will see that the dragging is not smooth as before, and sometimes behaves weird (like with lag or something). What am I doing wrong? I've also tried removing all "base" calls on a desperate movement to solve this issue, haha, but again, it didn't work. Thanks for your time.

    Read the article

  • Trying to draw a dynamic rectangle in SVG

    - by Shaun
    To be more specific, here are the steps I need: onmousedown - set x and y of rect as mouse coordinates onmousemove - using the current x and y mouse coordinates calculate height and width of the rect, set these and append onmouseup - remove the rectangle, and call a function based off some calculations from the rect. Here is what I have but isn't quite working (right now I have it drawing a line to make it simpler): onmousedown: startbox(evt) function startbox(evt) { if(evt.button === 0) { x1 = evt.clientX + div.scrollLeft-5; y1 = evt.clientY + div.scrollTop-30; obj.setAttributeNS(null, "x1", x1); obj.setAttributeNS(null, "y1", y1); Root.setAttributeNS(null, "onmousemove", "updatebox(evt)"); } } onmousemove: updatebox(evt) function updatebox(evt) { if(evt.button === 0) { x2 = evt.clientX + div.scrollLeft-5; y2 = evt.clientY + div.scrollTop-30; Root.appendChild(.obj); w = Math.abs(x2-x1); h = Math.abs(y2-y1); var strokecolor; if(w>20 && h>20) { strokecolor = "green"; validbox = true; } else { strokecolor = "red"; validbox = false; } var Attr={ x2:x2, y2:y2, stroke:strokecolor } assignAttr(obj, Attr); //just loops thru adding multiple attributes } } onmouseup: endbox() function endbox(evt) { if(evt.button===0) { Root.setAttributeNS(null, "onmousemove", ""); Root.removeChild(obj); if(validbox) { //do stuff validbox = !validbox; } } } Some of my problems with this are: Its slow in Chrome making drawing the line/rect feel sluggish. It won't work two times in a row. This is the real problem that I can't fix. Any and all feedback is welcome.

    Read the article

  • C# getting mouse coordinates from a tab page when selected

    - by Tom
    I wish to show the mouse coordinates only when i am viewing tabpage7. So far i have: this.tabPage7.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove); protected void OnMouseMove(object sender, MouseEventArgs mouseEv) { Console.WriteLine("happening"); Console.WriteLine(mouseEv.X.ToString()); Console.WriteLine(mouseEv.Y.ToString()); } but this doesn't appear to be doing anything, could someone help show me what im doing wrong please?

    Read the article

  • How to set tooltips on ListView Subitems in .Net

    - by Ryan
    I am trying to set the tool tip text for some of my subitems in my listview control. I am unable to get the tool tip to show up. Anyone have any suggestions? Private _timer As Timer Private Sub Timer() If _timer Is Nothing Then _timer = New Timer _timer.Interval = 500 AddHandler _timer.Tick, AddressOf TimerTick _timer.Start() End If End Sub Private Sub TimerTick(ByVal sender As Object, ByVal e As EventArgs) _timer.Enabled = False End Sub Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs) If Not _timer.Enabled Then Dim item = Me.HitTest(e.X, e.Y) If Not item Is Nothing AndAlso Not item.SubItem Is Nothing Then If item.SubItem.Text = "" Then Dim tip = New ToolTip Dim p = item.SubItem.Bounds tip.ToolTipTitle = "Status" tip.ShowAlways = True tip.Show("FOO", Me, e.X, e.Y, 1000) _timer.Enabled = True End If End If End If MyBase.OnMouseMove(e) End Sub

    Read the article

  • Javascript onscroll and mouse position

    - by EddyR
    I have a script that runs a addEventListener for onmousemove and onscroll on the document body to get the cursor position. A onmousemove event works fine (client + scroll), however when a onscroll event occurs clientX/Y seems to inherit scrollTop/Left values instead (only scroll). Is there a way around this? clickDocument = (document.documentElement != undefined && document.documentElement.clientHeight != 0) ? document.documentElement : document.body; var posx = 0; var posy = 0; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX; posy = e.clientY; } var scrollx = window.pageXOffset == undefined ? clickDocument.scrollLeft : window.pageXOffset; var scrolly = window.pageYOffset == undefined ? clickDocument.scrollTop : window.pageYOffset;

    Read the article

  • How to clear wxpython frame content when dragging a panel?

    - by aF
    Hello, I have 3 panels and I want to make drags on them. The problem is that when I do a drag on one this happens: How can I refresh the frame to happear its color when the panel is no longer there? This is the code that I have to make the drag: def onMouseMove(self, event): (self.pointWidth, self.pointHeight) = event.GetPosition() (self.width, self.height) = self.GetSizeTuple() if (self.pointWidth>100 and self.pointWidth<(self.width-100) and self.pointHeight < 15) or self.parent.dragging: self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING)) """implement dragging""" if not event.Dragging(): self.w = 0 self.h = 0 return self.CaptureMouse() if self.w == 0 and self.h == 0: (self.w, self.h) = event.GetPosition() else: (posw, posh) = event.GetPosition() displacement = self.h - posh self.SetPosition( self.GetPosition() - (0, displacement)) else: self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW)) def onDraggingDown(self, event): if self.pointWidth>100 and self.pointWidth<(self.width-100) and self.pointHeight < 15: self.parent.dragging = 1 self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW)) self.SetBackgroundColour('BLUE') self.parent.SetTransparent(220) self.Refresh() def onDraggingUp(self, event): self.parent.dragging = 0 self.parent.SetTransparent(255) self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW)) and this are the binds for this events: self.Bind(wx.EVT_MOTION, self.onMouseMove) self.Bind(wx.EVT_LEFT_DOWN, self.onDraggingDown) self.Bind(wx.EVT_LEFT_UP, self.onDraggingUp) With this, if I click on the top of the panel, and move down or up, the panel position changes (I drag the panel) to the position of the mouse.

    Read the article

  • MouseMove sensibility

    - by serhio
    I use MouseMove event to move objects(say labels). simple principle(schematic): OnMouseMove(e MouseEventArgs) deltaX = e.X - lastX foreach label in labels label.Location.X += deltaX lastX = e.X Now, when I have one label there is no problem. Once the labels number increase, I start to see the labels traces along the moving trajectory. Is there a way to prevent this kind of traces? tried label.Visible = false label.Location.X += deltaX label.Visible = true does not help.

    Read the article

  • Change Image Source using JQuery

    - by Sachin Gaur
    I have few images and their rollover images. I want to show/hide the rollover image when onmousemove/onmouseout event using JQuery. All my images name follow the same pattern, like this: Original Image: Image.gif Rollover Image: Imageover.gif I want to insert and remove the "over" portion of image source in onmouseover and onmouseout event respectively. How can I do it using JQuery?

    Read the article

  • get element position

    - by hopes
    how can i know that a specific is on another specific after dragging the first and drop it I am using this code in the head of my document to enable drag and drop of my divs var dragapproved=false var z,x,y function move(){ if (event.button==1&&dragapproved){ z.style.pixelLeft=temp1+event.clientX-x z.style.pixelTop=temp2+event.clientY-y return false } } function drags() { if (!document.all) return if (event.srcElement.className=="drag") { dragapproved=true z=event.srcElement temp1=z.style.pixelLeft temp2=z.style.pixelTop x=event.clientX y=event.clientY document.onmousemove=move } } document.onmousedown=drags document.onmouseup=new Function('dragapproved=false')

    Read the article

  • Java script Gallery - how to show a next image with an arrow - shiftImg(1)

    - by Srikanth Naidu
    //html file Image slideshow </script>   Loading image. Please wait 1     1/12 2/12 3/12 4/12 5/12 6/12 7/12 8/12   // //JS File var displayWaitMessage=true; // Display a please wait message while images are loading? var activeImage = false; var imageGalleryLeftPos = false; var imageGalleryWidth = false; var imageGalleryObj = false; var maxGalleryXPos = false; var slideSpeed = 0; var imageGalleryCaptions = new Array(); function startSlide(e) { if(document.all)e = event; var id = this.id; this.getElementsByTagName('IMG')[0].src = 'images/' + this.id + '_over.gif'; if(this.id=='arrow_right'){ slideSpeedMultiply = Math.floor((e.clientX - this.offsetLeft) / 5); slideSpeed = -1*slideSpeedMultiply; slideSpeed = Math.max(-10,slideSpeed); }else{ slideSpeedMultiply = 10 - Math.floor((e.clientX - this.offsetLeft) / 5); slideSpeed = 1*slideSpeedMultiply; slideSpeed = Math.min(10,slideSpeed); if(slideSpeed<0)slideSpeed=10; } } function releaseSlide() { var id = this.id; this.getElementsByTagName('IMG')[0].src = 'images/' + this.id + '.gif'; slideSpeed=0; } function gallerySlide() { if(slideSpeed!=0){ var leftPos = imageGalleryObj.offsetLeft; leftPos = leftPos/1 + slideSpeed; if(leftPos>maxGalleryXPos){ leftPos = maxGalleryXPos; slideSpeed = 0; } if(leftPos<minGalleryXPos){ leftPos = minGalleryXPos; slideSpeed=0; } imageGalleryObj.style.left = leftPos + 'px'; } setTimeout('gallerySlide()',20); } function showImage() { if(activeImage){ activeImage.style.filter = 'alpha(opacity=50)'; activeImage.style.opacity = 0.5; } this.style.filter = 'alpha(opacity=100)'; this.style.opacity = 1; activeImage = this; } function initSlideShow() { document.getElementById('arrow_left').onmousemove = startSlide; document.getElementById('arrow_left').onmouseout = releaseSlide; document.getElementById('arrow_right').onmousemove = startSlide; document.getElementById('arrow_right').onmouseout = releaseSlide; imageGalleryObj = document.getElementById('theImages'); imageGalleryLeftPos = imageGalleryObj.offsetLeft; imageGalleryWidth = document.getElementById('galleryContainer').offsetWidth - 80; maxGalleryXPos = imageGalleryObj.offsetLeft; minGalleryXPos = imageGalleryWidth - document.getElementById('slideEnd').offsetLeft; var slideshowImages = imageGalleryObj.getElementsByTagName('IMG'); for(var no=0;no<slideshowImages.length;no++){ slideshowImages[no].onmouseover = showImage; } var divs = imageGalleryObj.getElementsByTagName('DIV'); for(var no=0;no<divs.length;no++){ if(divs[no].className=='imageCaption')imageGalleryCaptions[imageGalleryCaptions.length] = divs[no].innerHTML; } gallerySlide(); } function showPreview(imagePath,imageIndex){ var subImages = document.getElementById('previewPane').getElementsByTagName('IMG'); if(subImages.length==0){ var img = document.createElement('IMG'); document.getElementById('previewPane').appendChild(img); }else img = subImages[0]; if(displayWaitMessage){ document.getElementById('waitMessage').style.display='inline'; } document.getElementById('largeImageCaption').style.display='none'; img.onload = function() { hideWaitMessageAndShowCaption(imageIndex-1); }; img.src = imagePath; } function hideWaitMessageAndShowCaption(imageIndex) { document.getElementById('waitMessage').style.display='none'; document.getElementById('largeImageCaption').innerHTML = imageGalleryCaptions[imageIndex]; document.getElementById('largeImageCaption').style.display='block'; } function shiftImg(imageIndex){ } window.onload = initSlideShow;

    Read the article

  • Can't display Tool Tips in VC++6.0

    - by Paul
    I'm missing something fundamental, and probably both simple and obvious. My issue: I have a view (CPlaybackView, derived from CView). The view displays a bunch of objects derived from CRectTracker (CMpRectTracker). These objects each contain a floating point member. I want to display that floating point member when the mouse hovers over the CMpRectTracker. The handler method is never executed, although I can trace through OnIntitialUpdate, PreTranslateMessage, and OnMouseMove. This is in Visual C++ v. 6.0. Here's what I've done to try to accomplish this: 1. In the view's header file: public: BOOL OnToolTipNeedText(UINT id, NMHDR * pNMHDR, LRESULT * pResult); private: CToolTipCtrl m_ToolTip; CMpRectTracker *m_pCurrentRectTracker;//Derived from CRectTracker 2. In the view's implementation file: a. In Message Map: ON_NOTIFY_EX(TTN_NEEDTEXT,0,OnToolTipNeedText) b. In CPlaybackView::OnInitialUpdate: if (m_ToolTip.Create(this, TTS_ALWAYSTIP) && m_ToolTip.AddTool(this)) { m_ToolTip.SendMessage(TTM_SETMAXTIPWIDTH, 0, SHRT_MAX); m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_AUTOPOP, SHRT_MAX); m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_INITIAL, 200); m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_RESHOW, 200); } else { TRACE("Error in creating ToolTip"); } this->EnableToolTips(); c. In CPlaybackView::OnMouseMove: if (::IsWindow(m_ToolTip.m_hWnd)) { m_pCurrentRectTracker = NULL; m_ToolTip.Activate(FALSE); if(m_rtMilepostRect.HitTest(point) >= 0) { POSITION pos = pDoc->m_rtMilepostList.GetHeadPosition(); while(pos) { CMpRectTracker tracker = pDoc->m_rtMilepostList.GetNext(pos); if(tracker.HitTest(point) >= 0) { m_pCurrentRectTracker = &tracker; m_ToolTip.Activate(TRUE); break; } } } } d. In CPlaybackView::PreTranslateMessage: if (::IsWindow(m_ToolTip.m_hWnd) && pMsg->hwnd == m_hWnd) { switch(pMsg->message) { case WM_LBUTTONDOWN: case WM_MOUSEMOVE: case WM_LBUTTONUP: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: case WM_RBUTTONUP: case WM_MBUTTONUP: m_ToolTip.RelayEvent(pMsg); break; } } e. Finally, the handler method: BOOL CPlaybackView::OnToolTipNeedText(UINT id, NMHDR * pNMHDR, LRESULT * pResult) { BOOL bHandledNotify = FALSE; CPoint CursorPos; VERIFY(::GetCursorPos(&CursorPos)); ScreenToClient(&CursorPos); CRect ClientRect; GetClientRect(ClientRect); // Make certain that the cursor is in the client rect, because the // mainframe also wants these messages to provide tooltips for the // toolbar. if (ClientRect.PtInRect(CursorPos)) { TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR; CString str; str.Format("%f", m_pCurrentRectTracker->GetMilepost()); ASSERT(str.GetLength() < sizeof(pTTT->szText)); ::strcpy(pTTT->szText, str); bHandledNotify = TRUE; } return bHandledNotify; }

    Read the article

  • WPF: how to find an element in a datatemplate from an itemscontrol

    - by EV
    Hi, I have the following problem: the application is using the custom itemscontrol called ToolBox. The elements of a toolbox are called toolboxitems and are custom contentcontrol. Now, the toolbox stores a number of images that are retrieved from a database and displayed. For that I use a datatemplate inside the toolbox control. However, when I try to drag and drop the elements, I don't get the image object but the database component. I thought that I should then traverse the structure to find the Image element. here's the code: Toolbox: public class Toolbox : ItemsControl { private Size defaultItemSize = new Size(65, 65); public Size DefaultItemSize { get { return this.defaultItemSize; } set { this.defaultItemSize = value; } } protected override DependencyObject GetContainerForItemOverride() { return new ToolboxItem(); } protected override bool IsItemItsOwnContainerOverride(object item) { return (item is ToolboxItem); } } ToolBoxItem: public class ToolboxItem : ContentControl { private Point? dragStartPoint = null; static ToolboxItem() { FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(ToolboxItem), new FrameworkPropertyMetadata(typeof(ToolboxItem))); } protected override void OnPreviewMouseDown(MouseButtonEventArgs e) { base.OnPreviewMouseDown(e); this.dragStartPoint = new Point?(e.GetPosition(this)); } public String url { get; private set; } protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.LeftButton != MouseButtonState.Pressed) { this.dragStartPoint = null; } if (this.dragStartPoint.HasValue) { Point position = e.GetPosition(this); if ((SystemParameters.MinimumHorizontalDragDistance <= Math.Abs((double)(position.X - this.dragStartPoint.Value.X))) || (SystemParameters.MinimumVerticalDragDistance <= Math.Abs((double)(position.Y - this.dragStartPoint.Value.Y)))) { string xamlString = XamlWriter.Save(this.Content); MessageBoxResult result = MessageBox.Show(xamlString); DataObject dataObject = new DataObject("DESIGNER_ITEM", xamlString); if (dataObject != null) { DragDrop.DoDragDrop(this, dataObject, DragDropEffects.Copy); } } e.Handled = true; } } private childItem FindVisualChild<childItem>(DependencyObject obj) where childItem : DependencyObject { for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) { DependencyObject child = VisualTreeHelper.GetChild(obj, i); if (child != null && child is childItem) return (childItem)child; else { childItem childOfChild = FindVisualChild<childItem>(child); if (childOfChild != null) return childOfChild; } } return null; } } here is the xaml file for ToolBox and toolbox item: <Style TargetType="{x:Type s:ToolboxItem}"> <Setter Property="Control.Padding" Value="5" /> <Setter Property="ContentControl.HorizontalContentAlignment" Value="Stretch" /> <Setter Property="ContentControl.VerticalContentAlignment" Value="Stretch" /> <Setter Property="ToolTip" Value="{Binding ToolTip}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type s:ToolboxItem}"> <Grid> <Rectangle Name="Border" StrokeThickness="1" StrokeDashArray="2" Fill="Transparent" SnapsToDevicePixels="true" /> <ContentPresenter Content="{TemplateBinding ContentControl.Content}" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" ContentTemplate="{TemplateBinding ContentTemplate}"/> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter TargetName="Border" Property="Stroke" Value="Gray" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type s:Toolbox}"> <Setter Property="SnapsToDevicePixels" Value="true" /> <Setter Property="Focusable" Value="False" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Border BorderThickness="{TemplateBinding Border.BorderThickness}" Padding="{TemplateBinding Control.Padding}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}" SnapsToDevicePixels="True"> <ScrollViewer VerticalScrollBarVisibility="Auto"> <ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" /> </ScrollViewer> </Border> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <WrapPanel Margin="0,5,0,5" ItemHeight="{Binding Path=DefaultItemSize.Height, RelativeSource={RelativeSource AncestorType=s:Toolbox}}" ItemWidth="{Binding Path=DefaultItemSize.Width, RelativeSource={RelativeSource AncestorType=s:Toolbox}}" /> </ItemsPanelTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> Example usage: <Toolbox x:Name="NewLibrary" DefaultItemSize="55,55" ItemsSource="{Binding}" > <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel> <Image Source="{Binding Path=url}" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </Toolbox> The object that I get is a database object. When using a static resource I get the Image object. How to retrieve this Image object from a datatemplate? I though that I could use this tutorial: http://msdn.microsoft.com/en-us/library/bb613579.aspx But it does not seem to solve the problem. Could anyone suggest a solution? Thanks!

    Read the article

  • Object drag delay issue

    - by Johnny Darvall
    I have this code that drags stuff around perfectly in IE - however in firefox the onmousedown-drag of the object does not immediately drag but shows the no-entry cursor and then after onmouseup the object drags around freely. The object does stop draging on the next onmouseup. The object should only drag in the onmousdown state, while the onmousup call should cancel the drag by making j_OK=0. I think it may have something to do with the image inside... the object: <em style=position:absolute;left:0;top:0;width:32;height:32;display:block> < img src=abc.gif onmousedown=P_MV(this.parentNode) style=position:absolute;left:0;top:0;width:inherit> </em> function P_MV(t) { p_E=t j_oy=parseInt(p_E.style.top) j_ox=parseInt(p_E.style.left) j_OK=1 document.onselectstart=function(){return false} document.onmousemove=P_MVy } function P_MVy(e) { if(j_OK) { p_E.style.top=(j_FF?e.clientY:event.clientY)-j_y+j_oy p_E.style.left=(j_FF?e.clientX:event.clientX)-j_x+j_ox } return false }

    Read the article

  • Making element draggable with Android WebView (ideally, just with Javascript) ?

    - by GJTorikian
    I'm building an app with a build target of 1.5 . I have a variable, WebView browser, that is calling loadUrl to load a static HTML page from my assets folder. In that HTML page, the following JavaScript is defined: var supportsTouch = ('createTouch' in document); ... var w = $('wrapper'); w[supportsTouch ? 'touchmove' : 'onmousemove'] = move; w[supportsTouch ? 'touchend' : 'onmouseup'] = function(event){ dragging = false; }; where move is another function that handles the dragging. Unfortunately, this doesn't seem to work. I cannot figure out a concise list of which touch events are available to Android--is it ontouchmove, or touchmove? Am I supposed to set up an onTouchEvent call back in my Java code, which then launches the JavaScript function?

    Read the article

  • Scrollbar still is painted after it should be removed

    - by Walter Williams
    I have the following custom control and can place on a form (with AutoScroll set to true and the control anchored left, top and right). If the form is too short for the control, the form correctly resizes the control (to make room for the scroll) and displays the scroll bar. When the control is closed using the close glyph, the control is resized and the scroll bar is removed, but occasionally the scroll bar appears to remain painted. If the form is minimized or moved off-screen, the leftover paint is removed. I've tried Parent.Invalidate and have toyed with it in many ways but to no avail. Any suggestions? (Using VS 2008 Standard) using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; namespace GroupPanelTest { public class GroupPanel : GroupBox { #region Members private const Int32 iHeaderHeight = 20; private Int32 iFullHeight = 200; private Boolean bClosed = false; private Rectangle rectCloseGlyphBounds = Rectangle.Empty; private Boolean bIsMoveOverCloseGlyph = false; #endregion #region Properties [DefaultValue(false)] public Boolean Closed { get { return (this.bClosed); } set { if (this.bClosed != value) { this.bClosed = value; if (this.bClosed) { this.iFullHeight = base.Height; base.Height = GroupPanel.iHeaderHeight; } else { base.Height = this.iFullHeight; } foreach (Control con in base.Controls) con.Visible = !this.bClosed; this.Invalidate(); } } } public new Int32 Height { get { return (base.Height); } set { if (value != base.Height) { if (this.Closed) { this.iFullHeight = value; } else { Int32 iOldHeight = base.Height; base.Height = value; } } } } [DefaultValue(typeof(Size), "350,200")] public new Size Size { get { return (base.Size); } set { if (base.Size != value) { base.Size = value; if (!this.Closed) this.iFullHeight = value.Height; } } } [DefaultValue(typeof(Padding), "0,7,0,0")] public new Padding Padding { get { return (base.Padding); } set { base.Padding = value; } } #endregion #region Construction public GroupPanel () { SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.Selectable, true); this.Size = new Size(350, 200); this.Padding = new Padding(0, 7, 0, 0); // the groupbox will add to that this.rectCloseGlyphBounds = new Rectangle(base.ClientSize.Width - 24, 2, 16, 16); } #endregion #region Overrides protected override void OnSizeChanged (EventArgs e) { this.rectCloseGlyphBounds = new Rectangle(base.ClientSize.Width - 24, 2, 16, 16); base.OnSizeChanged(e); } protected override void OnPaint (PaintEventArgs e) { base.OnPaint(e); // we want all the delegates to receive the events, but we do this first so we can paint over it Graphics g = e.Graphics; g.FillRectangle(SystemBrushes.Window, this.ClientRectangle); Rectangle rectTitle = new Rectangle(0, 0, this.ClientRectangle.Width, GroupPanel.iHeaderHeight); g.FillRectangle(SystemBrushes.Control, rectTitle); g.DrawString(this.Text, this.Font, SystemBrushes.ControlText, new PointF(5.0f, 3.0f)); if (this.bIsMoveOverCloseGlyph) { g.FillRectangle(SystemBrushes.ButtonHighlight, this.rectCloseGlyphBounds); Rectangle rectBorder = this.rectCloseGlyphBounds; rectBorder.Inflate(-1, -1); g.DrawRectangle(SystemPens.Highlight, rectBorder); } using (Pen pen = new Pen(SystemColors.ControlText, 1.6f)) { if (this.Closed) { g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 3, this.rectCloseGlyphBounds.Top + 3, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 8); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 13, this.rectCloseGlyphBounds.Top + 3, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 8); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 3, this.rectCloseGlyphBounds.Top + 7, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 12); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 13, this.rectCloseGlyphBounds.Top + 7, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 12); } else { g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 3, this.rectCloseGlyphBounds.Top + 8, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 3); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 13, this.rectCloseGlyphBounds.Top + 8, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 3); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 3, this.rectCloseGlyphBounds.Top + 12, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 7); g.DrawLine(pen, this.rectCloseGlyphBounds.Left + 13, this.rectCloseGlyphBounds.Top + 12, this.rectCloseGlyphBounds.Left + 8, this.rectCloseGlyphBounds.Top + 7); } } } protected override void OnMouseDown (MouseEventArgs e) { if (e.Button == MouseButtons.Left && this.rectCloseGlyphBounds.Contains(e.Location)) this.Closed = !this.Closed; // close will call invalidate base.OnMouseDown(e); } protected override void OnMouseMove (MouseEventArgs e) { this.bIsMoveOverCloseGlyph = this.rectCloseGlyphBounds.Contains(e.Location); this.Invalidate(this.rectCloseGlyphBounds); base.OnMouseMove(e); } #endregion } }

    Read the article

  • C# - Moving a control to the mouse's position

    - by APShredder
    Hello everybody. I am trying to get a control to follow the cursor when the user clicks and drag the control. The problem is that 1.) the control doesn't go to the mouse's position, and 2.) the control flickers and flies all over the place. I've tried a few different methods of doing this, but all so far have failed. I've tried: protected override void OnMouseDown(MouseEventArgs e) { while (e.Button == System.Windows.Forms.MouseButtons.Left) { this.Location = e.Location; } } and protected override void OnMouseMove(MouseEventArgs e) { while (e.Button == System.Windows.Forms.MouseButtons.Left) { this.Location = e.Location; } } but neither of these work. Any help is appreciated, and thanks in advance!

    Read the article

  • Getting a popup help for an option in listview.

    - by Judy
    I have an interface with a listview of various options e.g 1)Asian 2) Euorpian 3)...... this listview is populated by calling JSP script that accesses this data (i.e. all options) from database. I want to have a small popup window (like any help window) to be displayed when I move mouse over( onmousemove function) any option. e.g when i put mouse over Asian then a small help sort of window display Indians,chinese,thai...etc. Can anyone suggest how to achieve this?

    Read the article

1 2  | Next Page >