views:

44

answers:

1

I have the following piece of code that works great in all but one instance.

private void tbxLastName_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
    GetRemainingChars(sender);
}

public void GetRemainingChars(object sender)
{
    var control = sender as TextEdit;
    var maxChars = control.Properties.MaxLength;
    tipCharacterCounter.Show(control.Text.Length + "/" + maxChars, this, control.Location.X, control.Location.Y - control.Height);
}

I just repeat this process from any textbox. Unfortunately, I have one control that is more complicated and I cannot get this to work. The Event portion looks like this -->

private void memDirectionsToAddress_Popup(object sender, EventArgs e)
{
    MemoExPopupForm popupForm = (sender as DevExpress.Utils.Win.IPopupControl).PopupWindow as MemoExPopupForm;
    MemoEdit meDirections = popupForm.Controls[2] as MemoEdit;
    meDirections.EditValueChanging += new DevExpress.XtraEditors.Controls.ChangingEventHandler(meDirections_EditValueChanging);
}

void meDirections_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
    GetRemainingChars(sender);
}

What I don't understand is if I replace the tipCharacterCounter portion with, say updating a label, it works fine. It's like the ToolTip is hidden or something but I have tried feeding Show() different points to no avail.

Ideas?

+1  A: 

Hi,

Which version of DXPerience are you using? I've tried the following code using DXperience 10.1.5 and it works fine here:

private void memoExEdit1_Popup(object sender, EventArgs e) {
    MemoExPopupForm popupForm = (sender as DevExpress.Utils.Win.IPopupControl).PopupWindow as MemoExPopupForm;
    MemoEdit meDirections = popupForm.Controls[2] as MemoEdit;
    meDirections.EditValueChanging += new DevExpress.XtraEditors.Controls.ChangingEventHandler(meDirections_EditValueChanging);
}

void meDirections_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) {
    GetRemainingChars(sender);
}

public void GetRemainingChars(object sender) {
    TextEdit control = sender as TextEdit;
    int maxChars = control.Properties.MaxLength;
    tipCharacterCounter.ShowHint(control.Text.Length + "/" + maxChars, control, ToolTipLocation.RightBottom);
}
DevExpress Team
10.1.4 I was using Windows ToolTip instead of DevEx's. Not sure why but it works fine with DevEx's. Thanks.
Refracted Paladin