Jump to content

GuiRadio, GuiCheckbox


 Share

Recommended Posts

Hey. I want to achieve 2 things with the program. One is that after choosing one of the profiles and acknowleding it with 'Install' button it would do things (so far i only made it to work that when i choose radio button it executes what's there). And another thing is that when i choose profile '6' or after i would add profile number 7 table with 6 checkboxes would apear and after selecting few of those checkboxes i would have to click "install" button to go thru with what it is supposed to do. Hope you guys understand what i mean :P All help will be appreciated.

#NoTrayIcon
$version = 0.1

#include <GUIConstants.au3>

Opt("GUICoordMode", 1)
GUICreate("Installer ver. " & $version, 400,500)

; Create the controls
$button_1 = GUICtrlCreateButton ("Install", 50, 400, 120, 40)
$group_1 = GUICtrlCreateGroup ("Choose Profile:", 40, 90, 165, 220)
GUIStartGroup()
$radio_1 = GUICtrlCreateRadio ("Standardowy &1", 50, 120, 150, 20)
$radio_2 = GUICtrlCreateRadio ("Standardowy Mobilny &2", 50, 150, 150, 20)
$radio_3 = GUICtrlCreateRadio ("Zaawansowany &3", 50, 180, 150, 20)
$radio_4 = GUICtrlCreateRadio ("Zaawansowany Mobilny &4", 50, 210, 150, 20)
$radio_5 = GUICtrlCreateRadio ("Super &5", 50, 240, 150, 20)
$radio_6 = GUICtrlCreateRadio ("Super Mobilny &6", 50, 270, 150, 20)

; Init our vars that we will use to keep track of GUI events
$radioval1 = 0 ; We will assume 0 = first radio button selected, 2 = last button
$radioval2 = 2
;GUICtrlSetState($radio_1, $GUI_CHECKED)
; Show the GUI
GUISetState ()

; In this message loop we use variables to keep track of changes to the radios, another
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
;        MsgBox(0, "", "Dialog was closed") 
         Exit
      Case $msg = $GUI_EVENT_MINIMIZE
;        MsgBox(0,"", "Dialog minimized",2)
      Case $msg = $GUI_EVENT_MAXIMIZE
;        MsgBox(0,"", "Dialog restored",2)
        Case $msg = $radio_1 AND $button_1
         MsgBox(0, "Default button clicked", "Radio gaga" )
      Case $msg = $radio_2 AND $button_1
         MsgBox(0, "Default button clicked", "Radio gugu" )

   EndSelect
WEnd
Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

I played with the code more and i managed to make most things i wanted. But now since i have split the RadioBox to 2 groups i want it so when i choose things in one grp, the other disables itself and vice versa. Same would happen if i select Radio from column one, checkbox options would go away. I don't know what to look for. Also i have problem understanding how the progress bar works. SO would appreciate any help with it.

#NoTrayIcon
$version = 0.1

#include <GUIConstants.au3>

Opt("GUICoordMode", 1)
GUICreate("Installer ver. " & $version, 375,500)
$n=GUICtrlCreatePic("c:\logo.gif",0,0, 375,35)

; Create the controls
$button_1 = GUICtrlCreateButton ("Zainstaluj", 50, 450, 120, 40)
$group_1 = GUICtrlCreateGroup ("Wybierz profil:", 2, 50, 175, 200)
GUIStartGroup()
$radio_1 = GUICtrlCreateRadio ("Standardowy", 5, 70, 150, 20)
$radio_2 = GUICtrlCreateRadio ("Standardowy mobilny", 5, 100, 150, 20)
$radio_3 = GUICtrlCreateRadio ("Zaawansowany", 5, 130, 150, 20)
$radio_4 = GUICtrlCreateRadio ("Zaawansowany mobilny", 5, 160, 150, 20)
$radio_5 = GUICtrlCreateRadio ("Super", 5, 190, 150, 20)
$radio_6 = GUICtrlCreateRadio ("Super mobilny", 5, 220, 150, 20)
; Next group
$group_2 = GUICtrlCreateGroup ("", 200, 50, 175, 35)
$radio_7 = GUICtrlCreateRadio ("Wybór ręczny", 202, 60, 150, 20) 

; Init our vars that we will use to keep track of GUI events
$radioval1 = 0  ; We will assume 0 = first radio button selected, 2 = last button
$radioval2 = 2
;GUICtrlSetState($radio_1, $GUI_CHECKED)
; Show the GUI
GUISetState ()



; In this message loop we use variables to keep track of changes to the radios, another
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
;        MsgBox(0, "", "Dialog was closed") 
         Exit
      Case $msg = $GUI_EVENT_MINIMIZE
;        MsgBox(0,"", "Dialog minimized",2)
      Case $msg = $GUI_EVENT_MAXIMIZE
;        MsgBox(0,"", "Dialog restored",2)
        Case $msg = $button_1 AND $radio_1
         MsgBox(0, "Default button clicked", "Radio 1" )
      Case $msg = $button_1 AND $radio_2
         MsgBox(0, "Default button clicked", "Radio 2" )
        Case $msg = $button_1 AND $radio_3
         MsgBox(0, "Default button clicked", "Radio 3" )
      Case $msg = $button_1 AND $radio_4
         MsgBox(0, "Default button clicked", "Radio 4" )         
        Case $msg = $button_1 AND $radio_5
         MsgBox(0, "Default button clicked", "Radio 5" )
      Case $msg = $button_1 AND $radio_6
         MsgBox(0, "Default button clicked", "Radio 6" )
      Case $msg = $radio_7
         $wybor= GUICtrlCreateTreeView (200,90,175,180,BitOr($TVS_CHECKBOXES,$TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE)
         GuiCtrlCreateTreeViewItem("7 zip", $wybor)
         GuiCtrlCreateTreeViewItem("Adobe Acrobat 7.0", $wybor)
         GuiCtrlCreateTreeViewItem("Cisco VPN 4.7", $wybor)
         GuiCtrlCreateTreeViewItem("Lotus Notes 5.02c", $wybor)
         GuiCtrlCreateTreeViewItem("Lotus Notes 5.10a", $wybor)
         GuiCtrlCreateTreeViewItem("Microsoft Office XP", $wybor)
         GuiCtrlCreateTreeViewItem("Microsoft Office 2003", $wybor)
         GuiCtrlCreateTreeViewItem("Microsoft Project 2003", $wybor)
         GuiCtrlCreateTreeViewItem("Microsoft Visio 2003", $wybor)       
         GuiCtrlCreateTreeViewItem("Symantec Antivirus", $wybor)
   EndSelect
WEnd

$Office2003label = GUICtrlCreateLabel ("TreeView Dem4o",190,90,100,20)
$OfficeXpLabel = GUICtrlCreateLabel ("This little scripts demonstates the using of a treeview-control.",190,70,100,60)

GUISetState ()
While 1
    $msg = GUIGetMsg()
    Select
      Case $msg = $wybor
         GUIChangeItems($Office2003label,$OfficeXpLabel)
    EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart,$hideend,$showstart,$showend)
    Local $idx,$hidestart,$hideend,$showstart,$showend
    
    For $idx = $hidestart To $hideend
        GUICtrlSetState ($idx,$GUI_HIDE)
    Next
    For $idx = $showstart To $showend
        GUICtrlSetState ($idx,$GUI_SHOW)
    Next    
EndFunc

My little company: Evotec (PL version: Evotec)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...