Solved Dialog.Close works only once, why?
#1
Hi,

My purpose is:
1. Playing a video.
2. Open the controls buttons dialog (videoosd) with 'M'
3. Open the shutdown dialog (shutdownmenu) with 'S' + Close (videoosd) if active.
4. Press 'S' again to close (shutdownmenu), if the (shutdownmenu) was opened when (videoosd) was active, return it back.

This is work only once, but on the second try the (videoosd) doesn't close and (shutdownmenu) doesn't show up.

What I want is actually to toggle between (shutdownmenu) and (videoosd) when (videoosd) is active.

I have tried some ways, but still the same.

This is regarding the (shutdownmenu):
Code:
    <onload condition="Window.IsActive(videoosd)">SetProperty(hadVideoOSD,true,home)</onload>
    <onload condition="Window.IsActive(musicosd)">SetProperty(hadMusicOSD,true,home)</onload>
    
    <onload condition="Window.IsActive(videoosd) | String.IsEqual(Window(home).Property(hadVideoOSD),true)">Dialog.Close(videoosd)</onload>
    <onload condition="Window.IsActive(musicosd) | String.IsEqual(Window(home).Property(hadMusicOSD),true)">Dialog.Close(musicosd)</onload>

    <onunload condition="String.IsEqual(Window(home).Property(hadVideoOSD),true)">ActivateWindow(videoosd)</onunload>
    <onunload condition="String.IsEqual(Window(home).Property(hadMusicOSD),true)">ActivateWindow(musicosd)</onunload>    
    
    <onunload>ClearProperty(hadVideoOSD,home)</onunload>    
    <onunload>ClearProperty(hadMusicOSD,home)</onunload>
Reply
#2
why not just use a fadeout animation for the osd ?

xml:
<animation effect="fade" start="100" end="0" time="0" condition="Window.IsVisible(shutdownmenu)">Conditional</animation

so you dont need close dialogs , and keep it active
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#3
(2022-01-29, 17:59)mardukL Wrote: why not just use a fadeout animation for the osd ?

xml:
<animation effect="fade" start="100" end="0" time="0" condition="Window.IsVisible(shutdownmenu)">Conditional</animation

so you dont need close dialogs , and keep it active

Hi,
You can read here why:
https://forum.kodi.tv/showthread.php?tid=366724

When the dialog (videoosd) is opened I can't activate another window from the (shutdownmenu)
And it's too annoying to close the (videoosd) each time in order to be able to activate another window from the (shutdownmenu) which is the "Kodi Settings" in my case.
Reply
#4
(2022-01-29, 23:07)burekas Wrote:
(2022-01-29, 17:59)mardukL Wrote: why not just use a fadeout animation for the osd ?

xml:
<animation effect="fade" start="100" end="0" time="0" condition="Window.IsVisible(shutdownmenu)">Conditional</animation

so you dont need close dialogs , and keep it active

Hi,
You can read here why:
https://forum.kodi.tv/showthread.php?tid=366724

When the dialog (videoosd) is opened I can't activate another window from the (shutdownmenu)
And it's too annoying to close the (videoosd) each time in order to be able to activate another window from the (shutdownmenu) which is the "Kodi Settings" in my case.


ok...
so i suggest

just to be sure that you dont need to workaround if usig visible conditions.

that s how i do it in my skin,
- if osd active and activate shutdownmenu - it hides osd group, but keep osd window active , when close shutdownmenu the osd become visible and gain focus again

videoosd.xml
xml:

<controls>
<control type="group">
<visible>![Window.Is(videomenu) | Window.IsVisible(shutdownmenu) | Window.IsVisible(sliderdialog) | Window.IsVisible(osdaudiosettings) | Window.IsVisible(osdvideosettings) | Window.IsVisible(playerprocessinfo) | Window.IsVisible(osdcmssettings) | Window.IsVisible(PVROSDChannels) | Window.IsVisible(pvrchannelguide)]</visible>

<!-- osd stuff -->

</control>
</controls>

when like to refocus /reopen windows you'll indeed need to workaround
but put onload activatewindow(**) conditions to videofullscreen

e.g.
-> you are here: osd
- hit 's' key
-> you are here: shutdownmenu
xml:
<onload condition="window.isactive(videosd)">setproperty(forceopen,shutdownmenu,home)</onload>

....items close all dialog and bypass closing animations
<onclick>Dialog.Close(all,true</onclick>
<onclick>**item action***</onclick>


--> some window between in between shpulnt matter , as onback (SHOULD) reopen fullscreenvideo|fullscreenvisualisation <--


-> you are here: -> videofullscreen or fullscreenvideo|fullscreenvisualisation
xml:
<onload condition="!String.IsEmpty(Window(home).Property(forceopen))">activatewindow($INFO[Window(home).Property(forceopen)])</onload>
<!-- if above not working use
<onload condition="String.IsEqual(Window(home).Property(forceopen),shutdownmenu)">activatewindow(shutdownmenu)</onload>
-->
<onload condition="!String.IsEmpty(Window(home).Property(forceopen))">clearproperty(forceopen,home)</onload>
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#5
Hi @mardukL 

To be honest, I don't fully understand your solution,
and why my solution doesn't work (Why the videoosd dialog doesn't get close in the second time)

This is the log with my solution.
For unknown reason the second time init a Pointer.xml instead of back to DialogButtonMenu.xml ( = ShutdownMenu)

Code:
DEBUG <general>: CInputManager::HandleKey: s (0xf053) pressed, action is ActivateWindow(ShutdownMenu)
DEBUG <general>: Activating window ID: 10111
DEBUG <general>: ------ Window Init (DialogButtonMenu.xml) ------
DEBUG <general>: ------ Window Deinit (VideoOSD.xml) ------

DEBUG <general>: CInputManager::HandleKey: s (0xf053) pressed, action is Back
DEBUG <general>: ------ Window Deinit (DialogButtonMenu.xml) ------
DEBUG <general>: Activating window ID: 12901
DEBUG <general>: ------ Window Init (VideoOSD.xml) ------

DEBUG <general>: CInputManager::HandleKey: s (0xf053) pressed, action is ActivateWindow(ShutdownMenu)
DEBUG <general>: Activating window ID: 10111
DEBUG <general>: ------ Window Init (Pointer.xml) ------
Reply
#6
I checked and not sure why it worked just once.

the method i suggested was just a bit safer imo.

you dont need set propertys because osd is just not visible , but the videoosd dialog is still active

which means when closing shutdown menu without select any item the osd becomes visible again ( it never loose its origin focus, and must not be activated)

but when you select an item from the shutdown menu all dialogs need to be closed first ( if not you'll get the error due to active modal dialogs )
and thats the point for set propertys.

e.g. when select settings item within shutdown menu - osd has to be closed

xml:
<onclick>Dialog.Close(all,true)</onclick>
<onclick>ActivateWindow(settings)</onclick>

before - means going then back from settings - lead to fullscreenvideo ( last window from stack ) , so you'll need to tell that window it should force open the wished window.
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#7
@mardukL 

It's a problem to add:
Code:
<onclick>Dialog.Close(all,true)</onclick>
for the item of the "Settings" button in the power menu, 
since "script-skinshortcuts-includes.xml" is rebuilt everytime, and I don't find how to add it to the build script.
Reply
#8
(2022-01-30, 18:59)burekas Wrote: @mardukL 

It's a problem to add:
Code:
<onclick>Dialog.Close(all,true)</onclick>
for the item of the "Settings" button in the power menu, 
since "script-skinshortcuts-includes.xml" is rebuilt everytime, and I don't find how to add it to the build script.


Ok.
example of titan.

in the shortcut folder edit
overrides.xml
edit
xml:
<groupoverride group="powermenu" condition="Window.IsActive(DialogButtonMenu.xml)">Close</groupoverride>
to
<groupoverride group="powermenu" condition="Window.IsActive(DialogButtonMenu.xml)">Dialog.Close(all,true)</groupoverride>
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#9
@mardukL 

Thank you! It works! Smile

1. In "\shortcuts\overrides.xml" I replaced what you said:
Code:
<groupoverride group="powermenu" condition="Window.IsActive(DialogButtonMenu.xml)">Close</groupoverride>
With this line:
Code:
<groupoverride group="powermenu" condition="Window.IsActive(DialogButtonMenu.xml)">Dialog.Close(all,true)</groupoverride>

If you want to keep the previous behavior and just add a fix to this specific issue replace the first line with these:
Code:
<groupoverride group="powermenu" condition="Window.IsActive(DialogButtonMenu.xml) + ![Window.IsActive(videoosd) | Window.IsActive(musicosd)]">Close</groupoverride>
<groupoverride group="powermenu" condition="Window.IsActive(DialogButtonMenu.xml) + [Window.IsActive(videoosd) | Window.IsActive(musicosd)]">Dialog.Close(all,true)</groupoverride>

2. In the buttons controls that used in the VideoOSD.xml and MusicOSD.xml I added this line:
Code:
<visible>!Window.IsVisible(shutdownmenu)</visible>

3. All the added lines in the first comment has been removed, they are not needed.

Problem has been solved.
Reply

Logout Mark Read Team Forum Stats Members Help
Dialog.Close works only once, why?0