ListBox column header separator double click

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?

Can someone point me in the right direction?

Thanks in advance.

There isn’t one

Unless there is some magic declare, your best bet is to use

System.MouseDown and System.MouseUp. http://documentation.xojo.com/index.php/system

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.

Thanks guys, I thought as much, time to code my own then.

I haven had my morning caffeine injection so I might be doing something super daft, but I’m looking at:

http://developer.xojo.com/xojo-system

I have cut and paste the following code from the bottom of that page into a test method :

[code]Dim start As Double = Xojo.System.Ticks

’ Do a long-running process here

Dim finished As Double = Xojo.System.Ticks
Dim elapsedSeconds As Double = (finished - start) / 60[/code]

But I’m getting “This item does not exists” for System.Ticks ? I thought the new framework was fully cross platform?

However, it works if I remove Xojo.System.

Do I need to report that as a bug?

Not System.Ticks. Simply Ticks.

Thats super confusing, why can I use Xojo.IO.FolderItem and Folderitem and not Xojo.System.Ticks ? They are both from the new Framework scratches head

http://documentation.xojo.com/index.php/ticks

Xojo.system.ticks is clearly meant for iOS only. See the page. Projects : iOS. Platform : iOS.

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.

Basically, Ticks is called just the same way in Desktop and iOS, since in iOS the namespace is not necessary. So simply Ticks it is on both.

Julian:

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 Click’s 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.

I’ve made a nap and, minutes ago, I started to continue on what I shared, but I failed (my brain must be busy -{).

I will try back tomorrow to go ahead.