Detect scrollbar position in mousedown event

Post

Posted
Rating:
#1 (In Topic #1397)
Regular
chrisRoald is in the usergroup ‘Regular’
Hi,
    I need to try and prevent my drag/drop code in a webView from interfering with using the scrollbars in the normal way :!:
At present a combination of mouseDown + scrollbar use is triggering the mouseDrag coding - so I thought maybe in the webView's mouseDown event I could detect the mouse in either of the scrollbar areas and set a flag to prevent the mouseDrag code from proceeding…
Has anyone found a way of calculating if mouse is in the scrollbar 'zone' of any control :?:
(apologies if this has been dealt with before :? )

Thanks in advance.
C.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
Can you post some code to demonstrate this issue?
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
Style.ScrollbarSize ?

Something like…

Code (gambas)

  1.  
  2. Public Sub WebView1_MouseDrag()
  3.  
  4.   If Mouse.X > Last.W - Style.ScrollbarSize Then Return
  5.  
  6. ' start drag stuff
  7.  
  8.  
  9.  
Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
chrisRoald is in the usergroup ‘Regular’
Thanks Bruce,
First time i've seen Style statement used - extremely useful, looks like  :)

Code (gambas)

  1. Public Sub webView1_MouseDrag()
  2.    
  3.     Dim aPaths As New String[]
  4.  
  5.     If Mouse.X > Last.W - Style.ScrollbarSize - 16 Then Return    ''<< style-test additiion
  6.    
  7.     aPaths.Add(webView1.Url)
  8.     Drag(webView1, aPaths, "text/uri-list")
  9.      
  10.     Print "WebView1 Dragging: " & Drag.data

Without Bruce's style-test code, any attempt to drag a scrollbar in the webView triggers the mouseDrag code which terminates the scrolling :!:
I've just added a few pixels to the calc to allow for minor straying of the mouse during scrollbar use.

Thanks again - learn something new every day in forum…
C.
Online now: No Back to the top
1 guest and 0 members have just viewed this.