Hidden Button

Discussion and development of skins for XBMC4XBOX
Post Reply
User avatar
byron
Posts: 582
Joined: Wed Jul 04, 2012 9:26 pm
Location: Illinois
Has thanked: 27 times
Been thanked: 96 times

Hidden Button

Post by byron »

So I don't know how many of you out there are just browsing and looking for new skins, or maybe some of you dabble in the code yourselves...but I think that we could all benefit from this as "skinners." I was asking Xbs how I might be able to make a window appear on top of a dialog when it opens, or how to close the dialog once the other window opens (for all you veterans out there, I'm still learning :) )....

Continued From PM:
You want to close the favourites dialog whenever another window opens?
I suspect you can achieve that by having a hidden button with a visible condition like >Window.IsVisible(Favourites)< or >Window.Previous(Favourites)< that <onfocus>Dialog.Close(dialog[,force]) and <onfocus>setfocus> to the windows' default id.
@Xbs

This is beyond my scope of understanding lol...could you maybe explain how to make a hidden button first? I'm guessing it's just a radio button, but I don't know what you mean "hidden button." Once I learn how to make it, does it go into the dialog that I want to close or does it go into the window that I'm opening? Were exactly do I place it on the page (or does that even matter)? I did figure out how I made (foo) appear on top of the dialog though, I just added <visible>!WindowIsVisible(foo)</visible> above all of the controls. What this led to was (foo) opening on top of the dialog, and then when I closed (foo) I was left with Favorites and no control. Also with <visible>!WindowIsVisible(foo)</visible> in Favorites.xml, every time I close Favorites it immediately reopens with no control...I'm really confused on how to do this.

Thanks again for helping me with this,

byron
User avatar
xbs
Posts: 292
Joined: Thu Jul 05, 2012 3:22 pm
Location: Portugal
Has thanked: 29 times
Been thanked: 22 times

Re: Hidden Button

Post by xbs »

A hidden button is a button with no texture and generally positioned off screen, invisible to the user, that triggers a certain action.

e.g.

Code: Select all

<window id="0">
	<defaultcontrol always="true">8998</defaultcontrol> 
	<allowoverlay>no</allowoverlay>
	<controls>
		<control type="button" id="8998">
			<description>Run Favourites script</description>
			<posx>-20</posx>
			<posy>-20</posy>
			<width>1</width>
			<height>1</height>
			<label>-</label>
			<font>-</font>
			<onfocus>XBMC.RunScript(special://skin/scripts/favourites/default.py,limit=8)</onfocus>
			<onfocus>SetFocus(8999)</onfocus>
			<texturenofocus>-</texturenofocus>
			<texturefocus>-</texturefocus>
			<visible>Skin.HasSetting(HomeMenuNoFavouritesButton)</visible>
		</control>
		<control type="button" id="8998">
			<description>Don't Run Favourites script</description>
			<posx>-20</posx>
			<posy>-20</posy>
			<width>1</width>
			<height>1</height>
			<label>-</label>
			<font>-</font>
			<onfocus>SetFocus(8999)</onfocus>
			<texturenofocus>-</texturenofocus>
			<texturefocus>-</texturefocus>
			<visible>!Skin.HasSetting(HomeMenuNoFavouritesButton)</visible>
		</control>
Now, if you have something similar with visible condition 'Window.Previous(Favourites)' - close favourites and set focus to main menu.
If '!Window.Previous(Favourites)' set focus to main menu.
You'll need this in every window that can be accessed from Favourites.
You can make an include for it, of course (only the id's will change).

I'm not sure this will work but is worth a try.

Hope it hepls.
Skins: SLik JX720 MS_Redux Mosaic
Utils: HeXEn
github.com/xbs08/
User avatar
byron
Posts: 582
Joined: Wed Jul 04, 2012 9:26 pm
Location: Illinois
Has thanked: 27 times
Been thanked: 96 times

Re: Hidden Button

Post by byron »

So I wasted yet another day messing with this...I just don't think what I am trying to accomplish is possible. Thanks for the explanation, I kinda figured it had to do with a button and no texture combo (didn't think position really mattered).

I tried many variations of this idea, but the main problem was that <onfocus>SetFocus</onfocus> had to be used to make the control for Favorites available (but then again I'm not sure I totally grasp what you were suggesting). So far the best I've come up with is this:

http://pastebin.com/pqiiHrJu

with:

<visible>!Window.IsVisible(7)</visible>
<visible allowhiddenfocus="true">!ControlGroup(9000).HasFocus(95)</visible>
<animation effect="fade" start="100" end="0" delay="200" time="0" condition="Window.IsVisible(7)">WindowClose</animation>

making it so that the dialog is hidden and (foo) is visible. I tried soooo many different variations on how to do this (I even tried making a close window button in Favorites with <onclick>SendClick</onclick> but that didn't work either/ or maybe I didn't make the code proper).

Anyway, with the code above when (foo) opens Favorites "disappears" but still has control until the previousmenu button is hit on the remote (since it is still open but hidden). All-in-all it has the illusion of opening up on top of the dialog, but one click away from really happening. I don't know how to make it have control besides hitting the back button on the remote---any thoughts?
User avatar
xbs
Posts: 292
Joined: Thu Jul 05, 2012 3:22 pm
Location: Portugal
Has thanked: 29 times
Been thanked: 22 times

Re: Hidden Button

Post by xbs »

What windows are accessible thru the favourites dialog?

Another option would be use a special window (e.g. ID 1113) with in combination with a favourite script (see SLik) to display your favourites items and set the favourites dialog (ID=134) to close the dialog (ID=134) and replace it with the special window (e.g. ID=1113).

Code: Select all

<window type="dialog" id="134">
	<defaultcontrol always="true">10</defaultcontrol>
	<coordinates>
		<system>1</system>
		<posx>0</posx>
		<posy>0</posy>
	</coordinates>
	<controls>
		<control type="button" id="10">
			<description>Close dialog and open fav window</description>
			<posx>-20</posx>
			<posy>-20</posy>
			<width>1</width>
			<height>1</height>
			<onfocus>Dialog.Close(134)</onfocus>
         <onfocus>ActivateWindow(1113)</onfocus>
		</control>
Skins: SLik JX720 MS_Redux Mosaic
Utils: HeXEn
github.com/xbs08/
User avatar
byron
Posts: 582
Joined: Wed Jul 04, 2012 9:26 pm
Location: Illinois
Has thanked: 27 times
Been thanked: 96 times

Re: Hidden Button

Post by byron »

That's the thing, at this point its only one window available from ShutdownMenu, and since i added a top bar...Weather is also accessable. So it's actually kinda silly since what I've done pretty much works (I'm very stubborn though, and I like finishing what i set out to achieve).

I thought about what you suggested, it would probably be the best way to go about what I'm wanting...I just wanted to exhaust the method I was attempting. I'll have to check out what you did with slick and I'll get back to you, thanks again
User avatar
byron
Posts: 582
Joined: Wed Jul 04, 2012 9:26 pm
Location: Illinois
Has thanked: 27 times
Been thanked: 96 times

Re: Hidden Button

Post by byron »

Figured it out!!! Actually as is usually the case, it was INCREDIBLY easy with a ton of wasted time. I'm wondering what took me so long to try this (from DialogButtonMenu.xml):

http://pastebin.com/9Qh0wS5G

and that's all it took :D Thanks for the help, I'll surely be needing more---
Post Reply