dwaltosz

Hiding a radio button when another one ispushed

3 posts in this topic

#1 ·  Posted (edited)

i have been racking my brain for weeks on how to achieve this can anyone help i am creating an installer and need 7 radio buttons to hid and 4 to show up when i press the WiFi radio button any help is much appreciated this in my subGUI3() function and my subsubGUI() function

#RequireAdmin
#include <WinAPIFiles.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
#include <StaticConstants.au3>

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
 EndFunc

Global $hGuiMain = GUICreate("Driver loader", 500, 200)
GUISetBkColor(0xCC0000)
GUICtrlCreateTab(10, 10, 485, 185)
Global $BT1 = GUICtrlCreateButton("Exit", 400, 150, 60)

GUICtrlCreateTabItem("HP 450G1")
Global $chb1 = GUICtrlCreateRadio("LAN", 30, 35)
Global $chb2 = GUICtrlCreateRadio("WiFi", 30, 55)
Global $chb3 = GUICtrlCreateRadio("Chipset", 30, 75)
Global $chb8 = GUICtrlCreateRadio("Media Card", 30, 95)
Global $chb4 = GUICtrlCreateRadio("Video", 140, 35)
Global $chb5 = GUICtrlCreateRadio("Rapid Storage Technology", 140, 55)
Global $chb6 = GUICtrlCreateRadio("3D DriveGuard", 140, 75)
Global $chb7 = GUICtrlCreateRadio("USB3", 140, 95)


GUICtrlCreateTabItem("HP 450G2")
Global $chb9 = GUICtrlCreateRadio("LAN", 30, 35)
Global $chb10 = GUICtrlCreateRadio("WiFi", 30, 55)
Global $chb11 = GUICtrlCreateRadio("Chipset", 30, 75)
;~ Global $chb12 = GUICtrlCreateRadio("Media Card", 30, 95)
;~ Global $chb13 = GUICtrlCreateRadio("Video", 140, 35)
;~ Global $chb14 = GUICtrlCreateRadio("Rapid Storage Technology", 140, 55)
;~ Global $chb15 = GUICtrlCreateRadio("3D DriveGuard", 140, 75)
;~ Global $chb16 = GUICtrlCreateRadio("USB3", 140, 95)

GUICtrlCreateTabItem("Toshiba")
GUICtrlCreateLabel("Satellite", 30, 35)
Global $chb17 = GUICtrlCreateRadio("C650", 30, 55)
Global $chb18 = GUICtrlCreateRadio("C855", 30, 75)
Global $chb20 = GUICtrlCreateRadio("C8750D", 30, 95)





GUISetState(@sw_show)



While 1
 Switch GUIGetMsg()
   case $chb2
      IF _IsChecked($chb2) Then
         subGUI()
      EndIf
   case $chb1
      IF _IsChecked($chb1) Then
         If  MsgBox(0, "Install", "To Install Nic Driver press OK") = 1 then
               lan()
         EndIf
      EndIf
   Case $BT1
         Exit
   case $chb3
      IF _IsChecked($chb3) Then
         subGUI2()
      EndIf
   Case $chb4
      If _IsChecked($chb4) Then
         video()
      EndIf
   Case $chb8
      If _IsChecked($chb8) Then
         MECA()
      EndIf
   case $chb11
         IF _IsChecked($chb11) Then
            If  MsgBox(0, "Install", "To Install Chipset Driver press OK") = 1 then
                  chip222()
            EndIf
         EndIf
   Case $chb9
         IF _IsChecked($chb9) Then
            If  MsgBox(0, "Install", "To Install LAN Driver press OK") = 1 then
                  lan222()
            EndIf
         EndIf
   Case $chb17
         If _IsChecked($chb17) Then
            subGUI3()
         EndIf
 EndSwitch
WEnd


Func subGUI()
         GUICreate("WiFi", 200, 130)
         GUISetBkColor(0x99CC99)
         Global $wifi1 = GUICtrlCreateRadio("Intel", 30, 30)
         Global $wifi2 = GUICtrlCreateRadio("Qualcomm", 30, 50)
         GUISetState(@sw_show)
            while 1
               Switch GUIGetMsg()
                  $nMsg = GUIGetMsg()

                  Case $GUI_EVENT_CLOSE
                        GUISetState(@sw_hide)
                        Return
                  case $wifi1
                     If _IsChecked($wifi1) Then
                        wifi11()
                     EndIf
                  case $wifi2
                     If _IsChecked($wifi2) Then
                        wifi22()
                     EndIf
               EndSwitch
            WEnd
EndFunc

Func subGUI2()
         GUICreate("Chipset", 200, 200)
         GUISetBkColor(0x99CC99)
         Global $chip1 = GUICtrlCreateRadio("Instalation Utility", 30, 30)
         Global $chip2 = GUICtrlCreateRadio("ME", 30, 50)
         Global $chip3 = GUICtrlCreateRadio("System", 30, 70)
         GUISetState(@sw_show)
            while 1
               Switch GUIGetMsg()
                  $nMsg = GUIGetMsg()

                  Case $GUI_EVENT_CLOSE
                        GUISetState(@sw_hide)
                        Return
                  case $chip1
                     If _IsChecked($chip1) Then
                        chip11()
                     EndIf
                  case $chip2
                     If _IsChecked($chip2) Then
                        chip22()
                     EndIf
                  case $chip3
                     If _IsChecked($chip3) Then
                        chip33()
                     EndIf
               EndSwitch
            WEnd
EndFunc

Func subGUI3()
   $hGuiSecond = GUICreate("C650", 200, 200)
         GUISetBkColor(0x99CC99)
;~       Local $nMsg
         Local $6501 = GUICtrlCreateRadio("LAN", 30, 30)
         Local $6502 = GUICtrlCreateRadio("Chipset", 30, 50)
         Local $6503 = GUICtrlCreateRadio("WiFi", 30, 70)
         Local $6504 = GUICtrlCreateRadio("IMEI", 30, 90)
         Local $6505 = GUICtrlCreateRadio("Rapid Storage", 30, 110)
         Local $6506 = GUICtrlCreateRadio("Video", 30, 130)
         Local $6507 = GUICtrlCreateRadio("Card Reader", 30, 150)
         GUISetState(@sw_show)
         GUICtrlSetState($6501, $GUI_SHOW)
            while 1
               Switch GUIGetMsg()
                  $nMsg = GUIGetMsg()

                  Case $GUI_EVENT_CLOSE
                        GUISetState(@sw_hide)
                        Return
                  Case $6501
                     If _IsChecked($6501) Then
                        Run("O:\Drivers\Toshiba\Satellite - c650\lan\TC50131900E.exe")
                     Else
                        GUICtrlSetState($6501, 32)
                     EndIf
                  Case $6502
                     If _IsChecked($6502) Then
                        Run("O:\Drivers\Toshiba\Satellite - c650\chipset\tc50087300b.exe")
                     ElseIf
                        GUICtrlSetState(-1, $GUI_HIDE)
                     EndIf
                  Case $6503
                     If _IsChecked($6503) Then
                        subsubGUI()
                        GUICtrlSetState($6503, $GUI_HIDE)
                     EndIf

               EndSwitch
            WEnd
EndFunc

Func subsubGUI()
;~    $hGuiThrid = GUICreate("WIFI", 200, 200)
         GUISetBkColor(0x99CC66)
         Global $tosh1 = GUICtrlCreateRadio("Artheros", 30, 30)
         Global $tosh2 = GUICtrlCreateRadio("Brodcom", 30, 50)
         Global $tosh3 = GUICtrlCreateRadio("Intel", 30, 70)
         Global $tosh4 = GUICtrlCreateRadio("Realtek", 30, 90)
         GUISetState(@sw_show)
         GUICtrlSetState($tosh1, $GUI_SHOW)
            while 1
               Switch GUIGetMsg()
                  $nMsg = GUIGetMsg()

                  Case $GUI_EVENT_CLOSE
                        GUISetState(@sw_hide)
                        Return
                  case $tosh1
                     If _IsChecked($tosh1) Then

                        Run("O:\Drivers\Toshiba\Satellite - c650\WiFi\atheros wireless lan\TC00503900A.exe")
                     EndIf
                  case $tosh2
                     If _IsChecked($tosh2) Then
                        Run("O:\Drivers\Toshiba\Satellite - c650\WiFi\Brodcom WiFi\tc50169700b.exe")
                     EndIf
                  case $tosh3
                     If _IsChecked($tosh3) Then
                        RUN("O:\Drivers\Toshiba\Satellite - c650\WiFi\Intel WiFi\tc50177900d.exe")
                     EndIf
                  case $tosh4
                     If _IsChecked($tosh4) Then
                        RUN("O:\Drivers\Toshiba\Satellite - c650\WiFi\Realtek WiFi\tc70207900b.exe")
                     EndIf
               EndSwitch
            WEnd
EndFunc














Func wifi11()
   Run("O:\Drivers\HP\ProBook\450G1\WiFi - Intel\sp69971.exe")
EndFunc

Func wifi22()
   Run("O:\Drivers\HP\ProBook\450G1\WiFi - Qualcomm\sp64676.exe")
EndFunc

Func lan()
   Run("O:\Drivers\HP\ProBook\450G1\Lan\Install_Win7_7092_02252015\setup.exe")
EndFunc
Func chip33()
   Run("O:\Drivers\HP\ProBook\450G1\Chipset - System\Setup.exe")
EndFunc
Func chip22()
   Run("O:\Drivers\HP\ProBook\450G1\Chipset - ME\Setup.exe")
EndFunc
Func chip11()
   Run("O:\Drivers\HP\ProBook\450G1\Chipset - Instalation Utility\Setup.exe")
EndFunc
Func video()
   Run("O:\Drivers\HP\ProBook\450G1\Video\Setup.exe")
EndFunc
Func MECA()
   Run("O:\Drivers\HP\ProBook\450G1\Media Card\setup.exe")
EndFunc
Func chip222()
   Run("O:\Drivers\HP\ProBook\450 g2\SetupChipset.exe")
EndFunc
Func lan222()
   Run("O:\Drivers\HP\ProBook\450 g2\sp69971.exe")
EndFunc
Edited by dwaltosz

Share this post


Link to post
Share on other sites



dwaltosz,

I would resize the GUI and show the radios which had been hidden when the GUI was created - something like this:

#include <WinAPIFiles.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
#include <StaticConstants.au3>

Opt("GUIResizeMode", $GUI_DOCKTOP)

Global $hGuiMain = GUICreate("Driver loader", 500, 200)
GUISetBkColor(0xCC0000)
GUICtrlCreateTab(10, 10, 485, 185)
Global $BT1 = GUICtrlCreateButton("Exit", 400, 150, 60)

GUICtrlCreateTabItem("HP 450G1")
Global $chb1 = GUICtrlCreateRadio("LAN", 30, 35)
Global $chb2 = GUICtrlCreateRadio("WiFi", 30, 55)
Global $chb3 = GUICtrlCreateRadio("Chipset", 30, 75)
Global $chb8 = GUICtrlCreateRadio("Media Card", 30, 95)
Global $chb4 = GUICtrlCreateRadio("Video", 140, 35)
Global $chb5 = GUICtrlCreateRadio("Rapid Storage Technology", 140, 55)
Global $chb6 = GUICtrlCreateRadio("3D DriveGuard", 140, 75)
Global $chb7 = GUICtrlCreateRadio("USB3", 140, 95)


GUICtrlCreateTabItem("HP 450G2")
Global $chb9 = GUICtrlCreateRadio("LAN", 30, 35)
Global $chb10 = GUICtrlCreateRadio("WiFi", 30, 55)
Global $chb11 = GUICtrlCreateRadio("Chipset", 30, 75)

GUICtrlCreateTabItem("Toshiba")
GUICtrlCreateLabel("Satellite", 30, 35)
Global $chb17 = GUICtrlCreateRadio("C650", 30, 55)
Global $chb18 = GUICtrlCreateRadio("C855", 30, 75)
Global $chb20 = GUICtrlCreateRadio("C8750D", 30, 95)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $chb2
            If _IsChecked($chb2) Then
                subGUI()
            EndIf
        Case $chb1
            If _IsChecked($chb1) Then
                If MsgBox(0, "Install", "To Install Nic Driver press OK") = 1 Then
                    lan()
                EndIf
            EndIf
        Case $BT1
            Exit
        Case $chb3
            If _IsChecked($chb3) Then
                subGUI2()
            EndIf
        Case $chb4
            If _IsChecked($chb4) Then
                video()
            EndIf
        Case $chb8
            If _IsChecked($chb8) Then
                MECA()
            EndIf
        Case $chb11
            If _IsChecked($chb11) Then
                If MsgBox(0, "Install", "To Install Chipset Driver press OK") = 1 Then
                    chip222()
                EndIf
            EndIf
        Case $chb9
            If _IsChecked($chb9) Then
                If MsgBox(0, "Install", "To Install LAN Driver press OK") = 1 Then
                    lan222()
                EndIf
            EndIf
        Case $chb17
            If _IsChecked($chb17) Then
                subGUI3()
            EndIf
    EndSwitch
WEnd

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

Func subGUI()
    GUICreate("WiFi", 200, 130)
    GUISetBkColor(0x99CC99)
    Global $wifi1 = GUICtrlCreateRadio("Intel", 30, 30)
    Global $wifi2 = GUICtrlCreateRadio("Qualcomm", 30, 50)
    GUISetState(@SW_SHOW)
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUISetState(@SW_HIDE)
                Return
            Case $wifi1
                If _IsChecked($wifi1) Then
                    wifi11()
                EndIf
            Case $wifi2
                If _IsChecked($wifi2) Then
                    wifi22()
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>subGUI

Func subGUI2()
    GUICreate("Chipset", 200, 200)
    GUISetBkColor(0x99CC99)
    Global $chip1 = GUICtrlCreateRadio("Instalation Utility", 30, 30)
    Global $chip2 = GUICtrlCreateRadio("ME", 30, 50)
    Global $chip3 = GUICtrlCreateRadio("System", 30, 70)
    GUISetState(@SW_SHOW)
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUISetState(@SW_HIDE)
                Return
            Case $chip1
                If _IsChecked($chip1) Then
                    chip11()
                EndIf
            Case $chip2
                If _IsChecked($chip2) Then
                    chip22()
                EndIf
            Case $chip3
                If _IsChecked($chip3) Then
                    chip33()
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>subGUI2

Func subGUI3()
    $hGuiSecond = GUICreate("C650", 200, 200)
    GUISetBkColor(0x99CC99)
;~       Local $nMsg
    Local $6501 = GUICtrlCreateRadio("LAN", 30, 30)
    Local $6502 = GUICtrlCreateRadio("Chipset", 30, 50)
    Local $6503 = GUICtrlCreateRadio("WiFi", 30, 70)
    Local $6504 = GUICtrlCreateRadio("IMEI", 30, 90)
    Local $6505 = GUICtrlCreateRadio("Rapid Storage", 30, 110)
    Local $6506 = GUICtrlCreateRadio("Video", 30, 130)
    Local $6507 = GUICtrlCreateRadio("Card Reader", 30, 150)

    Global $tosh1 = GUICtrlCreateRadio("Artheros", 30, 190)
    GUICtrlSetState($tosh1, $GUI_HIDE)
    Global $tosh2 = GUICtrlCreateRadio("Brodcom", 30,210)
    GUICtrlSetState($tosh2, $GUI_HIDE)
    Global $tosh3 = GUICtrlCreateRadio("Intel", 30, 230)
    GUICtrlSetState($tosh3, $GUI_HIDE)
    Global $tosh4 = GUICtrlCreateRadio("Realtek", 30, 250)
    GUICtrlSetState($tosh4, $GUI_HIDE)

    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUIDelete($hGuiSecond)
                Return
            Case $6501
                If _IsChecked($6501) Then
                    Run("O:\Drivers\Toshiba\Satellite - c650\lan\TC50131900E.exe")
                Else
                    GUICtrlSetState($6501, 32)
                EndIf
            Case $6502
                If _IsChecked($6502) Then
                    Run("O:\Drivers\Toshiba\Satellite - c650\chipset\tc50087300b.exe")
                Else
                    GUICtrlSetState(-1, $GUI_HIDE)
                EndIf
            Case $6503
                If _IsChecked($6503) Then
                    WinMove($hGuiSecond, "", Default, Default, Default, 320)
                    GUICtrlSetState($6503, $GUI_DISABLE)
                    GUICtrlSetState($tosh1, $GUI_SHOW)
                    GUICtrlSetState($tosh2, $GUI_SHOW)
                    GUICtrlSetState($tosh3, $GUI_SHOW)
                    GUICtrlSetState($tosh4, $GUI_SHOW)
                EndIf
            Case $tosh1
                If _IsChecked($tosh1) Then
                    Run("O:\Drivers\Toshiba\Satellite - c650\WiFi\atheros wireless lan\TC00503900A.exe")
                EndIf
            Case $tosh2
                If _IsChecked($tosh2) Then
                    Run("O:\Drivers\Toshiba\Satellite - c650\WiFi\Brodcom WiFi\tc50169700b.exe")
                EndIf
            Case $tosh3
                If _IsChecked($tosh3) Then
                    Run("O:\Drivers\Toshiba\Satellite - c650\WiFi\Intel WiFi\tc50177900d.exe")
                EndIf
            Case $tosh4
                If _IsChecked($tosh4) Then
                    Run("O:\Drivers\Toshiba\Satellite - c650\WiFi\Realtek WiFi\tc70207900b.exe")
                EndIf

        EndSwitch
    WEnd
EndFunc   ;==>subGUI3

Func wifi11()
    Run("O:\Drivers\HP\ProBook\450G1\WiFi - Intel\sp69971.exe")
EndFunc   ;==>wifi11

Func wifi22()
    Run("O:\Drivers\HP\ProBook\450G1\WiFi - Qualcomm\sp64676.exe")
EndFunc   ;==>wifi22

Func lan()
    Run("O:\Drivers\HP\ProBook\450G1\Lan\Install_Win7_7092_02252015\setup.exe")
EndFunc   ;==>lan
Func chip33()
    Run("O:\Drivers\HP\ProBook\450G1\Chipset - System\Setup.exe")
EndFunc   ;==>chip33
Func chip22()
    Run("O:\Drivers\HP\ProBook\450G1\Chipset - ME\Setup.exe")
EndFunc   ;==>chip22
Func chip11()
    Run("O:\Drivers\HP\ProBook\450G1\Chipset - Instalation Utility\Setup.exe")
EndFunc   ;==>chip11
Func video()
    Run("O:\Drivers\HP\ProBook\450G1\Video\Setup.exe")
EndFunc   ;==>video
Func MECA()
    Run("O:\Drivers\HP\ProBook\450G1\Media Card\setup.exe")
EndFunc   ;==>MECA
Func chip222()
    Run("O:\Drivers\HP\ProBook\450 g2\SetupChipset.exe")
EndFunc   ;==>chip222
Func lan222()
    Run("O:\Drivers\HP\ProBook\450 g2\sp69971.exe")
EndFunc   ;==>lan222
Note the Opt statement at the top of the script to prevent the existing radios from moving when the GUI is resized - try it without that line and see the difference.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

i will give that a try thanks and get back to you 

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