Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 9 Monaten
Letzter Beitrag:
vor 9 Monaten
Beteiligte Autoren:
Binod Lohani, Arie, ccc2, Fabrice Harari

WM20(Android)- Clicking outside the window to close window

Startbeitrag von Binod Lohani am 14.11.2016 14:28

Hello Gang !!
How to close Window on top when user clicks the area outside the Active Window ??
Any Idea ??
[attachment 2217 question1.jpg]

The exact condition is shown in the picture ...
The Active window is to be closed if user clicks the inactive Area ..
Thanks !!



The parent Window (from which you opened this child-window) receives an notification whenever a child-window closes. See the "Closing a child window of Window..." event. Here you can close your child window with a simple Close(yourchild).

von Arie - am 14.11.2016 14:43
Hi Arie !!
Say the name of my top window (active one) is win_noname2 and the bottom window is win_noname1

Now My Question is
What to write and where (in which window and event) to write the code
close (win_noname2)
when user clicks in the area outside Win_noname2 or
clicks in the window win_noname1??
Thanks again !

von Binod Lohani - am 14.11.2016 14:55

because in android there is no modal window, the background one will receive the click normally and therefore will gain focus

So in the code of the window gaining focus, you can just close the secondary window (test if it exists first, of course)

Best regards

von Fabrice Harari - am 14.11.2016 15:11
Excuses. I did not read your question god enough.
The event I am mentioned will fire when you close the CHILD window (win_noname2 in your case). So your parent window win_noname2 gets notified when you close the child window, from within this child window.
That is not what you want. You need Fabrice's solution.

von Arie - am 14.11.2016 15:59
you can do with simple trick

1. create a non maximize window
2. set the width / height of your target tablet
3. go to style , set background color to transparent
4. on windows code add "press/left button down"
add code close()
5. drag a image control into the window (select window image)

now when user click other than the image control it will close


von ccc2 - am 14.11.2016 16:31
Thanks Fabrice !!
The Solution is not working with my case !! I guess I made some mistake !
The top window (ie. active one) was opened when I long pressed the looper row of background window(ie. not active ) with the code

The code is written in the long pressed event of loop_noname1 of background window .

Now the background window is not receiving the the click normally .

von Binod Lohani - am 15.11.2016 01:06
This is because a window can not be clicked. You can only click on controls. So if you click on a control of your background window it should work.
Then the child-window is closed, the closing-code is run and also the "Closing a child window..." of your background window is called.

As a trick you can add a transparant image control in your background window and make sure it is below all other controls. This way every area of the window has a control.
Or put this image as an overlay on top of all other controls of the background window, when you open the child-window and put it aside (i.e move it ouside the screen or to another plane) again when getting back from the child window.

von Arie - am 15.11.2016 08:54
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.