Non Existent Control Error

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jweber72 Offline
Junior Member
Posts: 9
Joined: Feb 2012
Reputation: 0
Post: #1
Im playing this creating a custom dialog and so far have been using the code from script.rss.editor to help me get started. I have been able to strip all the unnecessary parts from it and get it to display correctly, but as soon as I add a new control to the xml file and some code that conforms to the code already in place I get the non-existent control error.

Code:
def defineControls(self):
        #actions
        self.action_cancel_dialog = (18, 20)
        #control ids
        self.control_heading_label_id       = 2
        self.control_list_label_id          = 3
        self.control_list_id                = 10
        self.control_changeSet_button_id    = 11
        self.control_add_button_id          = 13
        self.control_remove_button_id       = 14
        self.control_ok_button_id           = 18
        self.control_cancel_button_id       = 19
        self.control_headinga_label_id=20
        self.heading_label      = self.getControl(self.control_heading_label_id)
        self.list_label         = self.getControl(self.control_list_label_id)
        self.list               = self.getControl(self.control_list_id)
        self.add_button         = self.getControl(self.control_add_button_id)
        self.remove_button      = self.getControl(self.control_remove_button_id)
        self.changeSet_button   = self.getControl(self.control_changeSet_button_id)
        self.ok_button          = self.getControl(self.control_ok_button_id)
        self.cancel_button      = self.getControl(self.control_cancel_button_id)
        self.headinga_label=self.getControl(self.control_headinga_label_id)

And the code from the xml file:

Code:
        <control type="label" id="20">
            <description>HeadingA Label</description>
            <posx>0</posx>
            <posy>0</posy>
            <width>500</width>
            <align>left</align>
            <textcolor>dialogheader</textcolor>
        </control>

The complete error is as follows:

Code:
08:25:25 T:3308 M:2406514688  NOTICE:   File "C:\Program Files (x86)\XBMC\addons\plugin.test.dialog\default.py", line 124, in onAction
08:25:25 T:3308 M:2405986304  NOTICE: if action in self.action_cancel_dialog:
08:25:25 T:3308 M:2405986304  NOTICE:   File "C:\Program Files (x86)\XBMC\addons\plugin.test.dialog\default.py", line 43, in onInit
08:25:25 T:3308 M:2405986304  NOTICE: self.defineControls()
08:25:25 T:3308 M:2405986304  NOTICE:   File "C:\Program Files (x86)\XBMC\addons\plugin.test.dialog\default.py", line 73, in defineControls
08:25:25 T:3308 M:2405986304  NOTICE: self.headinga_label=self.getControl(self.control_headinga_label_id)
08:25:25 T:3308 M:2405986304  NOTICE: TypeError
08:25:25 T:3308 M:2405986304  NOTICE: :
08:25:25 T:3308 M:2405986304  NOTICE: Non-Existent Control 20

Whats interesting is the control is really just a copy of another that works properly. Any tips? Id be happy to use another approach if required, but seemed like the code in the rss editor was a good starting point.

Thanks

J
find quote
VictorV Offline
Senior Member
Posts: 124
Joined: May 2009
Reputation: 1
Location: Norway
Post: #2
You sure you got the whole XML correct? Invalid markup before the control or wrong placement in DOM tree can cause this.
find quote
jweber72 Offline
Junior Member
Posts: 9
Joined: Feb 2012
Reputation: 0
Post: #3
Not sure, but will check when I get home. Is there a schema I can validate my file against?

Essentially all I have done is take one of the xml files, that comes with the rss editor, rename it and duplicate an existing control but used a new ID.
find quote
VictorV Offline
Senior Member
Posts: 124
Joined: May 2009
Reputation: 1
Location: Norway
Post: #4
Not sure, but I don't think there exists any schema or DTD. It's pretty straightforward anyways. I'm not sure how the simple XML parser XBMC uses to parse the skin files handles syntax errors, but I think it do it silently.
find quote
jweber72 Offline
Junior Member
Posts: 9
Joined: Feb 2012
Reputation: 0
Post: #5
Stupid user error on this, sorry! I had neglected to change the code that pointed to my xml from the one I grabbed from the xml editor. Things seems to be working on this now but it does lead me to my next question as the solution is non-obvious.

When I point to script-RSS_Editor-rssEditor.xml, the dialog renders perfectly of course. However, when I point to plugin-test-dialog.xml ( a direct copy of script-RSS_Editor-rssEditor.xml ), the dialog does render but its missing some of the chrome that I see in the other dialog.

Its missing/different:

* Not centered
* Close Button is missing
* Colors are different.
* Size is different.
* Text seems to be justified differently.

I have copied the complete skins directory to my test plugin.

Any thoughts?
find quote
jweber72 Offline
Junior Member
Posts: 9
Joined: Feb 2012
Reputation: 0
Post: #6
Little bump. Can anyone tell me the mechanism that contributes the close button that normally appears in the upper right. My dialog is displaying but looks very unstyled.
(This post was last modified: 2012-02-26 00:55 by jweber72.)
find quote
pkscuot Offline
Posting Freak
Posts: 897
Joined: Jan 2011
Reputation: 20
Location: Honolulu, HI
Post: #7
jweber72 Wrote:Little bump. Can anyone tell me the mechanism that contributes the close button that normally appears in the upper right. My dialog is displaying but looks very unstyled.

Here's the code I use to create the close button:
Code:
<control type="button" id="200">
    <description>Close Window button</description>
    <posx>1000</posx>
    <posy>3</posy>
    <width>64</width>
    <height>32</height>
    <label>-</label>
    <font>-</font>
    <onclick>PreviousMenu</onclick>
    <texturefocus>DialogCloseButton-focus.png</texturefocus>
    <texturenofocus>DialogCloseButton.png</texturenofocus>
    <onleft>120</onleft>
    <onright>120</onright>
    <onup>120</onup>
    <ondown>120</ondown>
    <visible>system.getbool(input.enablemouse)</visible>
</control>
I haven't found that image anywhere, so I'm beginning to wonder if it's buried in the Textures.xbt for the Confluence skin (which means my plugin isn't as skin independent as I thought). Unfortunately there doesn't seem to be any way to unpack the xbt file to confirm that.
find quote
jweber72 Offline
Junior Member
Posts: 9
Joined: Feb 2012
Reputation: 0
Post: #8
Yes thats definitely it... Thank you very much, I was assuming incorrectly that the window chrome ( including the close button ) was coming for free. Thats not the case.

I am wondering if coordinates are truly my issue with styling... Right now it looks the background image of the dialog is way out of proportion. Will read up on the relevant xml that controls this.

Thanks again!
find quote