Hello !
I would like to add a new button in the "Selection" menu in the "Attribute table" panel. Do you know if it is possible ?
If it's not possible, I would like to add a new button in the context menu when a user right clic on a row. I found how to do this (with the daml), but I don't know how to get the current selected row (in the "Attribute Table") via the code. How can I do that ?
Thanks you for your answer 🙂
Solved! Go to Solution.
Hello,
It is not possible to add your custom button to the Attribute pane toolbar. However, you can add a custom button to the table context menu as you discovered by modifying the daml definition for that menu.
Within your button you can look at the ITablePane object - there is a few properties on this interface although it is limited. For example you should be able to do the following within your button to obtain the field value of the currently selected row
protected override async void OnClick()
{
var pane = FrameworkApplication.ActiveWindow as Pane;
if (pane is ITablePane tablePane)
{
var column = tablePane.ActiveColumn;
var oid = tablePane.ActiveObjectID;
var mm = tablePane.MapMember;
if ((column != null) && (mm != null) && oid.HasValue)
{
await QueuedTask.Run(() =>
{
var insp = new Inspector(false);
insp.Load(mm, oid.Value);
var shape = insp.Shape;
var attribute = insp[column.Name].ToString();
//var attribute = insp["fieldName"].ToString();
});
}
}
}
Hope this helps.
Narelle
Hello,
It is not possible to add your custom button to the Attribute pane toolbar. However, you can add a custom button to the table context menu as you discovered by modifying the daml definition for that menu.
Within your button you can look at the ITablePane object - there is a few properties on this interface although it is limited. For example you should be able to do the following within your button to obtain the field value of the currently selected row
protected override async void OnClick()
{
var pane = FrameworkApplication.ActiveWindow as Pane;
if (pane is ITablePane tablePane)
{
var column = tablePane.ActiveColumn;
var oid = tablePane.ActiveObjectID;
var mm = tablePane.MapMember;
if ((column != null) && (mm != null) && oid.HasValue)
{
await QueuedTask.Run(() =>
{
var insp = new Inspector(false);
insp.Load(mm, oid.Value);
var shape = insp.Shape;
var attribute = insp[column.Name].ToString();
//var attribute = insp["fieldName"].ToString();
});
}
}
}
Hope this helps.
Narelle
Hello !
Thank you for you answer ! I tried and it is exactly what I wanted to do 🙂
Thank you !