Page 1 of 1

Unhandled exception when attempting to access grid definitio

Posted: 26 Sep 2013, 18:00
by kaban
What's happening:
[ 0] [0x1e221259] Noesis.dll!<Unknown function>
[ 1] [0x1e434ec4] Noesis.dll!<Unknown function>
[ 2] [0x0cd34f2c] <Unknown module>!<Unknown function>
[ 3] [0x09d59232] mono.dll!<Unknown function>
[ 4] [0x09e600b2] mono.dll!<Unknown function>
[ 5] [0x09d51d3d] mono.dll!<Unknown function>
The exact line of code invoking it:
IntPtr cPtr = NoesisGUI_PINVOKE.Collection_Get(swigCPtr, index);
Collections.cs line 62 while being called from:
Grid g = root.FindName<Grid>("MyGrid");
print(g.GetColumnDefinitions().Get((uint)1));
Where grid has 2 column definitions defined in xaml like so:
<Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="1"/>
    </Grid.ColumnDefinitions>
I've tried a few variations and all are causing problems.

My goal is to be able to modify a grid column width in code...

Re: Unhandled exception when attempting to access grid defin

Posted: 26 Sep 2013, 20:35
by sfernandez
I tried this xaml:
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="100"/>
    </Grid.ColumnDefinitions>
    
</Grid>
And the following script in Unity:
public class GridTest : MonoBehaviour
{
    void Start ()
    {
        NoesisGUIPanel gui = GetComponent<NoesisGUIPanel>();
        Grid root = gui.GetRoot<Grid>();

        ColumnDefinitionCollection columns = root.GetColumnDefinitions();
        if (columns != null)
        {
            uint numColumns = columns.Count();
            Debug.Log(System.String.Format("Num columns = {0}", numColumns));

            for (uint i = 0; i < numColumns; ++i)
            {
                ColumnDefinition col = columns.Get(i).As<ColumnDefinition>();
                GridLength width = col.GetWidth();
                Debug.Log(System.String.Format("Column {0} Width = {1} ({2})",
                    i, width.GetValue(), width.GetGridUnitType().ToString()));
            }
        }
        else
        {
            Debug.Log("Columns is null");
        }
    }
}
I get no errors with the previous example.
Could you please provide the exact xaml and code that is failing?

Re: Unhandled exception when attempting to access grid defin

Posted: 27 Sep 2013, 17:30
by jsantos
Problems with the bugtracker have been fixed.

Could you report this bug please?

Bwt, if you can attach a minidump file with the report, even better.

Thanks

Re: Unhandled exception when attempting to access grid defin

Posted: 27 Sep 2013, 19:29
by kaban
I just found out the problem was not because of Noesis, I was attempting to get grid column definitions on the wrong grid, instead of the root grid which contained the grid column definitions I was trying to get the grid column definitions of one of its child grid columns.

Sorry about the mistake!

Re: Unhandled exception when attempting to access grid defin

Posted: 05 Oct 2013, 17:45
by sfernandez
Ok, we will close this thread.