[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...
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.
Re: reading some properties values without a time control
Code:
Private Sub Form_Resize()
Debug.Print Me.Left
End Sub
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
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
Re: reading some properties values without a time control
Quote:
Originally Posted by joaquim
......
theres a way for substitute the timer control?
thank you
See post #4.
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
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
1 Attachment(s)
Re: reading some properties values without a time control
Re: reading some properties values without a time control
Quote:
Originally Posted by MartinLiss
Here is an example.
thank you... its working... thanks
Re: reading some properties values without a time control
You're welcome. Now please help us by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button.