Posts: 928
Joined: Feb 2004
Reputation:
0
Asteron
"Skilled" Python Coder
Posts: 928
im pretty sure the width and height must be specified in the constructor and any text you put in it will be either truncated or won't fill up the area.
Posts: 901
Joined: Feb 2005
Reputation:
3
yes. what i meant was that i'm trying to calculate the button width according to the text length about to be used for the label.
i've now used the fontattr class (from this forum) which works.
would be nice if we had a built in func to calc string length based on font used.
cheers anyway.
Posts: 928
Joined: Feb 2004
Reputation:
0
Asteron
"Skilled" Python Coder
Posts: 928
ohh ok... well the xbmc python api is very limited right now and there are lots of things needing adding..
like changing the color of text to a label after you create it...
or interfacing with the picture slideshow...
i really need to get a copy of vc++ 2003 so i can get into this code...
Posts: 174
Joined: Mar 2004
Reputation:
0
madtw
Senior Member
Posts: 174
xbmc patch 1166891 may help with what is being discussed here. i exposed the remaining parameters to the cguilabelcontrol class (amongst other things). this means that you can pass the left, right, center y, center x, and truncate alignment flags. if truncate is passed, it will only render the label within the defined label width. if the label text is too large, xbmc renders as much as it can minus room for "...".
when i first started doing python scripting for xbmc, i went down the road of calculating character pixel widths but as soon as you start supporting skins, it gets messy. fonts come with different character widths... also, skinners may change fonts depending on resolution. it is just better to let xbmc calculate what it can and cannot display.
the patch also exposes those parameters for button controls... but the guilib doesn't support truncation of button labels yet. i may add in support later - for now the work around is to use a button control (if you need a button) and then slap a label control on top with the truncate option. of course you'll need to wait until my patch is accepted into cvs...
Posts: 901
Joined: Feb 2005
Reputation:
3
thanks for the putting the time into helping out, exposing more parameters is very welcome.
it would be good if we could actually specify a font on buttons and other controls ie. controllist etc
i have a grip with controllist navigation, don't know if someone can help out, but;
there doesn't seem to be a way to navigate right off onto another control (button label whatever) as focus moves to the page up/down and stops there.
would it not be better to either a) have the ability to move right from the paging controls onto your specified control or b) have the option to not display the paging info at all.
i raise this as, if you put several controllists next to each other horizontally on the screen, it doesn't make sense to the user to have to press left to get to the next list on it right.
did i make sense there?
Posts: 174
Joined: Mar 2004
Reputation:
0
madtw
Senior Member
Posts: 174
you can specify a font on controlbuttons (11th parameter) and controllists (5th parameter)... you might need patch 1166891 to get the functionality for the controlbutton but the list font parameter has been there for a while.
there is a parameter to the c++ version of the list to not display the paging control. it is not yet exposed to python. however, you might be able to call getspincontrol() to get the spinner from the list and then set the right navigation control for that control. i haven't tried that but it seems logical. if that works then it would result in:
list -> page up/down control (spinner) -> list 2 -> page up/down...
Posts: 26,215
Joined: Oct 2003
Reputation:
187
it appears that the default right action from the spin control is not mapped, so it basically just returns to the list control in this case.
i'll see what i can fix up on the list control side (because it should go to the <onright> control of the listcontrol).
cheers,
jonathan
Posts: 901
Joined: Feb 2005
Reputation:
3
11th and 7th parameters !? my xbmcgui html doc (dated cvs build 19.mars) must be well out of date?
i have nowhere near as many parameters exposed in that doc.
cheers anyway.
nav on lists: thanks, that definitly would improve the user experience. personnaly i'd prefer it to have the option to skip over the page controls too ... ?
Posts: 363
Joined: Jun 2004
Reputation:
0
updated the docs now.more parameteres in there.
Posts: 901
Joined: Feb 2005
Reputation:
3
am i being thick, but the link to xbmcgui.html on thor918 still show these prototypes;
controlbutton(int x, int y, int width, int height[, label, focus, nofocus])
and
controllist(int x, int y, int width, int height[, buttontexture, buttonfocustexture])
so i see no 11th and 7th parameters, relating to font?
please explain if i've completly misunderstood about the documentation.
thanks
Posts: 901
Joined: Feb 2005
Reputation:
3
really sorry. my fault. it was a browser refresh cache thing.
cheers for looking