Listbox: column resizing issues

I have a listbox with several columns, whose widths are initialised thus:

[code]dim ptr As Listbox

ptr = MainWindow.MailsList

ptr.Column(0).WidthActual = 27
ptr.Column(1).WidthActual = 27
ptr.Column(2).WidthActual = 213
ptr.Column(3).WidthActual = 134
ptr.Column(4).WidthActual = 47
ptr.Column(5).WidthActual = 0
ptr.Column(6).WidthActual = 2000

I want to have the following behaviour:

  1. The user should be able to resize a column, with the required width for this being added to or subtracted from the rightmost column. Other columns’ widths should not be affected. At the moment, resizing a column steals from or adds to the width of the next column to the right, which is not ideal as the user didn’t ask for that.

  2. Resizing the listbox (done in software) should increase or decrease the width of the rightmost column, and leave other column widths alone. At the moment, all columns increase or decrease in size proportionately.

Does the listbox support these behaviours?

As far as I know you should use WidthExpression and not WidthActual (but I am not sure):

ptr.Column(0). WidthExpression = "27" // note that 27 is a string ptr.Column(1). WidthExpression = "27" ptr.Column(2). WidthExpression = "213" ptr.Column(3). WidthExpression = "134" ptr.Column(4). WidthExpression = "47" ptr.Column(5). WidthExpression = "0" ptr.Column(6).WidthExpression = "*" // this column will use the "surplus" space

Maybe you can use ColumnWidths.

Well this is interesting. If I use Eli’s as-is, it fails (1) in my OP but succeeds with (2). If I use “2000” instead of “*”, then both (1) and (2) are satisfied. Of course, that’s a bit of a bodge as the listbox then extends into next-door’s garden, but I don’t expect to ever have a screen that wide.

And yes, I can use ColumnWidths and just use “27, 27, 213, 134, 47, 0, 2000”, that works as well.

I have a feeling that I did it this way originally and must have changed it for some reason, but I can’t remember why. And also, unfortunately, I only have a licence for OS X so can’t save the project in text form and do version control as I do with the PHP/JavaScript version of this app. That way I could have looked back at the change control notes.


FWIW, I use Subversion with binary projects just to get the notes on each change. You can use a tool like arbed to do diffs on binary projects.

I’m using Cornerstone, which uses Subversion internally, to manage my older PHP/JS version. I’ll try it with the Xojo app and see how I get on.