Results 1 to 10 of 10

Thread: Move Controls

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Move Controls

    I have to post a zip file and say "fix this," but can anyone help me find out what's so buggy about this code?

    The goal is to move and resize the objects in runtime.
    Attached Files Attached Files
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    *BUMP*
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Catalonia
    Posts
    397
    What are you asking for?
    The example looks to work fine
    Josep Mª

  4. #4

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Only the bottom right corner box works on the resizing. I can't seem to find out why the others dont.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Catalonia
    Posts
    397
    I am resizing all your controls (label, buttons and box) using the code without any change
    Josep Mª

  6. #6

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Notice that there are four "resizing boxes" to resize the controls. Only the bottom right one works for me.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    *bump*
    My evil laugh has a squeak in it.

    kristopherwilson.com

  8. #8
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    I think I have a something at home that does a pretty good job. I will post it if I can find it when I get home.

  9. #9
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Catalonia
    Posts
    397
    This is your code modified and it looks to work correctly
    VB Code:
    1. Private Sub picMove_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    2. Dim newWidth As Integer, newHeight As Integer
    3.  
    4.   If MoveIt = True Then
    5.     Select Case Index
    6.       Case 0
    7.         newHeight = picMove(3).Top - picMove(Index).Top + OldY - Y - picMove(Index).Height
    8.         If newHeight >= 195 Then
    9.           picMove(Index).Top = picMove(Index).Top + Y - OldY
    10.           currControl.Height = newHeight
    11.           currControl.Top = picMove(Index).Top + picMove(Index).Height
    12.         End If
    13.         newWidth = picMove(1).Left + OldX - X - picMove(Index).Left - picMove(Index).Width
    14.         If newWidth >= 195 Then
    15.           picMove(Index).Left = picMove(Index).Left + X - OldX
    16.           currControl.Width = newWidth
    17.           currControl.Left = picMove(Index).Left + picMove(Index).Width
    18.         End If
    19.         picMove(3).Left = picMove(0).Left
    20.         picMove(1).Top = picMove(0).Top
    21.       Case 1
    22.         newHeight = picMove(3).Top - picMove(Index).Top + OldY - Y - picMove(Index).Height
    23.         If newHeight >= 195 Then
    24.           picMove(Index).Top = picMove(Index).Top + Y - OldY
    25.           currControl.Height = newHeight
    26.           currControl.Top = picMove(Index).Top + picMove(Index).Height
    27.         End If
    28.         newWidth = (picMove(Index).Left + X - OldX) - currControl.Left
    29.         If newWidth >= 195 Then
    30.           picMove(Index).Left = picMove(Index).Left + X - OldX
    31.           currControl.Width = newWidth
    32.         End If
    33.         picMove(2).Left = picMove(1).Left
    34.         picMove(0).Top = picMove(1).Top
    35.       Case 2
    36.         newHeight = (picMove(Index).Top + Y - OldY) - currControl.Top
    37.         If newHeight >= 195 Then
    38.           picMove(Index).Top = picMove(Index).Top + Y - OldY
    39.           currControl.Height = newHeight
    40.         End If
    41.         newWidth = (picMove(Index).Left + X - OldX) - currControl.Left
    42.         If newWidth >= 195 Then
    43.           picMove(Index).Left = picMove(Index).Left + X - OldX
    44.           currControl.Width = newWidth
    45.         End If
    46.         picMove(1).Left = picMove(2).Left
    47.         picMove(3).Top = picMove(2).Top
    48.       Case 3
    49.         newHeight = (picMove(Index).Top + Y - OldY) - currControl.Top
    50.         If newHeight >= 195 Then
    51.           picMove(Index).Top = picMove(Index).Top + Y - OldY
    52.           currControl.Height = newHeight
    53.         End If
    54.         newWidth = picMove(1).Left + OldX - X - picMove(Index).Left - picMove(Index).Width
    55.         If newWidth >= 195 Then
    56.           picMove(Index).Left = picMove(Index).Left + X - OldX
    57.           currControl.Width = newWidth
    58.           currControl.Left = picMove(Index).Left + picMove(Index).Width
    59.         End If
    60.         picMove(0).Left = picMove(3).Left
    61.         picMove(2).Top = picMove(3).Top
    62.     End Select
    63.   End If
    64. End Sub
    Josep Mª

  10. #10

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Man, you are seriously my hero. Thanks alot. I'm trying to study and understand everything you changed. Thanks again, man.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width