Announcement

Collapse
No announcement yet.

%WS_GROUP (or grouping Controls)

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

  • %WS_GROUP (or grouping Controls)

    If I read correctly
    %WS_GROUP
    Define the start of a group of controls. The first control in each group should also use %WS_TABSTOP style. The next %WS_GROUP control in the tab order defines the end of this group and the start of a new group.
    Fine and good, but how do I end a group without starting a new group???
    Or do I have to hold off any option buttons till last??? (or aka, do they have to be the highest values for my equates to work?

    I tend to like to layout my Dialogs/Windows/Forms from the top down left right, and to me ending a group should end, not start a new group till I say to do a new group.

    Is ther a Api equivelent that works me around this problem???
    Engineer's Motto: If it aint broke take it apart and fix it

    "If at 1st you don't succeed... call it version 1.0"

    "Half of Programming is coding"....."The other 90% is DEBUGGING"

    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

  • #2
    Starting a new group will not hurt anything even if you don't use it. Just use one %WS_GROUP on the next item to end the group and then use another %WS_GROUP when you are ready to start the group you want.

    Can you show code that explains why it would hurt to have an extra unused group?
    "I haven't lost my mind... its backed up on tape... I think??" :D

    Comment


    • #3
      I suppose I could, but quicker to describe
      I had a group of 4 radio buttons (have to group so only one can be chosen) and then either create a 5th (and hide it to ungroup) or if my ungroup is on my next control (which is a combobox), It makes my combobox a part of the group (which it is NOT part of the group, just telling PB that I no longer need a group.
      Engineer's Motto: If it aint broke take it apart and fix it

      "If at 1st you don't succeed... call it version 1.0"

      "Half of Programming is coding"....."The other 90% is DEBUGGING"

      "Document my code????" .... "WHYYY??? do you think they call it CODE? "

      Comment


      • #4
        Don't think of the WS_GROUP style as being some kind of 'attribute' of a control, like WS_BORDER or WS_VISIBLE; the WS_GROUP style does not do anything specific to the control at all.

        Think of it as a "start of group marker" and it becomes a lot easier to understand.

        If a control does NOT have WS_GROUP style, it's NOT the start of a new group, so it must be part of the current group... the group which started on the last control (in the tab order) which DID have the WS_GROUP style.

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

        Comment


        • #5
          FWIW, you can use the WS_GROUP style to navigate the screen just as with the WS_TABSTOP style.

          See doc for the Windows API functions GetNextDlgTabItem() and GetNextDlgGroupItem for details.
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            A lot easier than remembering all this stuff if you ask me...

            Set up a couple of equates in your 'master' program template ....

            Code:
             
            %STYLE_OPTION_FIRST = %WS_CHILD OR %WS_VISIBLE OR %BS_AUTORADIOBUTTON _ 
                       OR %WS_TABSTOP OR %WS_GROUP
            %STYLE_OPTION_OTHER = %WS_CHILD OR %WS_VISIBLE OR %BS_AUTORADIOBUTTON
            ... and code your option button groups using those equates...

            Code:
            CONTROL ADD OPTION  hdlg, %ID_1, "Option 1", x, y, cx, cy, %STYLE_OPTION_FIRST 
            CONTROL ADD OPTION  hdlg, %ID_2, "Option 2", x, y, cx, cy, %STYLE_OPTION_OTHER 
            CONTROL ADD OPTION  hdlg, %ID_3, "Option 3", x, y, cx, cy, %STYLE_OPTION_OTHER 
            OR 
            hCtrl = CreateWindowEx (Exstyle, "Button", "Option 1", %STYLE_OPTION_FIRST, _
                    x, y,cx, cy, hDlg, %ID_1,hInst, lparam) 
            
            hCtrl = CreateWindowEx (Exstyle, "Button", "Option 2", %STYLE_OPTION_OTHER, _
                    x, y,cx, cy, hDlg, %ID_2,hInst, lparam) 
            
            hCtrl = CreateWindowEx (Exstyle, "Button", "Option 3", %STYLE_OPTION_OTHER, _
                    x, y,cx, cy, hDlg, %ID_3,hInst, lparam) 
            
            ...

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

            Comment


            • #7
              I think a group is often used to make a goup of radiobuttons and therefore only one WS_GROUP is set.
              While this works for the selecting process it does not for the arrowkeys.
              If you create a group of radiobuttons have the first rb and the next control not belonging to the group have this style so arrowkeys will work as intended.
              hellobasic

              Comment

              Working...
              X