I understand where CellAlignment takes the value of ColumnAlignmet if CellAlignment is set to “default”, and the same with CellType and ColumnType
But at what point does CellAlignmentOffset take on the value of ColumnAlignmentOffset?
Since this is a numeric value, there is no “default” indicator… CellAlignmentOffset ALWAYS has a value
I think that CellAlignmentOffset is not taking the value of ColumnAlignmentOffset, if CellAlignmentOffset = 0 then the offset for the cell will be the value of ColumnAlignmentOffset, if CellAlignmentOffset <>0 then that value will override the value in ColumnAlignmentOffset
That doesn’t make sense… otherwise you could not have a ColumnAlignoffset that was NOT zero, and a individual cell the IS zero
and the documentation I have does NOT have what you quoted… .
It has similar statements for the other two properties I mentioned, but not the Offset one
[quote=442498:@Dave S]That doesn’t make sense… otherwise you could not have a ColumnAlignoffset that was NOT zero, and a individual cell the IS zero
and the documentation I have does NOT have what you quoted… .
It has similar statements for the other two properties I mentioned, but not the Offset one[/quote]
Mmmm, still don’t understand. Sorry.
The URL I put, there is only some text between the square with how to use it and the example, this is it:
I don’t understand how you can land on a different document.
listbox1.ColumnAlignmentOffset(5)=10 // set column 5 default offset to be 10
listbox1.CellAlignmentOffset(5,3)=0 // cannot do that, as a zero value would force the default to be used.... you cannot get Zero this way
that would be “fine” if the values were added together… but they are not…
It seems to look at CELL and if that is zero, then it takes the value from COLUMN
The online and internal documents don’t line up exactly it seems
[quote=442502:@Dave S]
listbox1.ColumnAlignmentOffset(5)=10 // set column 5 default offset to be 10
listbox1.CellAlignmentOffset(5,3)=0 // cannot do that, as a zero value would force the default to be used.... you cannot get Zero this way
[/quote] Exactly, you need: listbox1.CellAlignmentOffset(5,3) = listbox1.ColumnAlignmentOffset(5) * (-1) I still don’t know if that is what you want. I hope this helps.
Edit: It looks like my test is not correct. Sorry. It looks like having a default cell with -10 is the same as having it with 0. More testing…
[quote=442503:@Dave S]that would be “fine” if the values were added together… but they are not…
It seems to look at CELL and if that is zero, then it takes the value from COLUMN[/quote]
Of course you could just set CellAlignment Offset = 1 fro the cells that should not be offset in that column … a one pixel difference offset from other columns likely would not be noticed.
Alternatively you could draw the string yourself in CellText paint and have full control of placement.
That said Xojo inc should likely have used a “magic Number” constant (maybe = maxInt, named UseColumnOffset as the default value for CellAligmentOffset ).
then the column is offset by a negative value… see above…
If CellAlignmentOffset is ZERO then it takes on the value of ColumnAlignmentOffset
so
lb.ColumnAlignmentOffset(3)= 10 // by default move all columns 10 pixels right
lb.CellALignmentOffset(3,3)= -lb.ColumnAlignmentOffset(3) // this cell is now offset by -10 pixels.. .not by zero
basically the internal code acts like this
Get
If cellAlignmentOffset=0 Then Return columnAlignmentOffset
Return cellAlignmentOffset
End Get
Set
cellAlignmentOffset = value
End Set
as Karen had suggested it SHOULD be
Get
If cellAlignmentOffset=MAGIC_NUMBER Then Return columnAlignmentOffset
Return cellAlignmentOffset
End Get
Set
cellAlignmentOffset = value
End Set
Dave,
I understand your frustration.
When a type has no default value we may find some problems, as in this case.
I remember some time ago I wrote a function that received a parameter type Color.
I pretended to do something if this parameter was not assigned (I pretended a default value), but if you don’t assign a variable type colour what you get is the black colour. Black colour is too normal to be used as default.
So I had to invent a strange colour as default (fortunately there are so many colours, that it was not difficult). So if you didn’t provide the colour, default was used. I agree that the “magic number” is the only real solution.
Sub mySub(a As integer, b As double, c As color = &c998877)
If c = &c998877 Then
'Default colour
Else
'...
End If
End Sub