"Lasse Vågsæther Karlsen" <la***@vkarlsen.nowrote in message
news:Oa**************@TK2MSFTNGP06.phx.gbl...
Bill Fuller wrote:
>I am trying to determine the type for ActiveControls using 3rd party
controls (Infragistics in this case) during runtime and getting a rather
odd return type at runtime for the UltraWinEditor.
Code shippet is as follows:
if ( ActiveControl.GetType() == typeof(UltraTextEditor))
{
UltraTextEditor tb = (UltraTextEditor) this.ActiveControl;
if (tb.Multiline == true)
return true;
}
I am expecting to see an UltraTextEditor for the ActiveControlType but,
instead, getting "Infragistics.Win.EmbeddableTextBoxWithUIPermissio ns",
so the "if" statement fails on the control.
If I modify the "if" statement to: "if
(ActiveControl.GetType().ToString() ==
"Infragistics.Win.EmbeddableTextBoxWithUIPermissi ons")", the subsequent
cast fails.
Does anyone know what would cause the control type to be different at
runtime than what it was built from?
(BTW, the test form is ONLY using UltraTextEditor controls, so the type
should be the same for each.)
I'm going on assumptions here, but judging by the full name of that
control, I'd say you have focus to the editor, but it is actually similar
to a user control and what you're reading there is an embedded editor
inside what dropped on the form.
DevExpresses uses the same approach, with something like a
RepositoryTextEdit, which is then used internally in both grids and normal
droppable edit controls. I don't know if the DevExpress controls would
give me the same behavior as you're seeing though.
In any case, it's just a guess. I guess the best way to get a concrete
answer would be to ask the Infragistics guys about this.
Let me pose another question... What specifically are you trying to
accomplish with the code? Perhaps there's a different way to do what you
want to do than the one you're currently trying.
--
Lasse Vågsæther Karlsen
mailto:la***@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3
It sounds like you are pointing me in the right direction as to the source
of my problem. I did post the question to Infragistics, but need to find an
answer ASAP, if possible, and I have found them to be rather slow in
responding.
What I am trying to do (and it is working for the most part) is set a global
hook via IMessageFilter to convert the ENTER key to a TAB key for the entire
application, which is largely data entry type forms. However, I have also
set a virtual method for this that can be overridden in instances where the
Enter key on a particular form needs to be processed rather than use the
default, such as in the case where a multiline textbox that allows Enter key
handling may be on the form... or perhaps a button key. This code would
process the override if I can get it to work... was taken by surprise with
the type return as a standard Microsoft textbox works as expected.