xbmcgui.ControlEdit
#1
Hi there,
I have question about xbmcgui.ControlEdit
When i added ControlEdit to my addon ControlEdit shows located at (x,y)=(0,0) point not (700,210)

self.edtE = xbmcgui.ControlEdit(700, 210, 150, 40,'')
self.addControl(self.edtE)

Do you have any idea why?

Thanks
Oki
Reply
#2
What your UI class (self) inherits from?
Reply
#3
I'm having the same problem. I tried with parent class xbmcgui.Window and xbmc.WindowDialog - it does the same thing on both. I also can't control the size of it - width, height are the same no matter what I specify.

This is in Frodo. I haven't tried it with Eden to see if something broke with Frodo.

Also, the whole control seems to be dependent on something in the textures.xbt file. It is pulling a background image from there when I instantiate with just coords, size, and label, like you did above. If I move the textures file, then the control won't be displayed at all. Bizarre. I tried first editing the 'edit' control in the defaults.xml file for the skin, then deleting the file altogether, but it made no difference either way. The textures.xbt file was the key to that problem, Although i haven't cracked it open to see if I can see which texture is specifically being pulled from there and drawn in the windowdialog.

[some time passes as I investigate]

Okay, I see in github that the default backgrounds are hardcoded into the control. From https://github.com/xbmc/xbmc/blob/master...ontrol.cpp:

Code:
strTextureFocus = focusTexture ? focusTexture :
        XBMCAddonUtils::getDefaultImage((char*)"edit", (char*)"texturefocus", (char*)"button-focus.png");

      strTextureNoFocus = noFocusTexture ? noFocusTexture :
        XBMCAddonUtils::getDefaultImage((char*)"edit", (char*)"texturenofocus", (char*)"button-focus.png");

So there needs to be a "button-focus.png" in your textures.xbt file (or your media folder, I'm guessing. I'm about to try it out. ). I'm actually building a new skin right now from scratch, and have no textures.xbt, and no button files with those names, so that's an interesting problem for me.

Still don't know where the 0,0 coords are coming from. I'm gonna experiment and see if moving and resizing the control after declaring it will work.

-Jerimiah

Oh sweet, it worked. I was able to move and resize the control outside the instantiation. I tried this:

Code:
mydisplay = MyClass()
mydisplay.inputbox_username.setText("Here's some text")
mydisplay.inputbox_username.setPosition(100, 250)
mydisplay.inputbox_username.setWidth(400)
mydisplay.setFocus(mydisplay.inputbox_username)
mydisplay.doModal()

and it worked fine. I hope that helps you.

Now I need to figure out if I can do something about the textures on my end. Big Grin

-Jerimiah
Reply
#4
(2013-09-22, 12:24)jerimiah797 Wrote: Now I need to figure out if I can do something about the textures on my end. Big Grin

-Jerimiah

Some controls (e.g ControlButton) can use the necessary textures from a current skin, but some don't, so the best way is to explicitly provide texture files for each control which needs them.
As for setting Control parameters, you need either to provide the necessary parameters on control's instantiation or to change its parameters after the control has been added using addControl(). If you try to set parameters before adding a control, this either does not work or you will get some weird bugs.
Currently I'm working on a framework for simple XBMC addon UI building which roughly imitates PyQt principles (a parent window with grid layout manager and several re-implemented fully functional controls), so I've played with xbmcgui controls plenty, though I still don't know what some of them do.
Reply
#5
i you happen to find out more about it don't hesitate to share. guess we should dump all info on a wiki page with detailed information as some sort of extension of the pydocs
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#6
(2013-09-22, 12:24)jerimiah797 Wrote: Also, the whole control seems to be dependent on something in the textures.xbt file. It is pulling a background image from there when I instantiate with just coords, size, and label, like you did above. If I move the textures file, then the control won't be displayed at all. Bizarre. I tried first editing the 'edit' control in the defaults.xml file for the skin, then deleting the file altogether, but it made no difference either way. The textures.xbt file was the key to that problem, Although i haven't cracked it open to see if I can see which texture is specifically being pulled from there and drawn in the windowdialog.
...
So there needs to be a "button-focus.png" in your textures.xbt file (or your media folder, I'm guessing. I'm about to try it out. ). I'm actually building a new skin right now from scratch, and have no textures.xbt, and no button files with those names, so that's an interesting problem for me.
Yes, this is considered as a feature (I guess) - if you don't define a texture for it, the skin current in use becomes confident and the filename falls back to the default. Having a texture named "button-focus.png" is a convention/agreement for skins (there are much others). This is very useful for scripts: They magically match the current in use skin's look.

That initial coords are beeing ignored (and espacially that explicit set via .setWidth does work) sounds like a bug for me, you should report it on trac.
My GitHub. My Add-ons:
Image
Reply
#7
Okay, I'll report the bug. Thanks, sphere.

As far as the docs, I am interested in helping making them better with info like the assumptions about the textures being present, current bugs and workarounds, and more examples, both conceptual and working. For example, I'm finding it's easier for me to pop a transparent xbmcgui.WindowDialog that contains just the edit /submit controls (and no images or labels) so that my skinning can still be generally done with regular xml files, rather than making whole windows with lots of controls from scratch in python. I'd be happy to share snippets like that with everyone.

I just got an account to edit the wiki so I'll spend some time there when I get a chance.

-Jerimiah
Reply
#8
let me create some pages tomorrow where we can put those
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#9
Bug here:

http://trac.xbmc.org/ticket/14606
Reply

Logout Mark Read Team Forum Stats Members Help
xbmcgui.ControlEdit0