Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event indicating form rendering has completed? 1

Status
Not open for further replies.

ejm8

Technical User
Apr 22, 2004
17
US
Is there any event that indicates form rendering has completed?

I want to reposition/resize a form based on the available space in the main access window. In the [tt]Form_Load[/tt] event, if I do:
Code:
Me.Move 0, 0
...that should move the form to the very top left of the main access window under the menubars and toolbars. The problem is the [tt]Form_Load[/tt] event is firing before the toolbars not applicable to the form are removed and I end up having a gap between the top of the form and the closest toolbar equal to the size of the removed toolbar.
 
You may consider the Activate event.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the suggestion PHV. Unfortunately I get the same results with [tt]Activate[/tt] as I do with [tt]Form_Load[/tt] (gap between top of window and toolbar).
 
Ultimately the Current event.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I get the same result with all three events ([tt]Form_Load[/tt], [tt]Activate[/tt] and [tt]Current[/tt]).
 
Last resort: a one time Timer ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I'm not sure what you mean by a one time Timer?

Just to test, I tried setting a timer on the form and doing this but got the same result:
Code:
if i=0 then
     me.move 0,0
     i=1
end if

The Timer even fires before the toolbars are removed. I guess I could set the timer interval out to say 20 seconds to make sure the rendering is complete, but then it make the app look look clunky/slow.

I was hoping there would be some API call I could do to check to see if the rendering was complete. If there were, I could loop in the [tt]Form_Load[/tt] event until the rendering completed and then do the move.
 
Perhaps something like this ?
Private Sub Form_Timer()
Static i As Integer
If i = 0 Then
Me.TimerInterval = 1000
i = 1
Else
Me.TimerInterval = 0
Me.Move 0, 0
End If
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks again PHV! That does work.

It feels a little clunky, but it works. I'm a *little* concerned about how it will affect the performance of my forms that already have a timer on them. Such as one that functions as a near-real-time agent monitor and refreshes every 6 seconds.

Code:
Private Sub Form_Timer()
    Static b As Byte
    If b = 0 Then
        b = 1
        Me.TimerInterval = 750
    ElseIf b = 1 Then
        b = 2
        Me.TimerInterval = 6000
        fnPositionAndSizeWindow "retrieve"
    Else
        refreshDisplay
    End If
End Sub

It feels about the same after the inital clunkyness, and I will deal with the longer loop if I don't find a betters solution. Would a Select Case be better performance wise? Any other thoughts?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top