locked
Windows.Form.UserControl Focus Event RRS feed

  • Question

  • I have a windows mobile app inwhich I have a windows main Form with multiple tabs and on each tab is a Windows.Form.UserControl containing various data fields. I need to detect when a user enters a tab and leaves the tab to enable/disable a data refresh timer.

    I thought by using the _GotFocus and _LostFocus events would enable me to do this but these event never get triggered.

    Looking for some help.

     

    Chuck

     

     


    chuck
    Thursday, September 2, 2010 3:36 PM

Answers

  • Chunsheng,

    It doesn't appear that this tab event is supported under .Net 3.5 CF


    chuck

    .NET CF 3.5 does support that event.


    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by chucksalerno Wednesday, September 8, 2010 1:59 AM
    Tuesday, September 7, 2010 3:15 AM

All replies

  • You can use the TabControl.SelectedIndexChanged event. "SelectedIndex" means the index of the current selected tab page of a TabControl.

    http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.selectedindexchanged(VS.80).aspx


    Please mark the post that helps you, and unmark that does not. This benefits our community.

    Monday, September 6, 2010 7:14 AM
  • Hi,

    Check this link

    http://www.resco.net/developer/support/samples_tabcontrol.aspx


    PS.Shakeer Hussain Hyderabad
    Monday, September 6, 2010 7:28 AM
  • Chunsheng,

    It doesn't appear that this tab event is supported under .Net 3.5 CF


    chuck
    Monday, September 6, 2010 12:47 PM
  • Shakeer,

    I looked at the sample and didn't see anything I could use.

     

    Chuck


    chuck
    Monday, September 6, 2010 1:07 PM
  • Here is a sample of my code

    Declaring the Event Handlers:

     

    private System.EventHandler IssuesTimerGotFocusHandler = null;

     

    private System.EventHandler IssuesTimerLostFocusHandler = null;

     

    I'm setting up the tabs as:

    m_Tabs.Add(tbpLogo.Text, tbpLogo);

    m_Tabs.Add(tbpIssues.Text, tbpIssues);

    m_Tabs.Add(tbpAccess.Text, tbpAccess);

    m_Tabs.Add(tbpComms.Text, tbpComms);

    m_Tabs.Add(tbpShiftLog.Text, tbpShiftLog);

    m_Tabs.Add(tbpIssuesView.Text, tbpIssuesView);

     

    I'm setting up the event like:

     

     

    this.IssuesTimerGotFocusHandler = new EventHandler(IssuesTimer_GotFocusHandler);

     

    this.IssuesTimerLostFocusHandler = new EventHandler(IssuesTimer_LostFocusHandler);

     

    m_Tabs[

    "Issues"].GotFocus += this.IssuesTimerGotFocusHandler;

    m_Tabs[

    "Issues"].LostFocus += this.IssuesTimerLostFocusHandler;

     

    Here is the call from the Event that's not getting called:

     

    void IssuesTimer_GotFocusHandler(object sender, EventArgs e)

    {

              ctrlIssues.timer_IssuesServicesRefresh.Enabled =

    true;

     

    }

     

    void IssuesTimer_LostFocusHandler(object sender, EventArgs e)

    {

              ctrlIssues.timer_IssuesServicesRefresh.Enabled =

    false;

    }

     

     

    Maybe someone can see something I'm not.

     

     


    chuck
    Monday, September 6, 2010 2:10 PM
  • Chunsheng,

    It doesn't appear that this tab event is supported under .Net 3.5 CF


    chuck

    .NET CF 3.5 does support that event.


    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by chucksalerno Wednesday, September 8, 2010 1:59 AM
    Tuesday, September 7, 2010 3:15 AM