Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Dragging The Form


I have a form with no border. Is there a way to drag the form and move it around the screen without having the title bar to click on? thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Dragging A Form
Hi all,

I have created a form that pops up and follows the curser around the screen when you are dragging an item from one list to another. This works with a timer on the form that repeatedly repositions the form next to the curser using the GetCursorPos function. I have a text box on this form that I want the user to be able to type in whilst dragging an item. If the moue button is not held down (and the form is just following the cursor), the text box accepts text quite happily, but when the mouse is held down as you are dragging an item, te text box does not accept text any more!?
I have tried using the GetKeyState function in the timer loop combined with a loop to go through the ascii key codes, to place letters that are pressed after the existing text in the box, but that doesnt account for the other keys on the keyboard such as the curser keys, delete, backspace, etc.

Does anybody have any suggestions on how I can make the text box accept input while the mouse button is pressed and dragging?

Any help would be great

Thanks in advance, Al.

Form Dragging
Ok my form is useing a graphic image over the form but im having a problem dragging the form, I keep getting Compile err0r: Sub or Function not defined.


Code:
Private Sub Label3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Drag Me
End Sub

Help

Dragging A Form
Hi all,

I have created a form that pops up and follows the curser around the screen when you are dragging an item from one list to another. This works with a timer on the form that repeatedly repositions the form next to the curser using the GetCursorPos function. I have a text box on this form that I want the user to be able to type in whilst dragging an item. If the moue button is not held down (and the form is just following the cursor), the text box accepts text quite happily, but when the mouse is held down as you are dragging an item, te text box does not accept text any more!?
I have tried using the GetKeyState function in the timer loop combined with a loop to go through the ascii key codes, to place letters that are pressed after the existing text in the box, but that doesnt account for the other keys on the keyboard such as the curser keys, delete, backspace, etc.

Does anybody have any suggestions on how I can make the text box accept input while the mouse button is pressed and dragging?

Any help would be great

Thanks in advance, Al.

Dragging Out Of My Form
Hi, I'm using drag/drop to remove certain objects from my form. I got most of it working so far.. I can drag an item over a certain object and it removes this object from the form. But i want to be able to drag the item outside the form and have it get removed as well. Any idea's?

Form Dragging
Ok, i have 3 forms, and my form1 is my main form, and what i want is that whenever the main form is dragged and moved around then the 2 other forms will move along with it.

So far i have this, but it will only work when you click on the back of the form, which i dont want as i want it to happen when you click the caption bar thing.


VB Code:
Private Done as Boolean Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    If Button = vbLeftButton Then        Done = True    End IfEnd Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)    If Button = vbLeftButton Then        Done = False    End IfEnd Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)'Snapping    If Done = True Then        If frmMulti.SnapPlaylist.Value = 1 Then            frmPlaylist.Top = Me.Top            frmPlaylist.Left = Me.Left + Me.Width        End If        If frmMulti.SnapExtra.Value = 1 Then            frmMulti.Left = Me.Left            frmMulti.Top = Me.Top + Me.Height        End If    End IfEnd Sub

Dragging The Form
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long


Code:
Private Declare Function ReleaseCapture Lib "user32" () As Long



Code:
Private Const WM_MOVE = &HF012


Code:
Private Const WM_SYSCOMMAND = &H112



Code:
Sub MoveTheForm(NameOfForm As Form)


Code:
Call ReleaseCapture


Code:
Call SendMessage(NameOfForm.hwnd, WM_SYSCOMMAND, WM_MOVE, 0)


Code:
End Sub


I'm trying to make it so the user can drag the form when he clicks anywhere on the form. However, the code is not working!! I'm using the above declerations and then calling it like this:

Private Sub Form_Click()
Call MoveTheForm(Form1)
End Sub

however, this is not doing anything!! What's wrong??

Dragging The Form
is there a message or something the program receives while the window is being dragged across the screen?

i want to be able to make another form 'stick' to the bottom of this form, but i don't know how to find out if the form is being dragged.

Dragging Controls Around A Form
I have an array of shape controls on my form. At runtime, I would like the user to be able to freely drag and drop the shapes around the form using their mouse.

I was thinking that this might be something to do with Shape1_DragDrop event, but I've not managed to get this to work.

Does anyone have any ideas?

Dragging A Frame Onto A Form
Hello people,
Maybe a trivial question, but I have some problems in doing that:
Simply I need to drag a frame on a surface occupied by a FlexGrid (fg). The only thing I need is this:
Ckick on the frame, drag it to another position of the fg and drop there.
I have set this code:

Private Sub Frame2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Frame2.DragMode = vbManual
m_intX = X
m_intY = Y
Frame2.Drag vbBeginDrag

Private Sub fg_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Frame2.Move X - m_intX, Y - m_intY
End Sub

Indeed the thing works, but only if the mouse pointer is not dragged on the frame itself. It is not so easy to explain, therefore please give me a suggestion to do that better.

Thank You to Everyone
Regards

TdP

Dragging Controls In A Form
This is what I would like to accomplish: I am dragging an image that will drop somewhere in the form. This is what's in my code:


VB Code:
Private LeftofImage1 As LongPrivate TopofImage1 As LongPrivate inmovement As Boolean Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    LeftofImage1 = X    TopofImage1 = Y    inmovement = TrueEnd Sub  Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)    If inmovement = True Then      Image1.Top = Image1.Top - (TopofImage1 - Y)      Image1.Left = Image1.Left - (LeftofImage1 - X)    End IfEnd Sub Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)    inmovement = FalseEnd Sub


LeftofImage1 and TopofImage1 are the X and Y values of my image control before dragging, and inmovement checks whether or not it's still MouseDown.

Just to clairify, the image flickers to the opposite direction of where I want to go. Does anybody know how to fix this?

Form Dragging Event?
Is there any way to detect when the Form is being dragged?
I need some sort of event that fires continously when the form is being dragged, I mean like someone Mouse_Down in the titlebar and move the Form.
Some sort of Form_Resize event, but for dragging.

If I Add An Item Onto A Form, How Do I Go About Dragging It Around?
I been searching on these forums but cant find anything using VB 6

Prob On Dragging A Form
hello
i'm using a child form and wen i'm writing a code to drag a form on to the parent form its not working.
can anybody suggest a small example which is having a code related to form dragging
thnks

Dragging FrmSplash Form
Using VB 6.0 I added a form frmSplash in my project. I want to drag it with mose on runtime. How?

Dragging A Borderless Form
I have a form with BorderStyle 0 - How can I drag it and reposition it on the desktop?

Dragging Image On Form W/ Layers
Hello all. I've created a program that allows the user to drag pictures from one form to another, and also anywhere within a form. If the user is dragging the picturebox within the same form, the picture moves with the cursor (it doesn't just appear at the new cursor position when the drag is complete). I've used the BitBlt API to accomplish some of my program.

My problem: Along with what I currently have I would like one form to have multiple layers. I would like a user to be able to click on a picture and be able to type what layer to move it to in a textbox (say 1-10), or use arrows to move it a layer up or down, or some sort of system. Annnnyway, any suggestions of how to accomplish this?

Thanx

Stop Form From Dragging Off-Screen
I've searched this quite a bit and keep coming up with the same results... all of which don't really solve the problem...

I have a form that I want users to drag, however, I do not want the form to cross the edges of the screen. That is, I do not want any part of the form to disappear outside the screen. The only code I've found close to this is one to snap the form to the edge of the screen (while still allowing it to be pushed outside the screen).

I've tried using the mouse position API for the form, but it doesn't capture the X and Y coordinates for when you're over the form's border. I understand this to only see the INSIDE of the form, and not the form's border included.

Thanks in advance!

How Can I Move A Form By Clicking On It And Dragging It
Hi, Is there any way I can drag a from across my screen by clicking on it and dragging. There is no blue bar at the top and I dont want to have one (for cosmetic purposes).

Thanks in advance if you can help,

John

Dragging A Command Button Around The Form
Hi everyone, i am extremely new to VB and dont know very much at all, and i need a bit of help

I want to make an extremely simple program which has one command button on a form, i want to be able to drag the command button around the form and drop it into a new position.

This is what I have so far (bearing in mind that im not sure if this is correct)

Code:
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
          command1.drag vbbegindrag
end sub


And i want to know what i have to do to make the button change its position on the form depending on where you drop it, i think it is something to do with 'Command1_DragDrop' but am not sure

please try to keep it simple, im a newby

Move A Form In Win NT By Dragging The File
I am using the following code in mousemove event of a form

ReleaseCapture
Call SendMessage(me.hwnd, &H112, &HF012, 0)




This works fine and the form moves in win98 but the form doesent move at all in win NT 4. I havent tried it with other os.
Any one knows why and whats the workaround?

Thanks in advance.
-Sanjay
Sanjaykattimani@hotmail.com


-Sanjay kattimani

Dragging Listview From One Form To Another Form..
How to drag Listview Item to another form with the same format of Listview. not a Listitems???? hElp please??

MScomm Troubles Dragging Non Modal Form
I experienced this problem:
If I use a MScomm control receiving a continous stream of data from a serial port and I open and drag a non modal window the operating system crash after few seconds of operation.
Anybody experienced the same?
Have someone any hints or ideas to workaround the problem?

To duplicate the effect:

1. create a new project.
2. Add a form as Form2
3. on Form1 * * * three buttons "startcom", "stopcom", "newform"
4. add a MScomm1.ocx control
5. add a label1 and edit its caption = "0"
5. Paste the below code

note: The Startcom button open the comm port 1 at 38400 (but also different baud rate generates the same problem).
The Stopcom button stop the communications

6. Run the program
7. If you click on startcom the label1 begins to count the commevent
if you click on stopcom the label1 stops to count

8. If you click on newform a new form (form2) not modal will be opened
9. If the comm port is closed you can drag the form and continue
to drag it for an indefinite period of time around the desktop
10. if you open the comm and open a newform and drag it
for a while; the software will continue to process the oncomm events
but soon all the system will crash...

Any ideas???
Thank you!

Code:::

Private Sub startcom_Click()
MSComm1.Settings = "38400,n,8,1"
MSComm1.CommPort = 1
MSComm1.PortOpen = True
End Sub

Private Sub stopcom_Click()
MSComm1.PortOpen = False
End Sub

Private Sub newform_Click()
Form2.Show 0
End Sub

Private Sub MSComm1_OnComm()
a$ = MSComm1.Input
Label1.Caption = Val(Label1.Caption) + 1
End Sub

MDI Child Form Auto Scroll When Dragging
Here is my problem :

I have a couple of pictureboxes in an MDI child form that is bigger than its parent MDI form.
All pictures can be dragged from one box to another.
But because not all the pictureboxes are visible ( unless you scroll the MDI form ), it is impossible to drag let say Picture1 into Picture10 because Picture10 is not accessible.
Is there a way on drag event to make the MDI Form scroll automatically when it hits the borders of the form ?
Thanx !

Finding Out If The Form Itself Is Being Moved By Dragging On The Title Bar... ?
Hello ppl...

I'm using windows 2000's layering abilities to make my form semi-transparent when a user drags it around and make it opaque when the mouse button is released. The problem is that I can't find a way to check if the form is being dragged around. The mouse events of the form do not fire when the title bar is being dragged. All i want is a mechanism that tells me if the title bar is being dragged or not. Can anyone help me?

Asim

Dragging Form / Slider Etc. Stops Execution
My code needs to transmit regular packets onto a serial bus, however when the user holds the mouse down on a slider etc. then the transmit function stops until they let go

Is there a clever way to continue processing whilst this is happening?

I am thinking multithreading might be a way around this problem but is there a simpler way?

Cheers

Dragging Help
i need to kno how to make a form so when you draag it to within 120 of the left of a screeen it sticks there, and is able to be dragged away again, like winamp can do. any help appreciated.
thank you.
ollie.

Dragging .. Please Help
Hello,

im trying to make an audio player... there is a play list (list box)... and i want it that, when the program is open, you can drag a song icon (lets say from the desktop) onto the listbox and the file name is displayed there..

can anyone please help?

Thanks!

l8er

Dragging
ok, I know what picture.drag 1 and picture.drag 2 is, but how do I conbine them to make a drag and drop thing? all I want to be able to do is drag a picturebox around the place, but how?

Dragging What?
How can I know which object is being dragged?

If I use DragMode: automatic, seems the GotFocus is not working.

What I try to do is like VB IDE, drag an object and put into another container.

Besides, I also need to draw the 6 small squares to allow user to resize.

I tried to use DragMode:Manual, but then for ComboBox, I cannot trap mouseevent like MouseDown etc !!

Any solutions???

Thanks

Knows That It Is Dragging?
If I use DragMode=Automatic,
How can I know it is being dragged?

Thanks

Dragging
I want to drag a button from one area of a form to another. I suppose this requires a calculation of the cursor position, and then some code for the Form object. But I cannot find out a way to do this seemingly obvious task. I know to set drag property of my button to "1", but beyond that it is a mystery to me.

Dragging
How can i make a object move like drag it to another spot ?

Dragging
Is there a way to drag a path from Window Explorer on to a textbox?

Dragging Help
I'm having a problem with the following code and I need a tip or workaround:

Dim OldX As Single
Dim OldY As Single
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Left = X - OldX
Source.Top = Y - OldY
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
OldX = X
OldY = Y
Picture1.Drag
End If

The problem is the x,y of the form is not realized unless the cursor leaves the original plane of the picturebox. In other words if you put the cursor in the middle of a picbox that is 1000 whatevers wide by 1000 whatevers high you can't move the picture box 499 or less whatevers. Any help?

Thanks,
Joey O

Dragging
When I click on my label, the drag box comes up but when I release it the label stays in the original place, help !

Dragging A SSTab Outside Of An App.
Hello and Good day to all. Thanks for any replies to this post!

I was wondering if it is possible to enable a drag and drop method for an sstab. What i would like it to do (the app) is allow users to drag 1 of the sstabs outside of the program area and once the mouse is release, the window will act as its own independent form. For example:

__Tab1____Tab2____Tab3__


When the user clicks and Drags Tab1, they drag it outside of the main form..(so the mouse if over the desktop for example). When they release the mouse button Tab1 becomes its own form, and is independent of the main form. So if the original was closed, Tab1 would not be.

Like so:

__Tab1__________________


And this is to apply to each SSTAB.

Not sure how one would go about accomplishing this.

Any comments or suggestions would be appreciated.

Thanks again for view and/or replying to this post.

Much appreciated!

Dragging Labels Around..
Say I have a few "columns" just seperated by simple lines, with a bunch of labels in each "column", how would I go about being able to drag labels between and within columns?

Dragging A Polygon
Dear list

I have made some shapes using the polygon api and filled them with colour. Currently I can identify when the mouse is over the polygon using point(X,Y). From this I am able to drag the polygon across the screen by continually using CLS and remaking the polygon at the current mouse point. This is understandably flickery and depending on tyhe speed of the PC - can be quite slow. Has anyone got a suggestion how I could drag the polygons better. Note they cannot be placed inside another control!

any ideas would be much appreciated.

Thanks

Optom

Dragging A Polygon
I have created a polygon using the polygon function in the API. Is there any way I can drag it with the mouse as if it were an object?

Thanks

optom

Dragging An Image Over Another One
While I'm dragging an image over another one, the one under is being refreshed, which makes the movement unclear. How to get rid of this?

How Can I: Select Pcb's By Dragging...
Yo...

its been a while since i've been here...
i've tried to find an answer to my problem...
but couldnt find one.

So here is my problem:
I want to MoveOver some pictureboxes (pcb's)...
and when i hold the leftmousebutton,
i want the pcb's to change color.

Seems rather easy...
but im not really getting there...
what i got so far:

Code:
Private Sub pcbSth_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
If pcbMon(Index).BackColor = &H80000001 Then
pcbMon(Index).BackColor = &H80000005
Else
pcbMon(Index).BackColor = &H80000001
End If
End If
End Sub
thing is...
i have to stand totally still for 'selecting'...
and i can only do one at a time...

anyone any ideas?

tnx anyway...

Need Help With Dragging Tiles
I been searching the board and havent found this issue addresses directly, so perhaps someone has a suggestion.

I am making a tile sliding game, so I need to be able to move tiles (in this case picture boxes) along either the x or y axis and have them scroll smoothly and I drag them with the mouse.

I have experimented with changing the pictures x or y as I register x and y from the mousemove event, but this leaves a trail and just doesn't seem to be working right.

I don't think this is too rare of an 'effect' so I assume there is a normal way to do it - do I use bitblt? I don't know much about that yet, but I see it mentioned on the board a lot.

Also, I am getting the ghost of the picture box when I drag and i dont want that. I feel I probably need to handly this sliding outside of the basic drag and drop technique but I'm not sure

Thanks for the help

Pete

Dragging In Lists
This may get a bit complex, so ill try to explain it best i can.

I have two listboxes, list1 list2.. Each item in list1 is corresponding with list2.. for example:

List1 Contents
1+1
2+2
3+3

List2 Contents
2
4
6

Is it possible to drag a list1 item from its current position (index) and move it somewhere else in the list, while also moving the corresponding list2 item to the same index in list2?

Thanks

Dragging A Image!?
Hi everyone, I was just wondering if anyone knows how to simply move an image from one place (lets say point a) to anotehr place and telling it to stay whereever i have dragged it to (lets say point b)??

thanx for the help

Dragging To A Folder
I want to create an application that when installed, creates a special folder with my unique icon. When cetain types of files are dragged to this folder, my application kicks off and runs a process on them. Is this possible in VB, or do I need to search for a different language? I searched the forum and could not find any other post like this.

Thank you.

Dragging Frames Or Tab Help?
I have a form and a SSTab1 and would like to keep some buttons that do the same thing on 3 of the 5 different Tab pages or w/e you call them. I don't know how I would keep them ontop for the certain pages. I was thinkng of a frame that can be dragged around on each form or how would I do it?

Thanks for all help

Dragging An Object
I'm trying to design a seating plan kind of program for teachers where they can take a desk and drag it to where they want it...How can I allow a richtext box (the object i'm using for a desk so it can be written on) to be dragged? Also how can I get it to rotate it?

Thanks,

Dragging And Dropping
Hi,

I'm trying to make a part of a program, but I'm just getting really stuck.

I need to be able to drag and drop jpeg files into image (or picture but preferably image) boxes from windows explorer.

Can anyone help?

Thanks,

Adrian Osmond.

Copyright © 2005-08 www.BigResource.com, All rights reserved