Sign in to follow this  
Followers 0
sathish

GROUP ENABLE DISABLE USING RADIO BUTTONS

11 posts in this topic

HERE IS MY CODE

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("REF-PREDITING", 915, 646, 192, 30)
$Group1 = GUICtrlCreateGroup("REF-TYPE", 30, 32, 263, 457)
$Radio1 = GUICtrlCreateRadio("Journal", 38, 56, 233, 30)
$Radio2 = GUICtrlCreateRadio("Book", 40, 88, 233, 33)
$Radio3 = GUICtrlCreateRadio("Proceedings", 40, 120, 233, 41)
$Radio8 = GUICtrlCreateRadio("Thesis", 40, 160, 233, 33)
$Radio9 = GUICtrlCreateRadio("Paper", 40, 200, 233, 25)
$Radio10 = GUICtrlCreateRadio("Radio10", 40, 232, 233, 33)
$Radio11 = GUICtrlCreateRadio("Radio11", 40, 272, 233, 33)
$Radio12 = GUICtrlCreateRadio("Radio12", 40, 312, 233, 33)
$Radio13 = GUICtrlCreateRadio("Radio13", 40, 352, 233, 25)
$Radio14 = GUICtrlCreateRadio("Radio14", 40, 400, 233, 25)
$Radio15 = GUICtrlCreateRadio("Radio15", 40, 432, 233, 41)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetState(-1, $GUI_DISABLE)
$Group2 = GUICtrlCreateGroup("REF-STYLE", 448, 32, 468, 345)
$Radio4 = GUICtrlCreateRadio("AU | YEAR | ART | JRT | VOL | ISSUE | PAGERANGE", 464, 64, 529, 25)
$Radio5 = GUICtrlCreateRadio("AU | ART | JRT | VOL | ISSUE | PAGERANGE |  YEAR", 464, 112, 521, 25)
$Radio6 = GUICtrlCreateRadio("Radio6", 464, 160, 529, 33)
$Radio7 = GUICtrlCreateRadio("Radio7", 464, 216, 529, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("RUN", 632, 488, 97, 49, 0)
$Button2 = GUICtrlCreateButton("CANCEL", 768, 488, 105, 49, 0)
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



WHAT IS YOUR QUESTION?

And: What have you already tried?


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I have created a group (REF-TYPE)

Inside that group i have created radio buttons namely (Journal, Book, Thesis, Proceedings, etc)

My need is when i click radio1 (Journal), a new group should appear as group 2 with some radios (AU | YEAR | ART | JRT | VOL | ISSUE | PAGERANGE, etc)

Same way, different kinds of group should appear for each and every radio button from group1

Here i will include the screenshot

Edited by sathish

Share this post


Link to post
Share on other sites

Here with I have attached the screenshot

Please suggestpost-69004-0-68491100-1334831511_thumb.j

Share this post


Link to post
Share on other sites

Func _hideGroup2()
    GUICtrlSetState($Group2, $GUI_HIDE)
    GUICtrlSetState($Radio4, $GUI_HIDE)
    GUICtrlSetState($Radio5, $GUI_HIDE)
    GUICtrlSetState($Radio6, $GUI_HIDE)
    GUICtrlSetState($Radio7, $GUI_HIDE)
EndFunc

Func _showGroup2()
    GUICtrlSetState($Group2, $GUI_SHOW)
    GUICtrlSetState($Radio4, $GUI_SHOW)
    GUICtrlSetState($Radio5, $GUI_SHOW)
    GUICtrlSetState($Radio6, $GUI_SHOW)
    GUICtrlSetState($Radio7, $GUI_SHOW)

EndFunc

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("REF-PREDITING", 915, 646, 192, 30)
$Group1 = GUICtrlCreateGroup("REF-TYPE", 30, 32, 263, 457)
$Radio1 = GUICtrlCreateRadio("Journal", 38, 56, 233, 30)
$Radio2 = GUICtrlCreateRadio("Book", 40, 88, 233, 33)
$Radio3 = GUICtrlCreateRadio("Proceedings", 40, 120, 233, 41)
$Radio8 = GUICtrlCreateRadio("Thesis", 40, 160, 233, 33)
$Radio9 = GUICtrlCreateRadio("Paper", 40, 200, 233, 25)
$Radio10 = GUICtrlCreateRadio("Radio10", 40, 232, 233, 33)
$Radio11 = GUICtrlCreateRadio("Radio11", 40, 272, 233, 33)
$Radio12 = GUICtrlCreateRadio("Radio12", 40, 312, 233, 33)
$Radio13 = GUICtrlCreateRadio("Radio13", 40, 352, 233, 25)
$Radio14 = GUICtrlCreateRadio("Radio14", 40, 400, 233, 25)
$Radio15 = GUICtrlCreateRadio("Radio15", 40, 432, 233, 41)
$Group2 = GUICtrlCreateGroup("REF-STYLE", 448, 32, 468, 345)
$Radio4 = GUICtrlCreateRadio("AU | YEAR | ART | JRT | VOL | ISSUE | PAGERANGE", 464, 64, 529, 25)
$Radio5 = GUICtrlCreateRadio("AU | ART | JRT | VOL | ISSUE | PAGERANGE |  YEAR", 464, 112, 521, 25)
$Radio6 = GUICtrlCreateRadio("Radio6", 464, 160, 529, 33)
$Radio7 = GUICtrlCreateRadio("Radio7", 464, 216, 529, 25)

_hideGroup2()

GUISetState(@SW_SHOW)
$b_Radio1 = False
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Radio1
            $b_Radio1 = True
            _showGroup2()
    EndSwitch
    If $b_Radio1 Then
        If GUICtrlRead($Radio1) <> 1 Then
            _hideGroup2()
            $b_Radio1 = False
        EndIf
    EndIf
WEnd


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

Please check the screen shots

Radio1 - If radio1 is selected Journal Group should appear

Radio2 - If radio 2 is selected Book Group should appear

post-69004-0-86033700-1334831949_thumb.j

post-69004-0-20672400-1334832025_thumb.j

Share this post


Link to post
Share on other sites

Func _hideGroup2()
    GUICtrlSetState($Group2, $GUI_HIDE)
    GUICtrlSetState($Radio4, $GUI_HIDE)
    GUICtrlSetState($Radio5, $GUI_HIDE)
    GUICtrlSetState($Radio6, $GUI_HIDE)
    GUICtrlSetState($Radio7, $GUI_HIDE)
EndFunc

Func _showGroup2()
    GUICtrlSetState($Group2, $GUI_SHOW)
    GUICtrlSetState($Radio4, $GUI_SHOW)
    GUICtrlSetState($Radio5, $GUI_SHOW)
    GUICtrlSetState($Radio6, $GUI_SHOW)
    GUICtrlSetState($Radio7, $GUI_SHOW)

EndFunc

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("REF-PREDITING", 915, 646, 192, 30)
$Group1 = GUICtrlCreateGroup("REF-TYPE", 30, 32, 263, 457)
$Radio1 = GUICtrlCreateRadio("Journal", 38, 56, 233, 30)
$Radio2 = GUICtrlCreateRadio("Book", 40, 88, 233, 33)
$Radio3 = GUICtrlCreateRadio("Proceedings", 40, 120, 233, 41)
$Radio8 = GUICtrlCreateRadio("Thesis", 40, 160, 233, 33)
$Radio9 = GUICtrlCreateRadio("Paper", 40, 200, 233, 25)
$Radio10 = GUICtrlCreateRadio("Radio10", 40, 232, 233, 33)
$Radio11 = GUICtrlCreateRadio("Radio11", 40, 272, 233, 33)
$Radio12 = GUICtrlCreateRadio("Radio12", 40, 312, 233, 33)
$Radio13 = GUICtrlCreateRadio("Radio13", 40, 352, 233, 25)
$Radio14 = GUICtrlCreateRadio("Radio14", 40, 400, 233, 25)
$Radio15 = GUICtrlCreateRadio("Radio15", 40, 432, 233, 41)
$Group2 = GUICtrlCreateGroup("REF-STYLE", 448, 32, 468, 345)
$Radio4 = GUICtrlCreateRadio("AU | YEAR | ART | JRT | VOL | ISSUE | PAGERANGE", 464, 64, 529, 25)
$Radio5 = GUICtrlCreateRadio("AU | ART | JRT | VOL | ISSUE | PAGERANGE |  YEAR", 464, 112, 521, 25)
$Radio6 = GUICtrlCreateRadio("Radio6", 464, 160, 529, 33)
$Radio7 = GUICtrlCreateRadio("Radio7", 464, 216, 529, 25)

_hideGroup2()

GUISetState(@SW_SHOW)
$b_Radio1 = False
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Radio1
            $b_Radio1 = True
            _showGroup2()
    EndSwitch
    If $b_Radio1 Then
        If GUICtrlRead($Radio1) <> 1 Then
            _hideGroup2()
            $b_Radio1 = False
        EndIf
    EndIf
WEnd

Thank you very much

It works fine,

Thanks a lot hannes08

Share this post


Link to post
Share on other sites

Still having some problem

Cant able to show the group for other Radios from group1

My coding may be wrong, kindly help me

Func _hideGroup3()
    GUICtrlSetState($Group3, $GUI_HIDE)
    GUICtrlSetState($Radio14, $GUI_HIDE)
    GUICtrlSetState($Radio15, $GUI_HIDE)
    GUICtrlSetState($Radio16, $GUI_HIDE)
    GUICtrlSetState($Radio17, $GUI_HIDE)
EndFunc

Func _hideGroup2()
    GUICtrlSetState($Group2, $GUI_HIDE)
    GUICtrlSetState($Radio4, $GUI_HIDE)
    GUICtrlSetState($Radio5, $GUI_HIDE)
    GUICtrlSetState($Radio6, $GUI_HIDE)
    GUICtrlSetState($Radio7, $GUI_HIDE)
EndFunc


Func _showGroup2()
    GUICtrlSetState($Group2, $GUI_SHOW)
    GUICtrlSetState($Radio4, $GUI_SHOW)
    GUICtrlSetState($Radio5, $GUI_SHOW)
    GUICtrlSetState($Radio6, $GUI_SHOW)
    GUICtrlSetState($Radio7, $GUI_SHOW)

EndFunc

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("REF-PREDITING", 915, 646, 192, 30)
$Group1 = GUICtrlCreateGroup("REF-TYPE", 30, 32, 263, 457)
$Radio1 = GUICtrlCreateRadio("Journal", 38, 56, 233, 30)
$Radio2 = GUICtrlCreateRadio("Book", 40, 88, 233, 33)
$Radio3 = GUICtrlCreateRadio("Proceedings", 40, 120, 233, 41)
$Radio8 = GUICtrlCreateRadio("Thesis", 40, 160, 233, 33)
$Radio9 = GUICtrlCreateRadio("Paper", 40, 200, 233, 25)
$Radio10 = GUICtrlCreateRadio("Radio10", 40, 232, 233, 33)
$Radio11 = GUICtrlCreateRadio("Radio11", 40, 272, 233, 33)
$Radio12 = GUICtrlCreateRadio("Radio12", 40, 312, 233, 33)
$Radio13 = GUICtrlCreateRadio("Radio13", 40, 352, 233, 25)
$Radio14 = GUICtrlCreateRadio("Radio14", 40, 400, 233, 25)
$Radio15 = GUICtrlCreateRadio("Radio15", 40, 432, 233, 41)
$Group2 = GUICtrlCreateGroup("REF-STYLE", 448, 32, 468, 345)
$Radio4 = GUICtrlCreateRadio("AU | YEAR | ART | JRT | VOL | ISSUE | PAGERANGE", 464, 64, 529, 25)
$Radio5 = GUICtrlCreateRadio("AU | ART | JRT | VOL | ISSUE | PAGERANGE |  YEAR", 464, 112, 521, 25)
$Radio6 = GUICtrlCreateRadio("Radio6", 464, 160, 529, 33)
$Radio7 = GUICtrlCreateRadio("Radio7", 464, 216, 529, 25)



$Group3 = GUICtrlCreateGroup("REF-STYLE", 448, 32, 468, 345)
$Radio14 = GUICtrlCreateRadio("AU | YEAR | ART | JRT | VOL | ISSUE | PAGERANGE", 464, 64, 529, 25)
$Radio15 = GUICtrlCreateRadio("AU | ART | JRT | VOL | ISSUE | PAGERANGE |  YEAR", 464, 112, 521, 25)
$Radio16 = GUICtrlCreateRadio("Radio6", 464, 160, 529, 33)
$Radio17 = GUICtrlCreateRadio("Radio7", 464, 216, 529, 25)

_hideGroup2()
_hideGroup3()


GUISetState(@SW_SHOW)
$b_Radio1 = False
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Radio1
            $b_Radio1 = True
            _showGroup2()
    EndSwitch
    If $b_Radio1 Then
        If GUICtrlRead($Radio1) <> 1 Then
            _hideGroup2()
            $b_Radio1 = False
        EndIf
    EndIf
WEnd

Share this post


Link to post
Share on other sites

How to add groups for other radio buttons from Group 1 (REF-TYPE)???

Share this post


Link to post
Share on other sites

Do you want to show the Radiobuttons if any of the RB in group 1 is set?

If yes, you'll need to adjust the Switch ... EndSwitch statement accordingly.

If you need to show a different group each time, you need to add _showGroupX and _hideGroupX functions as well as an adjusted Switch ... EndSwitch statement.


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

Func _hideGroup2()
    GUICtrlSetState($Group2, $GUI_HIDE)
    GUICtrlSetState($Radio21, $GUI_HIDE)
    GUICtrlSetState($Radio22, $GUI_HIDE)
    GUICtrlSetState($Radio23, $GUI_HIDE)
    GUICtrlSetState($Radio24, $GUI_HIDE)
EndFunc

Func _showGroup2()
    GUICtrlSetState($Group2, $GUI_SHOW)
    GUICtrlSetState($Radio21, $GUI_SHOW)
    GUICtrlSetState($Radio22, $GUI_SHOW)
    GUICtrlSetState($Radio23, $GUI_SHOW)
    GUICtrlSetState($Radio24, $GUI_SHOW)
EndFunc

Func _hideGroup3()
    GUICtrlSetState($Group3, $GUI_HIDE)
    GUICtrlSetState($Radio31, $GUI_HIDE)
    GUICtrlSetState($Radio32, $GUI_HIDE)
    GUICtrlSetState($Radio33, $GUI_HIDE)
    GUICtrlSetState($Radio34, $GUI_HIDE)
EndFunc

Func _showGroup3()
    GUICtrlSetState($Group3, $GUI_SHOW)
    GUICtrlSetState($Radio31, $GUI_SHOW)
    GUICtrlSetState($Radio32, $GUI_SHOW)
    GUICtrlSetState($Radio33, $GUI_SHOW)
    GUICtrlSetState($Radio34, $GUI_SHOW)
EndFunc

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("REF-PREDITING", 915, 646, 192, 30)
$Group1 = GUICtrlCreateGroup("REF-TYPE", 30, 32, 263, 457)
$Radio1 = GUICtrlCreateRadio("Journal", 38, 56, 233, 30)
$Radio2 = GUICtrlCreateRadio("Book", 40, 88, 233, 33)
$Radio3 = GUICtrlCreateRadio("Proceedings", 40, 120, 233, 41)
$Radio8 = GUICtrlCreateRadio("Thesis", 40, 160, 233, 33)
$Radio9 = GUICtrlCreateRadio("Paper", 40, 200, 233, 25)
$Radio10 = GUICtrlCreateRadio("Radio10", 40, 232, 233, 33)
$Radio11 = GUICtrlCreateRadio("Radio11", 40, 272, 233, 33)
$Radio12 = GUICtrlCreateRadio("Radio12", 40, 312, 233, 33)
$Radio13 = GUICtrlCreateRadio("Radio13", 40, 352, 233, 25)
$Radio14 = GUICtrlCreateRadio("Radio14", 40, 400, 233, 25)
$Radio15 = GUICtrlCreateRadio("Radio15", 40, 432, 233, 41)

$Group2 = GUICtrlCreateGroup("2REF-STYLE", 448, 32, 468, 345)
$Radio21 = GUICtrlCreateRadio("2AU | YEAR | ART | JRT | VOL | ISSUE | PAGERANGE", 464, 64, 529, 25)
$Radio22 = GUICtrlCreateRadio("2AU | ART | JRT | VOL | ISSUE | PAGERANGE |  YEAR", 464, 112, 521, 25)
$Radio23 = GUICtrlCreateRadio("2Radio6", 464, 160, 529, 33)
$Radio24 = GUICtrlCreateRadio("2Radio7", 464, 216, 529, 25)

$Group3 = GUICtrlCreateGroup("3REF-STYLE", 448, 32, 468, 345)
$Radio31 = GUICtrlCreateRadio("3AU | YEAR | ART | JRT | VOL | ISSUE | PAGERANGE", 464, 64, 529, 25)
$Radio32 = GUICtrlCreateRadio("3AU | ART | JRT | VOL | ISSUE | PAGERANGE |  YEAR", 464, 112, 521, 25)
$Radio33 = GUICtrlCreateRadio("3Radio6", 464, 160, 529, 33)
$Radio34 = GUICtrlCreateRadio("3Radio7", 464, 216, 529, 25)

_hideGroup2()
_hideGroup3()

GUISetState(@SW_SHOW)

$b_Radio1 = False
$b_Radio2 = False

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Radio1
            $b_Radio1 = True
            _showGroup2()
        Case $Radio2
            $b_Radio2 = True
            _showGroup3()
    EndSwitch
    If $b_Radio1 Then
        If GUICtrlRead($Radio1) <> 1 Then
            _hideGroup2()
            $b_Radio1 = False
        EndIf
    EndIf
    If $b_Radio2 Then
        If GUICtrlRead($Radio2) <> 1 Then
            _hideGroup3()
            $b_Radio2 = False
        EndIf
    EndIf
WEnd


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

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