kaban
Topic Author
Posts: 17
Joined: 22 Sep 2013, 09:35

Unhandled exception when attempting to access grid definitio

26 Sep 2013, 18:00

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...
 
User avatar
sfernandez
Site Admin
Posts: 3154
Joined: 22 Dec 2011, 19:20

Re: Unhandled exception when attempting to access grid defin

26 Sep 2013, 20:35

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?
 
User avatar
jsantos
Site Admin
Posts: 4123
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unhandled exception when attempting to access grid defin

27 Sep 2013, 17:30

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
 
kaban
Topic Author
Posts: 17
Joined: 22 Sep 2013, 09:35

Re: Unhandled exception when attempting to access grid defin

27 Sep 2013, 19:29

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!
 
User avatar
sfernandez
Site Admin
Posts: 3154
Joined: 22 Dec 2011, 19:20

Re: Unhandled exception when attempting to access grid defin

05 Oct 2013, 17:45

Ok, we will close this thread.

Who is online

Users browsing this forum: Bing [Bot] and 2 guests