Hi guys.!!

Good day.!

I just want to know on how to execute an event or function call after the resize event of the Form had been triggered!..

Thank you for giving time on this post.!

I would check for an interval delay or use a boolean value to prevent the called sub/function from being called repeatedly, or perhaps a timer control would do...

Good Luck

The lynxgrid resized at form resize event but the column of the grid does not resize to fit the width of the grid.If i execute my resize function columnresize() after the form resize has been triggered, it will do.But i need to click a button to resize it. I need to do it after the resize of the form automatically without clicking a button. This is the code to resize the column, this works fine..

function columnresize(curgrid as Lynxgrid)
with curgrid
   .forcecolfit
end with
end function

Any good way to do this guys...??Thank you for giving time.

As always..

Sorry for this delayed reply guys..I will keep this thread online today until i get this solve.

Thank you.

Edited 7 Years Ago by blocker: n/a

Okay, I don't know what kind of code you have in the resize event but here goes...

Option Explicit

Dim BusyResizing As Boolean

Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then Exit Sub
If BusyResizing = True Then Exit Sub 'this prevents reentrancy while user is dragging edge of form
BusyResizing = True
Timer1.Interval = 250 '1/4 second
Timer1.Enabled = False
'do resizing code here
BusyResizing = False
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
GridName.forcecolfit
End Sub

Okay, the logic behind the above is this. The boolean variable keeps the resize event from being entered or reentered (reentrancy) as the user drags the edge of the form. Controlling the timer this way in the hopes that the timer event will only fire after the user has released the edge of the form...

Note: Untested suggestion above

Good Luck

Okay, I don't know what kind of code you have in the resize event but here goes...

Option Explicit

Dim BusyResizing As Boolean

Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then Exit Sub
If BusyResizing = True Then Exit Sub 'this prevents reentrancy while user is dragging edge of form
BusyResizing = True
Timer1.Interval = 250 '1/4 second
Timer1.Enabled = False
'do resizing code here
BusyResizing = False
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
GridName.forcecolfit
End Sub

Okay, the logic behind the above is this. The boolean variable keeps the resize event from being entered or reentered (reentrancy) as the user drags the edge of the form. Controlling the timer this way in the hopes that the timer event will only fire after the user has released the edge of the form...

Note: Untested suggestion above

Good Luck

Thank you guys.this solves the problem. To make resizing smooth, just lower the interval of the timer.

God bless us.

This question has already been answered. Start a new discussion instead.