You are not logged in.

prog4fun

Beginner

  • "prog4fun" started this thread

Posts: 6

Date of registration: Jul 5th 2010

  • Send private message

1

Wednesday, August 18th 2010, 9:12pm

drag and drop

Hi all,
Is it possible to make a drag-and-drop with a picturebox control in JABACO ?
thanks !

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Thursday, August 19th 2010, 1:40pm

What would you like to drag and drop?
The pictureBox control on the form?
Or something else to be dropped on the pictureBox?

Greetings

A1880

prog4fun

Beginner

  • "prog4fun" started this thread

Posts: 6

Date of registration: Jul 5th 2010

  • Send private message

3

Thursday, August 19th 2010, 5:56pm

Hi,
I would like to allow users to drag and drop a picturebox on the form.
Thanks in advance !

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

4

Thursday, August 19th 2010, 11:22pm

This could be a starting point for your experiments:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Option Explicit

Private bDragging As Boolean
Private dx As Integer 
Private dy As Integer 
Private lastX As Integer
Private lastY As Integer 

Public Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
      If Not bDragging Then
         bDragging = True
         dx = Picture1.Left - X
         dy = Picture1.Top - Y
      End If
End Sub

Public Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
   If bDragging Then
      If (X - lastX) ^ 2 + (Y - lastY) ^2 > 10 Then
         Picture1.Left = X + dx
         Picture1.Top = Y + dy
         lastX = X
         lastY = Y
      End If
   End If
End Sub

Public Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
   bDragging = False 
End Sub

Public Sub Form_Load()
   bDragging = False
End Sub


Strangely enough, the dragged pictureBox is not fully in sync with the mouse cursor.
There might be a problem with the coordinate scaling.

Happy trying!

A1880

prog4fun

Beginner

  • "prog4fun" started this thread

Posts: 6

Date of registration: Jul 5th 2010

  • Send private message

5

Saturday, August 21st 2010, 3:59pm

Thank you !
I will try it.

spysonic

Trainee

  • "spysonic" is male

Posts: 88

Date of registration: Jul 11th 2014

About me: A beginner programmer.

Location: ...Jabaco Academy

Occupation: i have some but still not enough...

Hobbies: Jabaco

  • Send private message

6

Thursday, July 31st 2014, 4:46am

Hello..

how about, dragging and dropping the form itself to the entire window or computer screen.
.
.
Spare me, im new to Programming

Rate this thread
WoltLab Burning Board