Access ADX Form from CommandBar Events

Add-in Express™ Support Service
That's what is more important than anything else

Access ADX Form from CommandBar Events
Need work-around for null ADXOlFormsManager.CurrentForm 
Ralph Smith




Posts: 45
Joined: 2006-06-19
Hello,

I have a simple CommandBarButton on an Explorer CommandBar.

When the user clicks this explorer command bar button, it should run a method in the currently displayed ADXOlForm that I made. Simple concept.

The problem is that when I access the CurrentForm property of the ADXFormManager, where the ADXOlExplorerCommandBarButton click event handler is located, that property is always null. And I can't find any other references of the current form in ADXFormManager.

Is there at least a collection of ADXForm references I can access via ADXOlFormsManager? Or any other place for that matter?

Ideally, I want the reference to the current form, but if I can get the collection of all AlOlForms so I can traverse those, that would be a great help as well. Any pointers would be appreciated.

Thanks.
Posted 28 Aug, 2006 13:31:42 Top
Ralph Smith




Posts: 45
Joined: 2006-06-19

During runtime the debugger finds a collection named 'adxOlFormsManager.CachedForms'.

This collection has the form that I am looking for in it, but it is not in the namespace so I can not access it via code. But I can see it in the debugger.

As a 'CurrentForm' workaround, I would like to traverse this collection and find the correct form. Does anyone know of a way to access this collection via some other means?

Thanks
Posted 29 Aug, 2006 14:00:14 Top
David Ing




Posts: 56
Joined: 2006-06-27
Hi Ralph,

I use a reference that I set up manually, although there maybe a better ADX way too. I bet Sergey has a code sample already.

I keep a reference, say called myCurrentADXForm and then set it up on the ADXBeforeFormShow event of the new form, i.e.


public ADXForm1() // The constructor
{
  InitializeComponent();

  this.ADXBeforeFormShow +=new AddinExpress.OL.ADXOlForm.BeforeFormShow_EventHandler(ADXOlQuickTag_ADXBeforeFormShow);
}

private void ADXOlQuickTag_ADXBeforeFormShow()
{
  AddinModule a = (AddinModule)AddinModule;

  a.MyMainCoreClassGuy.myCurrentADXForm = this;
}	


I hope that makes some sense, as obviously it's a real short explanation.
Posted 30 Aug, 2006 07:06:07 Top
Ralph Smith




Posts: 45
Joined: 2006-06-19
Thank you! Thank you! Thank you!!! :)

I've been stuck for the last 4 days on an already late project. Your workaround worked perfectly.

Ah, I just might make it through one more day in this place... :)
Posted 30 Aug, 2006 12:28:58 Top