Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. tabcontrol

tabcontrol

Scheduled Pinned Locked Moved C#
csharpc++helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    brain2cpu
    wrote on last edited by
    #1

    I have to port a MFC app to .NET. The main window is dialog with a big tabcontrol and many tab pages. In C++ every tab page was a dialog, so it has a default push button, in C# only the main form has an accept button. How could I "press" different buttons depending on the active tab page on Enter pressed? The only way I could see is to handle the key(up|down) event, verify if it is Enter (how?) and do something further, but must be something easier :) The other problem: I want to set the focus on one tab page component when the page is shown, and keep the current focus no matter how the pages are changed (I mean when switch back). The control.Focus() in the Load method does not work, when should I call Focus? Thanks

    N 1 Reply Last reply
    0
    • B brain2cpu

      I have to port a MFC app to .NET. The main window is dialog with a big tabcontrol and many tab pages. In C++ every tab page was a dialog, so it has a default push button, in C# only the main form has an accept button. How could I "press" different buttons depending on the active tab page on Enter pressed? The only way I could see is to handle the key(up|down) event, verify if it is Enter (how?) and do something further, but must be something easier :) The other problem: I want to set the focus on one tab page component when the page is shown, and keep the current focus no matter how the pages are changed (I mean when switch back). The control.Focus() in the Load method does not work, when should I call Focus? Thanks

      N Offline
      N Offline
      NetPointerIN
      wrote on last edited by
      #2

      First problem: What I have done is, I have put a button "OK" or "Apply" on a form, not on a Tabcontrol but just below the tabcontrol. and made it the acccept button. :( i was checking that what is the selected control on the tab thru my program. but i had only 2 tabs and was easy to track down.

      B 1 Reply Last reply
      0
      • N NetPointerIN

        First problem: What I have done is, I have put a button "OK" or "Apply" on a form, not on a Tabcontrol but just below the tabcontrol. and made it the acccept button. :( i was checking that what is the selected control on the tab thru my program. but i had only 2 tabs and was easy to track down.

        B Offline
        B Offline
        brain2cpu
        wrote on last edited by
        #3

        I end up with something similar: I put an accept button on the main form and "hide" it (size 1x1, flat, *color = main background) and this "invisible" button will route the Enter according to the active tab page. I can not use a single, normal button for all pages because the actions are quite different (enter, delete, view, load, ...) so the button's name would be a real problem. This thing works but MUST be some other way :confused:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups