SDI - On Closebox event invoked by Win taskbar

Hi,

When I click on the closebox attached to a preview of window in Windows taskbar, it invokes standard On closebox event - that’s great, since I’d like to handle closing of some specific windows manually (especially kind of “main” windows, whose closing should lead to quiting whole application). I’d also like to attatch a confirm dialog there - sure I can, but if the application is not active at the moment, it doesn’t behave as I would be expecting - the desired dialog is opened, but as the application is not brought to front (it remains inactive in the taskbar), it’s seems like nothing happens until the application is activated manually.

It doesn’t seems to be standard behavior compared to other Win applications - these dialogs usually pops, when this taskbar closebox is clicked.

I’m not sure if this behavior should be treated like a feature request or even a bug. Is there any way, how to handle this issue? What I need is simply to activate whole application and bring it to front(not a single window within the appilication).

This concerns only SDI… The behavior is same both on v17 (17.246104) and v18 (Build 18.249194).

probably a stop-gap measure at best,

but you could give this one a try

https://github.com/miyako/4d-plugin-activate

Thanks much,

unfortunately use of this plugin seems to lead to a crash :frowning: Maybe I’m using it in an improper way. I gave it a try in a new blank database, it crashes both in interpreted ad built modes.

Builds 18.249194 and 17.246104 of 4D tested.

I looked at the source code, it sure doesn’t take into account SDI mode.

sorry for wasting your time :pray:

Nevermind, at least a try :wink:

And it actually leads me to temporarily acceptable solution, even it’s far from perfect:

As SDI mode is taken into count only in compiled mode (built application in fact), that’s the only mode I have to handle. And built application doesn’t contains the possibility of running multiple instances of same instalation (yeah, it might be a nice feature too :-D) - it works still same like in the older (pre16) versions of 4D in general - once the application is to be launched for the second time, it’s brought to front instead.

So as the Activate 4D plug-in is not working, the code which it was about to replace still works, using LAUNCH EXTERNAL PROCESS command.

The only problem is that performance of this sequence takes quite a lot of time, so as it does the expected action in the end, it may cause users` confusion. And of course such a slow perfomance of such a simple results makes the application a bit uncool in the eyes of ordinary users.

I’ve made some changes in 3.0.0.

https://github.com/miyako/4d-plugin-activate/releases/tag/3.0.0

That said, could you not simply call SET WINDOW RECT to activate the
window?

https://doc.4d.com/4Dv18/4D/18/SET-WINDOW-RECT.301-4505237.en.html

: doc.4D.com

By default, executing this command automatically moves the window
designated by the window parameter to the foreground.

Awesome!

Now the plugin works really great, thanks a lot!

About SET WINDOW RECT - I gave it a try in the very beginning, but it seems to work only within the application itself.