hyperlink with property instead of fixed ID? (1 Viewer)

Lehmden

Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,568
    3,948
    Lehmden
    Home Country
    Germany Germany
    Hi.
    I'm searching for a way to use a property as hyperlink target. Something like
    Code:
    <define property="true">#menu0.hlink:1</define>
    <!-- On Push goto Television Main Screen -->
     
    ...
     
    	<control>
    	  <description>Menu 0 button</description>
    	  <type>button</type>
    	  <hyperlink>#menu0.hlink</hyperlink>
    	  <label>#menu0.buttonlabel</label>
    	</control>

    "#menu0.buttonlabel" is working as expected, no problem. But if I use #menu0.hlink it did not work (exception:confused:ystem.NullReferenceException), mostly crashing MP completely. I've tried to use #menu0.hlink, cint(#menu0.hlink), (cint(#menu0.hlink)), nothing worked. If I'm using "onclick" I can get it to work with property, but onclick did not react on pushing, only on clicking (as name let expect)

    As in Wiki hyperlink expects a string so normally "<hyperlink>#menu0.hlink</hyperlink>" should work
    hyperlink [history] String
    The id of the xml skin page that MP will load when the button is pushed

    Bu the only way I found to really get it working is using "<hyperlink>1</hyperlink>". But this is nothing I can use as hyperlink target should be changeable by end-user.
    Did someone know how to solve this?
     

    Zoidberg77

    MP Donator
  • Premium Supporter
  • July 12, 2011
    392
    206
    Home Country
    Germany Germany
    Hi,
    this is working without problems here. I used it a lot in my Titan theme. I use it without property="true" but in a quick test it worked with property="true" too.
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,568
    3,948
    Lehmden
    Home Country
    Germany Germany
    Hi
    Maybe I'm doing something wrong.
    btw I have to use "property="true" as I define them in another xml file (not skinsettings.xml) If I don't use "property="true" the defines are valid only in the file in which it is declared...

    I will try to download your theme, if possible and have a look there. If it's not possible, could you please copy/paste a working example here, thanks.
     

    Zoidberg77

    MP Donator
  • Premium Supporter
  • July 12, 2011
    392
    206
    Home Country
    Germany Germany
    Hi,
    I tested following:
    I added a definition to common.time.xml, which is the first import in my BasicHome.xml:
    Code:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <window>
     
    <define>#submenu1.hyperlink1:30</define>
     
    <controls>

    BasicHome.xml imports BasicHome.submenus.xml and there is following control:
    Code:
    <control>
    		<description>SUB ITEM 0</description>
    		<type>button</type>
    		<id>20001</id>
    		<label>#submenu1.label1</label>
    		<width>300</width>
    		<hyperlink>#submenu1.hyperlink1</hyperlink>
    		<hyperlinkParameter>#submenu1.hyperlinkparameter1</hyperlinkParameter>
    		<textureFocus>-</textureFocus>
    		<textureNoFocus>-</textureNoFocus>
    		<font>fontB14</font>
    		<textcolor>FFFFFFFF</textcolor>
    		<textalign>left</textalign> 
    		<textcolorNoFocus>60ffffff</textcolorNoFocus>
    		<onleft>1900</onleft>
    		<onright>1902</onright>
    		<ondown>1901</ondown>
    		<onup>#submenu1.label1.onup</onup>
    		<visible allowhiddenfocus="true">[!string.equals(#submenu1.label1,)]+[control.isvisible(20000)]</visible>
    		</control>
    This does work here with and without property="true".
    Also I figured out I will only need the property="true" attribute if I want to do some math like string.equal(#submenu1.hyperlink1)...
     

    Lehmden

    Retired Team Member
  • Premium Supporter
  • December 17, 2010
    12,568
    3,948
    Lehmden
    Home Country
    Germany Germany
    Hi.
    I really can't get it to work the way I want...
    If I define the property inside main basichome.xml it's working. But this is not the way I need it to work. I can't understand why this single property can not be imported... All other properties are working as epected...
    Code:
      <define property="true">#menu0.back:Animations\BasicHome\mytv.jpg</define>
      <define property="true">#menu0.label:Fernsehen</define>
      <define property="true">#menu0.buttonlabel:Fernsehen</define>
      <define property="true">#menu0.link:1</define>
    #menu0.back, #menu0.label and #menu0.buttonlabel are working like a charm used in this control:
    Code:
    <control>
    	  <description>Menu 0 button</description>
    	  <type>button</type>
    	  <id>2</id>
    	  <font>font12</font>
    	  <textXOff>0</textXOff>
    	  <textYOff>0</textYOff>
    	  <width>230</width>
    	  <textalign>center</textalign>
    	  <hyperlink>#menu0.link</hyperlink>
    	  <textureNoFocus></textureNoFocus>
    	  <textureFocus>empty.png</textureFocus>
    	  <label>#menu0.buttonlabel</label>
    	  <onleft>260</onleft>
    	  <onright>210</onright>
    	  <onup>202</onup>
    	  <ondown>1111</ondown>
    	  <textcolorNoFocus>FFE9967A</textcolorNoFocus>
    </control>

    Why did #menu0.link leads MP to crash????
     

    Zoidberg77

    MP Donator
  • Premium Supporter
  • July 12, 2011
    392
    206
    Home Country
    Germany Germany
    Hi,
    I just tested again. Definition #menu0.link:1 placed in common.time.xml and called in BasicHome.xml. Does work without problems, as well as with or without property="true". I have no clue what's going wrong in your setup, sorry.
     

    Users who are viewing this thread

    Top Bottom