PDA

View Full Version : DataGrid changes the ComboBox font colour


Ninna76
07-19-2008, 01:04 PM
i created 2 compiled clips: for a combobox and for a datagrid

there're a few problems though - i'd appreciate any hints, suggestions, or solutions:

1.
the combo has 2 font colours and 2 background colours: in a collapsed state the background is navy blue with sky blue text and the list is the reverse
when i place the combobox instance on stage, all works fine, but when i add a datagrid (it's enough to add it to the library), the font colour in the collapsed combobox changes, so that i get navy blue text on navy blue background
Q: what is responsible for this change and how can it be fixed?

2.
the highlight of the selected row begins 1 pixel to the right
Q: where can i set the position of this highlight (to move it 1 pixel left)?

3.
the position of the header in the datagrid, as well as of the text in the 1st column seems to be moved a few pixels to the left, so that (a) there's a space between the header and the frame in the upper right corner, (b) the text in the 1st column is positioned closer to the left than of the remaining two columns
Q: is it possible to move the header and the text of the 1st column to the right?

and the last question: is it possible to centre the text of the header but not of the columns in the datagrid?

regards
Ninna

Ninna76
07-19-2008, 03:41 PM
well, deleting & recompiling the clips seems to have solved the 1st problem :)

Ninna76
07-20-2008, 01:49 AM
ok, i also managed to centre the headers - it turned out to be fairly simple:import mx.styles.CSSStyleDeclaration;
var headerStyles = new CSSStyleDeclaration();
headerStyles.setStyle("textAlign", "center");
Scores_dg.setStyle("headerStyle", headerStyles);
... but the 2 & 3 still escape me :(
i manipulated various bits of code i have for rectborder (http://www.actionscript.org/forums/showthread.php3?t=177027) - blindly, in hope of finding out what i need to change to get the desired result - well that gets me nowhere

the pic shows the results of setting of changing RectBorder.as to:
private var borderWidths:Object = { none: 0, solid: 5, inset: 0, outset: 0, alert: 0, dropDown: 0, menuBorder: 0, comboNonEdit: 0 };
...
function init(Void):Void {
borderWidths["default"] = 5;
super.init();
...
if (getStyle(borderStyleName) == "default" || getStyle(borderStyleName) == "alert") {
__borderMetrics = { left: 0, top: 0, right: 0, bottom: 0 };
return __borderMetrics;
but i have no idea how i arrive at 1 pixel to the right, and 3 & 5 pixels down, respectively; and i don't have the border around the header anymore :(
am i changing the right file? if so, could someone please help me get the values right?

Ninna76
07-20-2008, 12:21 PM
i returned to my original values, which gave me my border back, as well as the extra pixel (vertically) and the extra 2 pixels (horizontally) between the items in the list and the border of the ScrollSelectList; and a 2 pixel gap between the header and the border on the right-hand side
however, i found the thread by elspif (http://www.actionscript.org/forums/showthread.php3?t=56646&highlight=pixel+thorn), which helped me solve almost all of the remaining issues:

1. the list (the code in the mx.controls.listclasses.ScrollSelectList class):
function layoutContent(x : Number,y:Number,w:Number,h:Number) : Void
{
// trace("ScrollSelectList.layoutContent - x:" + x + " y:" + y + " w:" + w + " h:" + h );
delete invLayoutContent;
x = x-1;
y = y-3;
...
2. the header (the code in the mx.controls.DataGrid class):
function layoutContent(x:Number,y:Number,tW:Number,tH:Numbe r,dW:Number,dH:Number) : Void
{
var r = __rowCount;
if (__showHeaders) {
y+=__headerHeight;
dH-=__headerHeight;
dW = dW+2;
}
...
there still remains the problem of the 1st column in the DataGrid being 5 pixels to the left in comparison with the remaining columns, and i have yet no idea where this can be changed, but i'll keep looking :)