Results 1 to 11 of 11

Thread: [RESOLVED] reading some properties values without a time control

  1. #1

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

    Resolved [RESOLVED] reading some properties values without a time control

    theres any way to read properties without a time control?
    for example: has you know the form can move(any time), then the Top and Left property change... can i read these values(always) without a timer control?
    for build a events that can be fast...
    thank you...

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: reading some properties values without a time control

    I'm not sure I understand...are you wanting to create events for when the form moves/its top/left properties change?

    To do this without a timer control requires subclassing. Windows will tell your program every time the form moves (WM_MOVE message I think but I could be wrong).

    Searching www.pscode.com/vb for subclassing will get you some (a lot of) results. There is also code on this forum for subclassing.

    Wrapping the code into a class module would be the best way to do it.

  3. #3

  4. #4

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

    Re: reading some properties values without a time control

    Quote Originally Posted by DigiRev
    I'm not sure I understand...are you wanting to create events for when the form moves/its top/left properties change?

    To do this without a timer control requires subclassing. Windows will tell your program every time the form moves (WM_MOVE message I think but I could be wrong).

    Searching www.pscode.com/vb for subclassing will get you some (a lot of) results. There is also code on this forum for subclassing.

    Wrapping the code into a class module would be the best way to do it.
    i'm sorry, but i don't find what i need (the form moves was a example)... but thank you... Martinliss your code don't work because the resize event form is only about width and height properties... not for left and top properties...
    thank you... i found a code for give me the Move event form, but i must use a timer control... and i know that the timer control can slow the system/PC...
    theres a way for substitute the timer control?
    thank you

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: reading some properties values without a time control

    You're correct when you say it doesn't work if you move the form, but when you say "resize event form is only about width and height properties... not for left and top properties..." you're mistaken.


    Code:
    Private Sub Form_Resize()
    Debug.Print "Left: " & Me.Left; " Top: " & Me.Top; " Width: " & Me.Width; " Height: " & Me.Height
    End Sub

  6. #6

  7. #7
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: reading some properties values without a time control

    Quote Originally Posted by MartinLiss
    You're correct when you say it doesn't work if you move the form, but when you say "resize event form is only about width and height properties... not for left and top properties..." you're mistaken.


    Code:
    Private Sub Form_Resize()
    Debug.Print "Left: " & Me.Left; " Top: " & Me.Top; " Width: " & Me.Width; " Height: " & Me.Height
    End Sub
    Marty is right..

    Think about it.. if you resize your form from the top left corner.. Windows is just going to ignore you've resized it?

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  8. #8

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

    Re: reading some properties values without a time control

    Quote Originally Posted by chemicalNova
    Marty is right..

    Think about it.. if you resize your form from the top left corner.. Windows is just going to ignore you've resized it?

    chem
    i'm sorry... in that case is true (i have tested the code)... if i resize in top then i will change the top or left properties...
    Martinliss the code is complex to me and i don't know how use the code... can you help me?
    thank you

  9. #9

  10. #10

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

    Re: reading some properties values without a time control

    Quote Originally Posted by MartinLiss
    Here is an example.
    thank you... its working... thanks

  11. #11

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