The window exposes a method called, Control(), and a property, ControlCount. You loop from zero to ControlCount-1 and examine each control using the IsA operator to determine if it is a PopupMenu. If so, you change it’s position.
for i = 0 to ControlCount-1
if Control(i) IsA PopupMenu then
PopupMenu(Control(i)).Top = PopupMenu(Control(i)).Top + 10
end
next
Note: the notation PopupMenu(Control(i)) is called Casting. It basically tells the compiler to take Control(i) and treat it like a PopupMenu. You would get a runtime exception if Control(i) were not actually a PopupMenu, but we have already confirmed (via IsA) that it is.
[quote=178545:@Tim Hare]The window exposes a method called, Control(), and a property, ControlCount. You loop from zero to ControlCount-1 and examine each control using the IsA operator to determine if it is a PopupMenu. If so, you change it’s position.
for i = 0 to ControlCount-1
if Control(i) IsA PopupMenu then
PopupMenu(Control(i)).Top = PopupMenu(Control(i)).Top + 10
end
next
Note: the notation PopupMenu(Control(i)) is called Casting. It basically tells the compiler to take Control(i) and treat it like a PopupMenu. You would get a runtime exception if Control(i) were not actually a PopupMenu, but we have already confirmed (via IsA) that it is.[/quote]