Unhandled exception when attempting to access grid definitio
What's happening:
Collections.cs line 62 while being called from:
Where grid has 2 column definitions defined in xaml like so:
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...
The exact line of code invoking it:[ 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>
Code: Select all
IntPtr cPtr = NoesisGUI_PINVOKE.Collection_Get(swigCPtr, index);
Code: Select all
Grid g = root.FindName<Grid>("MyGrid");
print(g.GetColumnDefinitions().Get((uint)1));
Code: Select all
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="1"/>
</Grid.ColumnDefinitions>
My goal is to be able to modify a grid column width in code...
-
sfernandez
Site Admin
- Posts: 3154
- Joined:
Re: Unhandled exception when attempting to access grid defin
I tried this xaml:
And the following script in Unity:
I get no errors with the previous example.
Could you please provide the exact xaml and code that is failing?
Code: Select all
<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>
Code: Select all
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");
}
}
}
Could you please provide the exact xaml and code that is failing?
Re: Unhandled exception when attempting to access grid defin
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
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
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!
Sorry about the mistake!
-
sfernandez
Site Admin
- Posts: 3154
- Joined:
Re: Unhandled exception when attempting to access grid defin
Ok, we will close this thread.
Who is online
Users browsing this forum: Bing [Bot] and 2 guests