Documentation for Windows & Controls Order of Operation

As a matter of fact, under the hood, events are signals, and they are indeed received. However, in Xojo, we tend to take the event handler for the actual event. Hence perhaps the idea that events are generated.

I think raised is the preferred term.

3 Likes

Since Window.opening happens after controls have been instantiated, even if you modify controls properties, you are fine.

However, in controls Opening event, one should refrain from addressing other controls, because they may not have been instantiated yet.

Just FYI, LostFocus cannot be cancelled. Coding by focus events is fraught with peril.

1 Like

Sure, cancel a moving focus canā€™t in Xojo. But moving the focus can be overridden moving the focus back to the current control with a setfocus in the LostFocus event.

But then youā€™ve got a GotFocus and LostFocus on the other control, plus a GotFocus on the original control to deal with. It gets tricky.

Sadly, but as I said, and this is the important part, must obey such order in any GUI, you canā€™t ENTER a place before LEAVING the previous place.

That part isnā€™t documented, I donā€™t think, but Xojo does raise LostFocus on the first control before GotFocus on the next. Thatā€™s probably worth a mention somewhere in the documentation, if itā€™s not already there.

2 Likes

I Joe.LostFocus() 23 replies agoā€¦

Sorry, couldnā€™t resist.

2 Likes

As it should, in any event driven GUI system, as I said. The system isnā€™t chaotic. There are places where orders and cascades MUST exist. Events are queued and the event loop gets them in that order.

2 Likes