开发者

touch screen clear status message on any touch

Iam working on a touch screen windows form that has many checkboxes, textboxes, listboxes, date dropdown pickers etc. Depending on user action a status message is displayed at the bottom. For eg., Your profile saved successfully, From and to date cannot be same, Please select a valid ... etc

What is an elegant way to clear the status message on ANY touch.

if (statusLabel.text != string.empty )
    statusLabel.t开发者_如何学Pythonext = string.empty)  

Meaning if any checkbox is checked, any text is input in a textbox, any listbox or combo is selected...then I want to clear the status label. This way the last status message does not "stick" to confuse the user. I am poking around to see if I can override some event at the form level in one place that will do this.

thanks


thx Saravanan and Pedery for your suggestions. They do not solve my problem. I just discovered Reactive extensions and posting a related question which may help me. Left mouse button click detect on winform using Reactive extensions IObservable on events


  1. Try to find an event in the statusbar itself like text changed or content changed etc. Override it to clear the content of itself.

  2. You may write code to clear the status bar content on the change event of the control's container.

Its your choice.


You can put the message in the controls' Tag property and use a single common event to add them all up.

If you wanna be more orderly, you can subclass the checkbox with a custom property the same way.


This was the solution to my problem

protected override void WndProc(ref Message msg)
{
    switch(msg.Msg)
    {
        case WM_LBUTTONDOWN:
        //Do something here
             break;
        //add other cases if needed

    }

    // call the base class WndProc for default message handling
    base.WndProc(ref msg);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜