Sign in to follow this  
Followers 0
atomman

Koda possible bug v1.7.0.3b - GUICtrlCreateGroup

3 posts in this topic

When you create a group with Koda, for whatever reason it creates 2 groups -- one you can see and one you can't. In the example below, the group i created should not be visible ($GUI_HIDE), but it is because Koda stuck the flag after the group it created (GUICtrlCreateGroup("", -99, -99, 1, 1)), so that is the one that is hidden.

Do these empty groups have a reason to exist?

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 226, 56, 299, 138)
$Group1 = GUICtrlCreateGroup("group control should be hidden", 6, 6, 209, 43)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

GUICtrlCreateGroup() does two things 1 a visual box surrounding items within a group and 2 it groups things like radio boxes.

to have a group without this visual box you would use GUIStartGroup()

there can be many groups on one gui, thus, since KODA is "automated" and does not know how many groups you are going to create, so, it automatically "ends" the last group with GUICtrlCreateGroup("", -99, -99, 1, 1)

if you only have one group, this is not needed

per help...

#include <GUIconstants.au3>

Opt("GUICoordMode", 1)

GUICreate("Radio Box Grouping Demo", 400,280)

; Create the controls
$button_1 = GUICtrlCreateButton ("B&utton 1", 30, 20, 120, 40)
$group_1 = [color="#ffffff"]GUICtrlCreateGroup[/color] ("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)

; Set the defaults (radio buttons  clicked, default button, etc)
GUICtrlSetState($radio_1, $GUI_CHECKED)
GUICtrlSetState($radio_6, $GUI_CHECKED)
GUICtrlSetState($button_1, $GUI_FOCUS + $GUI_DEFBUTTON)

; Init our vars that we will use to keep  track of radio events
$radioval1  = 0    ; We will assume 0 =  first radio button selected, 2 = last button
$radioval2 = 2

GUISetState ()

; In this message loop we use variables  to keep track of changes to the radios, another
; way  would be to use GUICtrlRead() at the end to read in the state of each control.   Both
; methods are equally valid
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         Exit
         
      Case $msg = $button_1
         MsgBox(0,  "Button",  "Radio " & $radioval1 & @LF & "Radio " & Chr($radioval2 + Asc("A")) & @LF & GUICtrlRead($input_1) & @LF & GUICtrlRead($input_2))
         
      Case $msg = $radio_1 OR $msg = $radio_2 OR $msg = $radio_3
         $radioval1  = $msg - $radio_1
         
      Case $msg = $radio_4 OR $msg = $radio_5 OR $msg = $radio_6
         $radioval2  = $msg - $radio_4

   EndSelect
WEnd

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

ah HAAA!

that ends that mystery. thanks!

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  
Followers 0