Announcement

Collapse
No announcement yet.

Tabcontrol

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tabcontrol

    Stupid me but...

    How *should* i create controls 'upon' tabpages?

    Not how i could but how i should.
    I assume the controls remain on the window and not on the tabcontrol?

    Thanks,
    hellobasic

  • #2
    As i can see here it does not create controls inside the tab:



    So far i always used a child window.
    hellobasic

    Comment


    • #3
      I think you are supposed to use %WM_NOTIFY messages to tell you which tab is active then arrange the controls to suit.

      Comment


      • #4
        I think so too.
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          >...then arrange the controls to suit.

          Yes but the controls parents remain on the window and not the tabcontrol.
          And just move them into sight (z-order etc)
          That was my point for confirmation..
          hellobasic

          Comment


          • #6
            I usually just show the active tab, and ensure all other tabs (borderless dialogs acting as a control) are hidden.
            Adam Drake
            PowerBASIC

            Comment


            • #7
              Edwin,

              You must have lost your mind? Let me see if I can help you out...
              And tomorrow, I want you to visit your doctor, becasue I'm very concerned now.

              Tab control... (parented by your main window/dialog)
              Child window 1, parented by your window/dialog, not the tab control
              Child window 2, ditto
              Child window 3, ditto

              All the controls are on child window/dialog, you have no choice. The Tab ctl sends notifications to your main window/dialog, you take action, show/hide child window/dialogs.
              ...this part I know you underdstand well enough!

              The bounding area of the tab control, below the actual tabs is not a window, it is only painted on the main window/dialog to tramatize you.... this is the part that confuses many.

              And I was only kidding about losing your mind and seeing a doctor...

              HTH
              Regards,
              Jules

              Comment


              • #8
                Thanks Jules (..and from my other 13 voices )

                I do the same for years but i thought this was the easiest (but i may have looked that up in those days and came to same conclusion but hey.. that was all before the previous weekend.. hips!)

                I believe some programmers actually create controls upon the tab control
                hellobasic

                Comment


                • #9
                  Indeed Tab control (like menu bar items) are nothing else than buttons (i mean kind of), and it is up to you to take the appropriate action to show/hide the child controls belonging to the same group. But of course easier to have a container as the parent of the child controls, then just hide/show the parent instead of each of the individual child.
                  Last edited by Patrice Terrier; 1 Mar 2008, 05:06 PM.
                  Patrice Terrier
                  www.zapsolution.com
                  www.objreader.com
                  Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

                  Comment


                  • #10
                    I just do CreateWindowEx to create a screen with the required controls, and make that 'hwnd' a child of the main screen. The tab control is as Patrice says, something the user can click on to tell me which set of controls he wants to see right now.

                    MCM
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      >I do the same for years but i thought this was the easiest<

                      Probably from the VB days, ...you can place controls right on the TABs at design time.
                      This is why I made QTAB for PB, putting the visual back into visual design.

                      When you think about it, it does make logical sense that to have your controls grouped together in a child container, just imagine if you had 10 controls per tab and 5 tabs--lots of individual Ctl_show & hide, also, makes it nice to have individual callbacks...

                      IMHO
                      Regards,
                      Jules

                      Comment


                      • #12
                        The controls MUST be on a child dialog if you are using themes, otherwise the frame and label, and possibly other controls' colors will be off (grey on white when using XP's 'Luna' theme). On a child dialog that has EnableThemeDialogTexture applied, the control colors are correctly blended with the tab control background.
                        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

                        Comment


                        • #13
                          No worries, what i meant was that i already created te controls outside the tab area (on a childwindow) and just make it visible and put it on front on demand.
                          hellobasic

                          Comment


                          • #14
                            In using PB Forms and the Tab Control, I first place the controls for tab 0, test and then move them to wm_initdialog, repeating the same for each tab. Any controls needing to stay on the tab regardless of which tab is clicked I leave in the area dialog new/dialog show modal. Initially I create all fields in wm_initdialog including and sublcass code and immediatley %SW_HIDE anything not on the first tab.

                            In WM_NOTIFY on a tabhit I hide what shouldn't be there for that tab and show what should be. The TCN_SELCHANGE and TCN_SELCHANGING can be used to remove the current fields with %SW_HIDE and then the new fields with %SW_SHOW. I don't see why they need to be on a child dialog unless you want the callbacks segregated into one dialog call back per tab. Seems like more work to me.

                            The gradient stuff and resizing stuff make the tab control really a nice way to handle a lot of fields.

                            If controls are created with a consecutive range of control ids per tab, it's pretty simple to hide whole screens with 2 or 3 lines of code.

                            BOB MECHLER
                            Last edited by BOB MECHLER; 8 Mar 2008, 12:35 PM. Reason: TYPO

                            Comment


                            • #15
                              >I don't see why they need to be on a child dialog

                              Because it's a lot easier to maintain the keyboard navigation (tabstop order) if each set of controls are children of their own window?
                              Michael Mattias
                              Tal Systems (retired)
                              Port Washington WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #16
                                Hidden controls can't get the focus during tabbing.

                                Comment


                                • #17
                                  [Withdrawn]
                                  Last edited by BOB MECHLER; 10 Mar 2008, 07:25 PM. Reason: Faulty reasoning.

                                  Comment

                                  Working...
                                  X