Results 1 to 3 of 3

Thread: [RESOLVED] abou move and not move events

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,959

    Resolved [RESOLVED] abou move and not move events

    i'm using the VB6 and i'm creating a control for put the Move and NotMove events, but i know that theres a error in my code... can anyone help me?

    heres the control code:

    Code:
    Option Explicit
    
    Event Move(PosX As Long, PosY As Long)
    Event NotMove(PosX As Long, PosY As Long)
    
    Dim OldPosX As Long
    Dim OldPosY As Long
    
    Private Sub Timer1_Timer()
        'testing if the usercontrol is moving or not
        If UserControl.CurrentX <> OldPosX Or UserControl.CurrentY <> OldPosY Then
            OldPosX = UserControl.CurrentX
            OldPosY = UserControl.CurrentY
            RaiseEvent Move(OldPosX, OldPosY)
        Else
            RaiseEvent NotMove(OldPosX, OldPosY)
        End If
    End Sub
    
    Private Sub UserControl_Initialize()
        'receving the actual position of the usercontrol in form
        OldPosX = UserControl.CurrentX
        OldPosY = UserControl.CurrentY
        UserControl.MaskColor = UserControl.BackColor
        UserControl.MaskPicture = UserControl.Image
    End Sub
    i tested the currentx and currenty but i'm recive 0(zero), why?
    thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [RESOLVED] abou move and not move events

    This is marked resolved but with no posted resolution.

    Did you resolve your issue?

    If so, please post what you did as it may help someone else with the same or similiar issue.

    Thanks.

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,959

    Re: [RESOLVED] abou move and not move events

    Quote Originally Posted by Hack
    This is marked resolved but with no posted resolution.

    Did you resolve your issue?

    If so, please post what you did as it may help someone else with the same or similiar issue.

    Thanks.
    i'm sorry... you have right...
    i just build 2 variables: lngPosX and lngPosY, both type long...
    then i read the variables in show usercontrol event using the Extender.left and Extender.top lines:

    Code:
    lngPosX=Extender.left
    lngPosY=Extender.top
    then i put them in a timer control to see the actual position of a usercontrol in form:

    Code:
        If Extender.Left <> lngOldPosX Or Extender.Top <> lngOldPosY Then
            lngOldPosX = Extender.Left
            lngOldPosY = Extender.Top
            RaiseEvent Move(lngOldPosX, lngOldPosY)
        Else
            RaiseEvent NotMove(lngOldPosX, lngOldPosY)
        End If
    thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

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