CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2000
    Location
    Colorado, United States
    Posts
    12

    Focus with Panel

    I have a user control derived from Panel where we do all of the painting and handling of mouse etc.

    What I set the control as a tab stop with a valid tab index, but when I tab with the keyboard through the controls on the form, it never goes to my control.

    I know panel is supposed to pass focus to the control it contains, but there are no contain controls, the panel is the control. We used panel bacuase of the boarder styles.

    When I put a break point in the initilzation of the conmtrol and call CanFocus the value returned is false. Is there a way to tell the panel, to recieve focus.

    Incedently, clicking on the control and calling Focus in the mouse down event works fine.

  2. #2
    Join Date
    Jan 2000
    Location
    Colorado, United States
    Posts
    12

    Figured it out.

    If you set the style using

    this.SetStyle(ControlStyles.Selectable, true);

    then it works.

  3. #3
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    ya, working with mouse events and all GUI stuff - debuging is a pain
    so what u do instead is write to a log file and test that way so u have correct event generated and correct log file

    paresh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured