KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: On Column Resize Trigger Fine Points
PRODUCT: 4D | VERSION: 16 | PLATFORM: Mac & Win
Published On: May 25, 2018
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

The On Column Resize event is documented to trigger when "The width of a list box column is modified by a user with the mouse".
It is obvious that this will trigger when a user modifies the column width using the vertical header lines. However there are other ways to resize a column with the mouse. This includes the scenario in which a column is resized when a list box is set to Horizontally Grow.

For example, if this property is enabled and the form window being resized horizontally with the user's mouse or similarly a splitter the listbox's width can change and effect some of the columns' widths.

If the code in the trigger should only run when the user resizes the column by using the vertical header lines a flag should be implemented. One way of introducing such a flag is to use the On Mouse Enter event to toggle on the flag and the On Mouse Leave to disable the flag.

For Example:

// List Box Object Method
Case of
    : (Form event=On Mouse Enter)
          //...
       colResize_b:=True
          //...
   
    : (Form event=On Mouse Leave)
          //...
       colResize_b:=False
          //...
   
    : (Form event=On Column Resize)
       If (colResize_b=True)
          //...do something...
       End if
   
End case