Form position

Discussion in 'Questions (Windows Mobile)' started by WZSun, Jun 8, 2009.

  1. WZSun

    WZSun Member Licensed User

    Hi,
    Sometime back I was using the Door library to get the top and left positions of the form (Example #1) so that when the form is moved to another location, the new form is position in the 'new' location (Example #2).

    Example #1:
    If Not(cPPC) Then
    door.FromControl("fm2")
    End If
    fm9.Show
    PosTop = fm2.top
    PosLeft = fm2.left


    Example #2:
    If Not(cPPC) Then
    door.FromControl("fm7")
    door.SetProperty("StartPosition","Manual")
    fm7.top = fm2.top
    fm7.left = fm2.left
    End If


    Question: Is there a way where I can set them as Subroutines so that I can get the position from previous form, and then set the position to the next form.

    Example:
    Sub GetPositionNow(FormName)
    If Not(cPPC) Then
    door.FromControl(FormName)
    PosTop = door.FromControl(FormName).top
    PosLeft = door.FromControl(FormName).left
    End If
    End Sub

    Sub SetPositionNow(FormName)
    If Not(cPPC) Then
    door.FromControl(FormName)
    door.SetProperty("StartPosition","Manual")
    Form.top = PosTop
    Form.left = PosLeft
    End If
    End Sub



    Any help is appreciated.
     
  2. eww245

    eww245 Member Licensed User

    To get a Forms position with the door library use this.

    Code:
    door.FromControl(FormName)
    TopPos = door.GetProperty(
    "Top")
    LeftPos = door.GetProperty(
    "Left")
    The rest of the code should work fine
     
  3. agraham

    agraham Expert Licensed User

    It's undocumented but because a Form is actually a Control FormName.Top and FormName.Left will work both in the IDE and when optimised compiled. This might of course change in future versions but it still works in the forthcoming version 6.80.
     
  4. WZSun

    WZSun Member Licensed User

    Hi,
    Thanks for the tips.... below are the subroutines that work...

    Sub GetPositionNow(FormName)
    If Not(cPPC) Then
    door.FromControl(FormName)
    PosTop = door.GetProperty("Top")
    PosLeft = door.GetProperty("Left")
    End If
    End Sub

    Sub SetPositionNow(FormName)
    If Not(cPPC) Then
    door.FromControl(FormName)
    door.SetProperty("Top",PosTop)
    door.SetProperty("Left",PosLeft)
    End If
    End Sub


    Hi Erel,
    I still noticed that the 'window' could still be seen (as flashing) when the form is moved. It'd be great to have Basic4PPC takes care of the window position internally in 6.80 to eliminate the window flashing..

    Thanks!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice