I’m trying to find the event (or other system) when a user double clicks on the header separator between two column headers to set the column width to the width of the widest cell in that column. Basically, I want to be able to manipulate/calculate the widths of columns based on the width of the form. I have it working for just dragging things around, but nothing for double click (which is a standard windows feature for listboxes).
I’ve had a look around and had a read of the docs but I cant seem to find it, am I overlooking something or is it not in the framework?
I have a bad feeling that this isnt in the framework as I’ve already found a few snippets of code here and there regarding trapping the mouse events and calculating my own double clicks, mouse position and OS mouse button delays (cross platform) but I’m holding off on writing my own, calculating offsets for column dividers, taking into account UI scale etc, please let there be one built in?
Then you use a property to store ticks in MouseUp, and when the next MouseDown occurs, check if it is less than 30 ticks away. If so, you got a double click.
Wow, I totally missed that as I whipped the scroll wheel to the bottom of the page when it came up. I guess it hasn’t been migrated across yet for cross platform. I’ll have to keep an eye on that top Platforms section from now on, thanks Michel.
the code below is in the Listbox and only need to call the Column resize call:
[code]Function MouseDown(x As Integer, y As Integer) As Boolean
//
// Used to fake a Resize the Column on the Clicks Left
//
Dim Ticks_Start As Double
// Property: Ticks_End As Double
If System.MouseDown Then
Ticks_Start = Ticks
If Ticks_End - Ticks_Start < 30 Then
//
// Determine the column # to resize (using x) and check if you double clicked in the Heading (using Y)
// Then the call to the column resize
//
MsgBox “Double Click ???” // To be sure the MouseClick works
End If
Else
Ticks_End = 0
End If
Ticks_End = Ticks
End Function[/code]
Not fully tested. You need to write the needed code, then test the whole part. This is a first draft.
Thanks Emile, I’m doing something similar already. I’ll post back when I have something to share, but I need to pop out for the rest of the day so it’ll be later tonight or tomorrow.