In the Inspector for a 5-column Listbox I’m defining the header widths:
And in the Window in the IDE, I can see that these percentages are working:
In the PaintCellBackground event I’m setting the background color, and in the Opening event I’m setting the header names. But the column widths are back to the default values, where they’re all the same width. How can I force them to be the widths I see in the IDE?
Also, possibly related, is there some kind of caching involved here? Because I changed the final column name to “Frame Padding” in code, but when I run the app in the debugger, it’s still showing “Frame Number Padding” in the column header. I am only specifying the header labels in one place, the Opening event:
//Set up ClipList Listbox Headers
me.HeaderAt(0) = "Clip Name"
me.HeaderAt(1) = "Output File Path"
me.HeaderAt(2) = "Start Frame"
me.HeaderAt(3) = "End Frame"
me.HeaderAt(4) = "Frame Padding"
I set the header contents in the PaintHeaderContent event rather than in the Opening event. Further, I do it thus:
g.DrawText ("Clip Name", textXpos, textYpos)
so I can calculate just where I want the text in the header.
What Xojo version in what OS?
In 21r3.1 for Windows your example works as expected.
I’m using 2022r2.
Fresh eyes this morning. I’ve been seeing some weird behavior in Xojo lately.
This morning I opened the project and saw that I have two instances of my main window, with the same name for both, where this listbox is. One had the column widths set, the other did not. I don’t know this duplicate window got there, but it feels a lot like this bug I submitted a few weeks ago, because my windows are in a folder called Windows, and this duplicate was outside of that at the top level, with the same name. I deleted the second Window, changed the settings in the first, and now it all seems to work.
I was most likely editing the duplicate of the window without realizing it, but how did that duplicate window get there?
You saw that in the navigator ?
Yes. If you look at the issue I linked to above, the behavior is basically the same - the Window with the same name existed in my “Windows” folder as well as at the top level. In the issue I posted, you create a module, then another module inside that, and put a method in that inner module. Close the project and reopen, and the inner module exists at both the top level of the navigation and inside the first module, both with the same name.
Neither case should happen, but there you have it.
What if I do that in purpose ?
Add a folder, // Using the Feature name
Add a Module, // Using Module as name
Add a Window. // Using Window as name
Then I put Methods, Functions and Properties in Module,
Then I set the interface in Window.
For each brand new feature that need a window ?
Never have two windows with the same name.
Right. That’s not allowed. Xojo won’t let you. And yet, it happened. I didn’t name two windows the same, a duplicate of my window with the same name somehow existed for a while, and I was working on that. I don’t know how.
I don’t see what your scenario has to do with the problem I saw.
There is a known bug that I reported a while back, which is at least similar, but I can’t seem to find the case at the moment. If I stumble upon it, I’ll post it here.
Update: Ah, my report is confidential because I first saw it with GraffitiSuite classes, but is reported and is showing as scheduled for R3 though doesn’t appear to be fixed as of yet.
Good to know I’m not going crazy!