Jump to content
Sign in to follow this  
stev379

Why close a group?

Recommended Posts

Why is

GUICtrlCreateGroup ("",-99,-99,1,1)

needed to close a group? I have suspicions why, but would like to know a concrete reason to be sure I'm not wrong.

What can go wrong if you have 2 groups in a gui, (1 above the other, both have input fields and only one has radio buttons), if the groups aren't closed?

Share this post


Link to post
Share on other sites

Why is

GUICtrlCreateGroup ("",-99,-99,1,1)

needed to close a group?  I have suspicions why, but would like to know a concrete reason to be sure I'm not wrong.

What can go wrong if you have 2 groups in a gui, (1 above the other, both have input fields and only one has radio buttons), if the groups aren't closed?

<{POST_SNAPBACK}>

From the helpfile...:

A group control is the thin line you see around controls (usually only Radio button) that visually groups them together. Only one Radio button within a Group can be selected at once.

If you want to have multiple groups without the visible line then you must use GUIStartGroup() to group your Radio buttons.

Share this post


Link to post
Share on other sites

From the helpfile...:

<{POST_SNAPBACK}>

@josbe

I think you mis-understood. The help file for GUICtrlCreateGroup has a line in the example that says:

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

I too am curious about this.


Phillip

Share this post


Link to post
Share on other sites

<{POST_SNAPBACK}>

@josbe

I think you mis-understood. The help file for GUICtrlCreateGroup has a line in the example that says:

GUICtrlCreateGroup ("",-99,-99,1,1);close group

I too am curious about this.

<{POST_SNAPBACK}>

Right, doesn't the creation of the group signify where it's boundries are? If GUICtrlCreateGroup ("",-99,-99,1,1) is needed to close the group so that radio buttons in another group in the same gui can function properly, so be it. But that would merely be a reason why the group needs to be closed. Not an explanation for what GUICtrlCreateGroup ("",-99,-99,1,1) actually does to close the group and again...of course why doesn't the creation of the group when its boundaries are set function as opening and closing?
Edited by stev379

Share this post


Link to post
Share on other sites

True, this example from the Au help file uses GUICtrlCreateGroup to create the group and GUIStartGroup() to group different groups of radio buttons together and doesn't close the group. So again, we're left to ask why close the group if in this example there is no need to? Why would you close group with this code "GUICtrlCreateGroup ("",-99,-99,1,1);close group", when you could just group the radio buttons by using GUIStartGroup()??

$group_1 = GUICtrlCreateGroup ("Group 1", 30, 90, 165, 160)

GUIStartGroup()

$radio_1 = GUICtrlCreateRadio ("Radio &0", 50, 120, 70, 20)

$radio_2 = GUICtrlCreateRadio ("Radio &1", 50, 150, 60, 20)

$radio_3 = GUICtrlCreateRadio ("Radio &2", 50, 180, 60, 20)

GUIStartGroup()

$radio_4 = GUICtrlCreateRadio ("Radio &A", 120, 120, 70, 20)

$radio_5 = GUICtrlCreateRadio ("Radio &B", 120, 150, 60, 20)

$radio_6 = GUICtrlCreateRadio ("Radio &C", 120, 180, 60, 20)

GUIStartGroup()

$input_1 = GUICtrlCreateInput ("Input 1", 200, 20, 160, 30)

$input_2 = GUICtrlCreateInput ("Input 2", 200, 70, 160, 30)

Share this post


Link to post
Share on other sites

I guess no one knows the answer to the question of what is the purpose of GUICtrlCreateGroup ("",-99,-99,1,1). It's looking more and more, to me, to be a documentation bug. The GUI's I have tried, with and without including this so called group closer, have worked just as well with it or without it.

Perhaps it was necessary originally, but no longer, and the documentation needs to be revised? Do any of the gurus, with ratings of < 3 out of 10, know the answer?


Phillip

Share this post


Link to post
Share on other sites

Do any of the gurus, with ratings of < 3 out of 10, know the answer?

<{POST_SNAPBACK}>

Try this script with and without the GUICtrlCreateGroup ("",-99,-99,1,1) ;close group....

With: you can select 1 or 2 and 3 or 4

without: you can only select 1 or 2 or 3 or 4

:lmao:

#include <GUIConstants.au3>

GUICreate("My GUI group") ; will create a dialog box that when displayed is centered

GUICtrlCreateGroup ("Group 1", 90, 60, 90, 140)
$radio_1 = GUICtrlCreateRadio ("Radio 1", 110, 90, 60, 20)
$radio_2 = GUICtrlCreateRadio ("Radio 2", 110, 110, 60, 50)
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

$radio_3 = GUICtrlCreateRadio ("Radio 3", 110, 210, 60, 20)
$radio_4 = GUICtrlCreateRadio ("Radio 4", 110, 230, 60, 50)

GUISetState ()    ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Yep, Jon created GUICtrlCreateGroup('', -99, -99, 1, 1) for a reason.

Same with GUICtrlCreateTabItem('')

These items need to be closed, before other commence.

Share this post


Link to post
Share on other sites

@JdeB

Thank you very much. I played with your example for a while, a can now see a reason to close a group. That being, once a group has been started, it must be closed if there are controls that follow and you do not want to surround them with a border, and want them to react separately from the previous group. If the second group is to be surrounded with a border, there is no need to close the previous group (evidently starting a new group closes the previous group).

@MHz

Thank you also.


Phillip

Share this post


Link to post
Share on other sites

That is what I figured it was for. The question now would be...am I misunderstanding the help file (which I think is outstanding BTW :lmao: ) or does GUIStartGroup not accomplish the same task? I just want to be sure I'm not missing something that may prove valuable in future scripts.

This is the remark from the help file about GUIStartGroup:

This function is generally used when working with radio button controls. When you click a radio button all other radio buttons in the same grouping are reset. The GUIStartGroup function allows you to easily define these groups.

Edited by stev379

Share this post


Link to post
Share on other sites

We can argue a close group was needed or not.

At the begining when I design GUI there was not GuiStartGroup so the following script seems logical to the close the group to have radio button outside.

GuiCreate("test")
$group_1 = GUICtrlCreateGroup ("Group 1", 30, 90, 100, 160)
$radio_1 = GUICtrlCreateRadio ("Radio &0", 50, 120, 70, 20)
$radio_2 = GUICtrlCreateRadio ("Radio &1", 50, 150, 60, 20)
$radio_3 = GUICtrlCreateRadio ("Radio &2", 50, 180, 60, 20)
GUICtrlCreateGroup ("", -99, 99, 1, 1)
$radio_4 = GUICtrlCreateRadio ("Radio &A", 150, 120, 70, 20)
$radio_5 = GUICtrlCreateRadio ("Radio &B", 150, 150, 60, 20)
$input_1 = GUICtrlCreateInput ("Input 1", 200, 20, 160, 30)
$input_2 = GUICtrlCreateInput ("Input 2", 200, 70, 160, 30) 
GUISetState()
Do
    $msg = GuiGetMsg()
Until $msg= $GUI_EVENT_CLOSE

Now it looks redundant but it is there, use the way you prefer to structure your grouping :lmao:

Share this post


Link to post
Share on other sites

At the begining when I design GUI there was not GuiStartGroup so the following script seems logical to the close the group to have radio button outside.

<{POST_SNAPBACK}>

Thanks jpm.

Phillip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...