Setting screen size breaks popup menu

Hi All.

I just found something … funny… and I need to know if I am doing something stupid, or I found a bug.

When I open my main window for my program, I fill in a popup menu with options using:

mainWindow.groupPopupMenu.AddRow “Customer”

not fancy, but it works.
When I go to set the screen size to what I want using the

(Screen(0).Width -100)

for example, the project launches but the popup menu is empty.

Remove the line and all is good.

Any ideas? Am I an id10t?

Regards

Hi Michael,
That sounds interesting. When you say:

Do you mean you’re setting your window’s width to screen(0).width - 100, or the PopupMenu?

Can you toss up some code to test against? The OS and Xojo version you’re using would also be helpful.

Hi Anthony.

When I speak of setting the screen size, I am acting on the window.

The code, though not very pretty, is in the open event for the window (mainWindow) shown below:
// allow column resize

mainWindowListbox.AllowResizableColumns = TRUE

// fill in the listbox headings

mainWindowListbox.HeaderAt (0) = “Group”
mainWindowListbox.HeaderAt (1) = “Name”
mainWindowListbox.HeaderAt (2) = “Start”
mainWindowListbox.HeaderAt (3) = “End”
mainWindowListbox.HeaderAt (4) = “Notes”
mainWindowListbox.HeaderAt (5) = “Time (seconds)”
mainWindowListbox.HeaderAt (6) = “Time (minutes)”
mainWindowListbox.HeaderAt (7) = “Time (Hours)”
mainWindowListbox.HeaderAt (8) = “Tech 1”
mainWindowListbox.HeaderAt (9) = “Cell Number”
mainWindowListbox.HeaderAt (10) = “Office Number”

// center the columns, not left justify

mainWindowListbox.ColumnAlignmentAt (0) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (1) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (2) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (3) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (4) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (5) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (6) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (7) = Listbox.Alignments.Center

//fill in popup

mainWindow.groupPopupMenu.AddRow “Customer”
mainWindow.groupPopupMenu.AddRow “Awaiting e-mail / COR / calls”
mainWindow.groupPopupMenu.AddRow “Internal Work”
mainWindow.groupPopupMenu.AddRow “Work Order”
mainWindow.groupPopupMenu.AddRow “Important Notes”
mainWindow.groupPopupMenu.AddRow “Other”

//with this in, the mainWindow.groupPopupMenu does not fill in. Remove it and it works fine!
mainWindow.Width = (screen(0).Width - 100)
mainWindow.Height = (screen(0).Height - 100)

I am unable to replicate this on macOS 11.2.1 with Xojo 2020r2.1. It would be helpful to have the additional information and, if possible, isolate the problem to a small example project and share that.

Hi Anthony.

I’m using a Mac Big Sur 11.1.
My version of Xojo is: 2020 R 2.1

The code is in the mainWindow (Open) Event, and I posted it previously.
Nothing fancy. Just have a listbox on the window, fill in the headers, and align them, and then fill in the popupmenu on the window.

That’s it.
Maybe it works for you because you have 11.2.1 OS?

Regards

Don’t know. All I can say for sure is that it works here. I just tested it again:


Without seeing it happen, there’s not much else I can do to help.

As an aside, if your code is in mainWindow then you don’t need to reference mainWindow:

// allow column resize

mainWindowListbox.AllowResizableColumns = TRUE

// fill in the listbox headings

mainWindowListbox.HeaderAt (0) = "Group"
mainWindowListbox.HeaderAt (1) = "Name"
mainWindowListbox.HeaderAt (2) = "Start"
mainWindowListbox.HeaderAt (3) = "End"
mainWindowListbox.HeaderAt (4) = "Notes"
mainWindowListbox.HeaderAt (5) = "Time (seconds)"
mainWindowListbox.HeaderAt (6) = "Time (minutes)"
mainWindowListbox.HeaderAt (7) = "Time (Hours)"
mainWindowListbox.HeaderAt (8) = "Tech 1"
mainWindowListbox.HeaderAt (9) = "Cell Number"
mainWindowListbox.HeaderAt (10) = "Office Number"

// center the columns, not left justify

mainWindowListbox.ColumnAlignmentAt (0) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (1) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (2) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (3) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (4) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (5) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (6) = Listbox.Alignments.Center
mainWindowListbox.ColumnAlignmentAt (7) = Listbox.Alignments.Center

//fill in popup

groupPopupMenu.AddRow "Customer"
groupPopupMenu.AddRow "Awaiting e-mail / COR / calls"
groupPopupMenu.AddRow "Internal Work"
groupPopupMenu.AddRow "Work Order"
groupPopupMenu.AddRow "Important Notes"
groupPopupMenu.AddRow "Other"

//with this in, the groupPopupMenu does not fill in. Remove it and it works fine!
Width = (screen(0).Width - 100)
Height = (screen(0).Height - 100)

You can also set the InitialValue of the Listbox so that you don’t need to use HeaderAt to populate the headers at runtime, assuming you know the columns at design-time.

HI.

Ok… I am greviously cursed!
:smiley:
I’m going to try one or two things here… don’t think they will do anything… but if they do I will post.

And yes, I know I can do the headers before. But I am old, and I do things the way I have always done them. For some reason, doing things in code, so I know what I am doing and why tickles my brain the right way.

Meh.

Thanks for your help!

Regards

Hi there.
Did some more testing… don’t know why I did what I did, but I did it? Make sense???

Anyway when I reduced the number for the width as follows

Width = (screen(0).Width - 425)
Height = (screen(0).Height - 100)

it works.

If I resize the window manually the entries in groupPopup appear.

Any idea as to why this would be? I have an OLD Mac 2014 vintage, and hide the dock.

Regards