Moving 2 forms at once

Moving 2 forms at once

Post by Kevi » Sun, 04 Nov 2001 02:20:46



Hey All...

  I'm trying to move 2 forms at once.  I have one window that pops-up
(B), and I have a little pushpin that moves the left property of
window B to the rightside of the other form, A.  But, when I move form
A, the other window doesn't go with it, obviously.  Is there a method
I'm missing that could help me move both together as one entity?  Or
an API call that I could use to accomplish this?

  Any help is greatly appreciated!  Thanks in advance..

          - Kevin

 
 
 

Moving 2 forms at once

Post by Jim Milla » Sun, 04 Nov 2001 03:18:13


I was curious so I tried that.
Here is what I did, but there was a sugnificant delay on the second forms
movement, I'm not sure why.
It does however keep the two forms sync'd

Private Sub Form_Load()
Form2.Left = Form1.Left + Form1.Width
Form2.Top = Form1.Top
Form2.Show
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
Y As Single)
Form2.Left = Form1.Left + Form1.Width
Form2.Top = Form1.Top
End Sub

Maybe someone knows a better method...
Jim


Quote:> Hey All...

>   I'm trying to move 2 forms at once.  I have one window that pops-up
> (B), and I have a little pushpin that moves the left property of
> window B to the rightside of the other form, A.  But, when I move form
> A, the other window doesn't go with it, obviously.  Is there a method
> I'm missing that could help me move both together as one entity?  Or
> an API call that I could use to accomplish this?

>   Any help is greatly appreciated!  Thanks in advance..

>           - Kevin


 
 
 

Moving 2 forms at once

Post by Frank Ad » Sun, 04 Nov 2001 07:42:56


On Fri, 2 Nov 2001 12:18:13 -0600, "Jim Millar"

I think you'll find by switching .Visible off on both forms before the
repositioning, will speed it up a bit. Also .Move is a faster method,
but i'm actually not sure if you can miove an invisibe form.
You can test that one.. ;-p

>I was curious so I tried that.
>Here is what I did, but there was a sugnificant delay on the second forms
>movement, I'm not sure why.
>It does however keep the two forms sync'd

>Private Sub Form_Load()
>Form2.Left = Form1.Left + Form1.Width
>Form2.Top = Form1.Top
>Form2.Show
>End Sub

>Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
>Y As Single)
>Form2.Left = Form1.Left + Form1.Width
>Form2.Top = Form1.Top
>End Sub

>Maybe someone knows a better method...
>Jim



>> Hey All...

>>   I'm trying to move 2 forms at once.  I have one window that pops-up
>> (B), and I have a little pushpin that moves the left property of
>> window B to the rightside of the other form, A.  But, when I move form
>> A, the other window doesn't go with it, obviously.  Is there a method
>> I'm missing that could help me move both together as one entity?  Or
>> an API call that I could use to accomplish this?

>>   Any help is greatly appreciated!  Thanks in advance..

>>           - Kevin

Regards, Frank
 
 
 

Moving 2 forms at once

Post by Kevi » Sun, 04 Nov 2001 13:52:27


Thanks for the help.. It works, but the Form_MoveMouse event is only
triggered when you move your mouse over the form, and not actually
with the control bar where you would move it with your mouse.  But
once I move my mouse over form1, form2 snugs up next to it.  I'd like
to give the impression that the second window is actually 'attached'..

I'm thinking that I need to somehow subclass a WM_WINDOWPOSCHANGING
API message, then make the form location change.  BUT, I'm having
difficulties subclassing and working with the API...  Anything else
that may clean up the form "attachment"?

     - Kevin

> On Fri, 2 Nov 2001 12:18:13 -0600, "Jim Millar"

> I think you'll find by switching .Visible off on both forms before the
> repositioning, will speed it up a bit. Also .Move is a faster method,
> but i'm actually not sure if you can miove an invisibe form.
> You can test that one.. ;-p

> >I was curious so I tried that.
> >Here is what I did, but there was a sugnificant delay on the second forms
> >movement, I'm not sure why.
> >It does however keep the two forms sync'd

> >Private Sub Form_Load()
> >Form2.Left = Form1.Left + Form1.Width
> >Form2.Top = Form1.Top
> >Form2.Show
> >End Sub

> >Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
> >Y As Single)
> >Form2.Left = Form1.Left + Form1.Width
> >Form2.Top = Form1.Top
> >End Sub

> >Maybe someone knows a better method...
> >Jim



> >> Hey All...

> >>   I'm trying to move 2 forms at once.  I have one window that pops-up
> >> (B), and I have a little pushpin that moves the left property of
> >> window B to the rightside of the other form, A.  But, when I move form
> >> A, the other window doesn't go with it, obviously.  Is there a method
> >> I'm missing that could help me move both together as one entity?  Or
> >> an API call that I could use to accomplish this?

> >>   Any help is greatly appreciated!  Thanks in advance..

> >>           - Kevin

> Regards, Frank

 
 
 

Moving 2 forms at once

Post by J Fren » Sun, 04 Nov 2001 18:32:38


Using a timer can do the trick - but it is a problem when the form is
being moved by dragging the titlebar.

Option Explicit

Private Sub LS_SyncForms()
    Form2.Move Me.Left + Me.Width, Me.Top
End Sub

Private Sub Form_Load()
    Form2.Visible = True
    Timer1.Enabled = True
    Timer1.Interval = 100
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Timer1.Enabled = False
    Unload Form2
End Sub

Private Sub Timer1_Timer()
    Call LS_SyncForms
End Sub

 
 
 

Moving 2 forms at once

Post by Randy Birc » Mon, 05 Nov 2001 02:03:51


Subclass frmMain, using code such as found at
http://www.mvps.org/vbnet/code/subclass/minmaxinfo.htm. Add this const to
the bas module ...

Private Const WM_MOVING As Long = &H216

... and replace the WindowProc method with this instead (where frmMain it
the form that will be moved, and Form1 is the form you want to 'follow' the
main form ...

Public Function WindowProc(ByVal hwnd As Long, _
                           ByVal uMsg As Long, _
                           ByVal wParam As Long, _
                           ByVal lParam As Long) As Long

   On Local Error Resume Next

   Select Case hwnd

      Case frmMain.hwnd

         Select Case uMsg

            Case WM_MOVING:

               Form1.Move (frmMain.Left + frmMain.Width), frmMain.Top

              Case Else

          End Select

   End Select

   WindowProc = CallWindowProc(defWindowProc, _
                               hwnd, _
                               uMsg, _
                               wParam, _
                               lParam)

End Function

----------------------------------

Click the titlebar of frmMain and begin to move .. Form1 will follow beside
it.  Tweak as desired.

--

Randy Birch
MVP Visual Basic

http://www.mvps.org/vbnet/

Please respond only to the newsgroups so all can benefit.


Quote:> Hey All...

>   I'm trying to move 2 forms at once.  I have one window that pops-up
> (B), and I have a little pushpin that moves the left property of
> window B to the rightside of the other form, A.  But, when I move form
> A, the other window doesn't go with it, obviously.  Is there a method
> I'm missing that could help me move both together as one entity?  Or
> an API call that I could use to accomplish this?

>   Any help is greatly appreciated!  Thanks in advance..

>           - Kevin

 
 
 

1. move - servercursor - slow when moving form record 1 to record 20.000

Hi!

I am using VB6 SQL7.0 and the ADO Connection

    SqlStr = "Select * FROM POS "
    rs.Source = SqlStr
    rs.CursorLocation = adUseServer
    rs.Open , , adOpenDynamic, adLockOptimistic
    rs.MoveFirst
    .....
then i fill a Grid in unbound Mode via the rs.move function. If i move in
single steps it runs fast but a move from record 10  to record 20.000 needs
extremly long (22sec.)

Infos:
1. I have to use the Serversided Cursor because the Database holds more than
1.5 Million Records. (A Client Cursor will copy the recordset in to the
clients memory)
2. I can not reduce the reordset with a "where" because the user has to
scroll the hole table

any Ideas ?

Christian Eckler

2. FoxPro Library Construction Kit

3. "Invalid Operation" while adding appending a user to a group

4. Moving from form to form in VFP 3.0

5. Corrupted blob fields in Paradox

6. VFP5 - Moving form by dragging an object on form

7. DTS source name problems

8. P4WIN: keeping several forms open at once

9. Displaying Several records at once on a form

10. Once more..how to Tab Grid Form?

11. Open a Form all at once??

12. p4win: Moving record pointer in forms