Toolbar not active

When I close a modal window to show my main window the Toolbar doesn’t show as active until I click on it. How can I ensure it shows as active?

What are you doing? I’ve never seen an inactive toolbar. Xojo version? macOS version?

You mean the toolbar is inactive yet the window (title bar, etc.) is active? If yes… weird…
If not, it’s the whole window that needs to be activated.
Is the toolbar AutoDisable set to true?

Latest Xojo, Catalina 10.15.7
Mainwindow has a Modal window open over it with some choices.
One of the choices opens a second modal window with some more choices
Continue closes both modal windows and the main window becomes active.
The Toolbar is greyed out as in not active but I can type in the TextField that has the focus
The toolbar only appears active after I click on the window

I can’t seem to see where to set that. Is that done in code or IDE?

Screenshot below

In API2 (recent versions of Xojo), this is now called “AllowAutoDeactivate”, sorry for the confusion.
I’m not sure it’d help, but perhaps it can be a workaround.

Ok, I tried to reproduce your issue but couldn’t. There’s something different on your side, which we may try to track down.

Can you try whether these steps also make the problem on your side?
•In a blank project, add a dummy toolbar with 2 buttons.
•Add an instance of this toolbar on the main window.
•Create two other windows (leave their default name untouched) with a movable modal frame.
•On Window3, add a property: MyParent as Window2
•On Window1, add a push button with this code:
dim w As new Window2
w.Show
•On Window2, add a push button with this code:
dim w As new Window3
w.MyParent=self
•On Window3, add yet another push button with this code:
self.Close
MyParent.Close

Run this and click all three buttons (according to the steps you mentioned, this should be similar). Then, you’re back to Window1 and the toolbar is enabled just fine.
Do you get the same result than with your project having the issue? If no, the problem is somewhere else in your particular project. If no, we may try other steps.

P.S.: I tried on Mac OS 10.14.

Will try after dinner :slight_smile:
I was doing something similar with the current project and noticed normal behaviour with one modal window closing but not if I open a second modal window and then try and close both.

You closed them one after the other, or together?

Together

If I close the first modal window before opening the second and then close the second one after the user does their choices the toolbar activates fine. I might have to go with that which is not exactly the behaviour I want if the user wants to cancel the second modal window and go back to the choices on the the first, that window is no longer there :frowning:

I’m still wondering why I can’t reproduce your issue (if someone could, this could be reported in Feedback).
Have you tried the steps I used yet?

Thanks @Arnaud_N your code works. I’m curious as to where my issue is and will have to look deeper.
I have a number of buttons on each window with a Default one set and I notice also that when I click the non default ones there seems to be a flash/refresh on the default one so there is definitely something wrong in my coding maybe tied in to multiple timers I have running??

When you click on a non default button, that one momentarily shows it’s pressed (is highlighted). At the same time, the actual default button becomes non highlighted while you track the other button.
You can verify this at the “Are you sure you want to shut down your computer now?” dialog, for example, or other dialogs: that’s normal and doesn’t mean a flaw in your code.

Could you strip down a copy of your project to see whether removing things solves the issue?
Also, if you can share relevant parts of it, I’d gladly take a look.

1 Like