Jump to content

I need some help to hide a radio button group until the user selects a button


LetsAuto
 Share

Recommended Posts

;language radio group
local $langGroup = GUICtrlCreateGroup("Select Language",130, 10, 145, 130) ;start group
local $langButton1 = GUICtrlCreateRadio($langArr[0], 135, 30, $radWidth)
local $langButton2 = GUICtrlCreateRadio($langArr[1], 135, 50, $radWidth)
local $langButton3 = GUICtrlCreateRadio($langArr[2], 135, 70, $radWidth)
local $langButton4 = GUICtrlCreateRadio($langArr[3], 135, 90, 135)
local $langButton5 = GUICtrlCreateRadio($langArr[4], 135, 110,$radWidth)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

GUISetState($GUI_CHECKED, $GUI_HIDE)



While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
;;determines if the radio button is checked
Case $msg = $brandButton1 And BitAND(GUICtrlRead($brandButton1), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.')

Case $msg = $brandButton2 And BitAND(GUICtrlRead($brandButton2), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
Case $msg = $brandButton3 And BitAND(GUICtrlRead($brandButton3), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 3 and it is Checked.')
Case $msg = $brandButton4 And BitAND(GUICtrlRead($brandButton4), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 4 and it is Checked.')
Case $msg = $brandButton5 And BitAND(GUICtrlRead($brandButton5), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 5 and it is Checked.')
EndSelect
if $msg = $brandButton1 Or $brandButton2 Or $brandButton3 Or $brandButton4 Or $brandbutton5 BitAND(GUICrtlRead($brandButton1,$brandButton2,$brandButton3,$brandButton4,$brandButton5), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
BitAND(GUICtrlGroup($langGroup), $GUI_HIDE) = $GUI_HIDE
EndIf
WEnd

what im trying to do is have the user select a radio button in my first group, and then display the other group of radio buttons, the Language radio button set. also later on in the script i will be making it so some of the language options are disabled according to certain choices in the first group. if anyone can help that would be great!

Link to comment
Share on other sites

  • Moderators

LetsAuto,

Please provide a working script so we can at least run it immediately. Most, if not all, the regular people here will not take the time to write a whole GUI around your posted code snippet - we have other things to occupy us and it probably would not look like your code anyway. So help us to help you and give us something with which we can work. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

;;;;;;;;;;;;;;;;
;; Screen One ;;
;;;;;;;;;;;;;;;;

; Force close with CTRL-Q
HotKeySet("^q","stop")
Func stop()
Exit
EndFunc

#include 
#include 
#include 
#include 
#include 
#include 

DoScreenOne()



Func DoScreenOne()
local $msg, $labelWidth, $radWidth, $brandArr[5], $langArr[5]
$brandArr[0] = "Brand 1"
$brandArr[1] = "Brand 2"
$brandArr[2] = "Brand 3"
$brandArr[3] = "Brand 4"
$brandArr[4] = "Brand 5"
$langArr[0] = "German(DE)"
$langArr[1] = "English(GB)"
$langArr[2] = "English(US)"
$langArr[3] = "Portuguese Brazilian (PB)"
$langArr[4] = "Russian(RU)"
GUICreate("Automation Wizard", 400, 400, -1, -1, -1, -1)

;defines label width for default label size
;~ $labelWidth = 150
$radWidth = 100
;brandButton radio group
GUICtrlCreateGroup("Please Select a Brand", 1, 10, 125, 130) ;start group
local $brandButton1 = GUICtrlCreateRadio($brandArr[0], 12, 30, $radWidth)
local $brandButton2 = GUICtrlCreateRadio($brandArr[1], 12, 50, $radWidth)
local $brandButton3 = GUICtrlCreateRadio($brandArr[2], 12, 70, $radWidth)
local $brandButton4 = GUICtrlCreateRadio($brandArr[3], 12, 90, $radWidth)
local $brandButton5 = GUICtrlCreateRadio($brandArr[4], 12, 110,$radWidth)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

;language radio group
local $langGroup = GUICtrlCreateGroup("Select Language",130, 10, 145, 130) ;start group
local $langButton1 = GUICtrlCreateRadio($langArr[0], 135, 30, $radWidth)
local $langButton2 = GUICtrlCreateRadio($langArr[1], 135, 50, $radWidth)
local $langButton3 = GUICtrlCreateRadio($langArr[2], 135, 70, $radWidth)
local $langButton4 = GUICtrlCreateRadio($langArr[3], 135, 90, 135)
local $langButton5 = GUICtrlCreateRadio($langArr[4], 135, 110,$radWidth)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

GUISetState($GUI_CHECKED)


While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
;;determines if the radio button is checked
Case $msg = $brandButton1 And BitAND(GUICtrlRead($brandButton1), $GUI_CHECKED) = $GUI_CHECKED
;;only allows certain languages to be used for each brand
if $langButton1 And BitAND(GUICtrlRead($langButton1), $GUI_CHECKED) = $GUI_CHECKED Then
MsgBox("error", "Error", "German cannot be selected with Brand 1. Please immediately choose alternate language.")
sleep(1250)
ElseIf $langButton4 And BitAND(GUICtrlRead($langButton4), $GUI_CHECKED) = $GUI_CHECKED Then
MsgBox("error", "Error", "Portuguese Brazilian cannot be selected with Brand 1. Please immediately choose alternate language.")
sleep(1250)
;~ Else
;~ $langButton5 And BitAND(GUICtrlRead($langButton5), $GUI_CHECKED) = $GUI_CHECKED Then
;~ MsgBox("error", "Error", "Russian cannot be selected with Brand 1. Please immediately choose alternate language.")
;~ sleep(1250)
EndIf
Case $msg = $brandButton2 And BitAND(GUICtrlRead($brandButton2), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
Case $msg = $brandButton3 And BitAND(GUICtrlRead($brandButton3), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 3 and it is Checked.')
Case $msg = $brandButton4 And BitAND(GUICtrlRead($brandButton4), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 4 and it is Checked.')
Case $msg = $brandButton5 And BitAND(GUICtrlRead($brandButton5), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 5 and it is Checked.')
EndSelect
WEnd
local
sleep(5000)

its slightly modified from earlier. i gave up hiding the buttons, so instead im trying to just make it so if the user clicks on Brand 1 radio button and then the German radio button, an error message pops up.. but that too is not working out so well. lol

Link to comment
Share on other sites

  • Moderators

LetsAuto,

I would do it like this: ;)

#include <GUIConstantsEx.au3>

; Force close with CTRL-Q
HotKeySet("^q", "stop")
Func stop()
    Exit
EndFunc   ;==>stop

DoScreenOne()

Func DoScreenOne()
    Local $msg, $labelWidth, $radWidth, $brandArr[5], $langArr[5]
    $brandArr[0] = "Brand 1"
    $brandArr[1] = "Brand 2"
    $brandArr[2] = "Brand 3"
    $brandArr[3] = "Brand 4"
    $brandArr[4] = "Brand 5"
    $langArr[0] = "German(DE)"
    $langArr[1] = "English(GB)"
    $langArr[2] = "English(US)"
    $langArr[3] = "Portuguese Brazilian (PB)"
    $langArr[4] = "Russian(RU)"
    GUICreate("Automation Wizard", 400, 400, -1, -1, -1, -1)

    ;defines label width for default label size
;~ $labelWidth = 150
    $radWidth = 100
    ;brandButton radio group
    GUICtrlCreateGroup("Please Select a Brand", 1, 10, 125, 130) ;start group
    Local $brandButton1 = GUICtrlCreateRadio($brandArr[0], 12, 30, $radWidth)
    Local $brandButton2 = GUICtrlCreateRadio($brandArr[1], 12, 50, $radWidth)
    Local $brandButton3 = GUICtrlCreateRadio($brandArr[2], 12, 70, $radWidth)
    Local $brandButton4 = GUICtrlCreateRadio($brandArr[3], 12, 90, $radWidth)
    Local $brandButton5 = GUICtrlCreateRadio($brandArr[4], 12, 110, $radWidth)
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

    ;language radio group
    Local $langGroup = GUICtrlCreateGroup("Select Language", 130, 10, 145, 130) ;start group
    Local $langButton1 = GUICtrlCreateRadio($langArr[0], 135, 30, $radWidth)
    Local $langButton2 = GUICtrlCreateRadio($langArr[1], 135, 50, $radWidth)
    Local $langButton3 = GUICtrlCreateRadio($langArr[2], 135, 70, $radWidth)
    Local $langButton4 = GUICtrlCreateRadio($langArr[3], 135, 90, 135)
    Local $langButton5 = GUICtrlCreateRadio($langArr[4], 135, 110, $radWidth)
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

    GUISetState($GUI_CHECKED)


    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $brandButton1, $langButton1
                ;;only allows certain languages to be used for each brand
                If GUICtrlRead($brandButton1) = 1 And GUICtrlRead($langButton1) = 1 Then
                    MsgBox("error", "Error", "German cannot be selected with Brand 1. Please immediately choose alternate language.")
                EndIf
            Case $brandButton2
                MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
            Case $brandButton3
                MsgBox(64, 'Info:', 'You clicked on Radio 3 and it is Checked.')
            Case $brandButton4
                If GUICtrlRead($brandButton4) = 1 And GUICtrlRead($langButton4) = 1 Then
                    MsgBox("error", "Error", "Portuguese Brazilian cannot be selected with Brand 4. Please immediately choose alternate language.")
                EndIf
            Case $brandButton5
                MsgBox(64, 'Info:', 'You clicked on Radio 5 and it is Checked.')
        EndSwitch
    WEnd
EndFunc   ;==>DoScreenOne

I used Switch as that allows you to run the same Case code for several different events. You can see that we check the Brand1/lang1 imbalance regardless of which one was actually pressed. ;)

Please ask if you have any quesitons. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Thanks, that worked perfectly. so Select only allows for one instance where Switch can be used for possibly only One click in particular, but it will get re used no matter how many times it was clicked.. so case would only do it until i deselected both options, where Switch i dont need a timer and also its continuous? still relatively young to AutoIt and im just jumping into an olympic sized swimming pool haha

Link to comment
Share on other sites

  • Moderators

LetsAuto,

Switch allows for easier syntax if you want multiple events to fire a single Case:

Switch GUIGetMsg()
    Case $brandButton1, $langButton1

$iMsg = GUIGetMsg()
Select
    Case $iMsg = $brandButton1 Or $iMsg = $langButton1

Which would you prefer to type? :huh:

And do not worry, we have a good supply of lifebelts on the forum - but, as you have just done in this thread, we do ask that you at least get wet before we throw you one. :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

GUISetState is wrong I think? Shouldn't it be GUISetState(@SW_SHOW)?

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

;;;;;;;;;;;;;;;;
;; Screen One ;;
;;;;;;;;;;;;;;;;

; Force close with CTRL-Q
HotKeySet("^q","stop")
Func stop()
Exit
EndFunc

#include 
#include 
#include 
#include 
#include 
#include 

DoScreenOne()



Func DoScreenOne()
local $msg, $labelWidth, $radWidth, $brandArr[6], $langArr[5]
$brandArr[0] = "Brand1"
$brandArr[1] = "Brand2"
$brandArr[2] = "Brand3"
$brandArr[3] = "Brand4"
$brandArr[4] = "Brand5"
$brandArr[5] = "Brand6"
$langArr[0] = "German(DE)"
$langArr[1] = "English(GB)"
$langArr[2] = "English(US)"
$langArr[3] = "Portuguese(BR)"
$langArr[4] = "Russian(RU)"
GUICreate("Automation Wizard", 400, 400, -1, -1, -1, -1)

$radWidth = 100
;brandButton radio group
GUICtrlCreateGroup("Please Select a Brand", 1, 10, 125, 145) ;start group
local $brandButton0 = GUICtrlCreateRadio($brandArr[0], 12, 30, $radWidth)
local $brandButton1 = GUICtrlCreateRadio($brandArr[1], 12, 50, $radWidth)
local $brandButton2 = GUICtrlCreateRadio($brandArr[2], 12, 70, $radWidth)
local $brandButton3 = GUICtrlCreateRadio($brandArr[3], 12, 90, $radWidth)
local $brandButton4 = GUICtrlCreateRadio($brandArr[4], 12, 110,$radWidth)
local $brandButton5 = GUICtrlCreateRadio($brandArr[5], 12, 130,$radWidth)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

;language radio group
GUICtrlCreateGroup("Select Language",130, 10, 125, 130) ;start group
local $langButton0 = GUICtrlCreateRadio($langArr[0], 135, 30, $radWidth)
local $langButton1 = GUICtrlCreateRadio($langArr[1], 135, 50, $radWidth)
local $langButton2 = GUICtrlCreateRadio($langArr[2], 135, 70, $radWidth)
local $langButton3 = GUICtrlCreateRadio($langArr[3], 135, 90, $radWidth)
local $langButton4 = GUICtrlCreateRadio($langArr[4], 135, 110,$radWidth)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

GUISetState($GUI_CHECKED)




While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $brandButton0, $langButton1
If GUICtrlRead($brandButton0) = 1 And GUICtrlRead($langButton1) = 1 Then
MsgBox("error", "Error", "English(GB) cannot be selected with SyAM. Please select a different language.")
EndIf
Case $brandButton0, $langButton3
If GUICtrlRead($brandButton0) = 1 And GUICtrlRead($langButton3) = 1 Then
MsgBox("error", "Error", "Portuguese(BR) cannot be selected with SyAM. Please immediately choose alternate language.")
EndIf
Case $brandButton0, $langButton4
If GUICtrlRead($brandButton0) = 1 And GUICtrlRead($langButton4) = 1 Then
MsgBox("error", "Error", "Russian(RU) cannot be selected with SyAM. Please select a different language.")
EndIf
;~ Case $brandButton0, $langButton1, $langButton3, $langButton4
;~ ;;only allows English(US) and German(DE) to be used with SyAM
;~ If GUICtrlRead($brandButton0) = 1 And GUICtrlRead($langButton1) = 1 Then
;~ MsgBox("error", "Error", "English(GB) cannot be selected with SyAM. Please select a different language.")
;~ ElseIf GUICtrlRead($brandButton0) = 1 And GUICtrlRead($langButton3) = 1 Then
;~ MsgBox("error", "Error", "Portuguese(BR) cannot be selected with SyAM. Please immediately choose alternate language.")
;~ ElseIf GUICtrlRead($brandButton0) = 1 And GUICtrlRead($langButton4) = 1 Then
;~ MsgBox("error", "Error", "Russian(RU) cannot be selected with SyAM. Please select a different language.")
;~ EndIf
;;only allows English(GB) to be used with Brand2
Case $brandButton1, $langButton0
If GUICtrlRead($brandButton1) = 1 And GUICtrlRead($langButton0) = 1 Then
MsgBox("error", "Error", "German(DE) cannot be selected with Brand2. Please select a different language.")
EndIf
Case $brandButton1, $langButton2
If GUICtrlRead($brandButton1) = 1 And GUICtrlRead($langButton2) = 1 Then
MsgBox("error", "Error", "English(US) cannot be selected with Brand2. Please select a different language.")
EndIf
Case $brandButton1, $langButton3
If GUICtrlRead($brandButton1) = 1 And GUICtrlRead($langButton3) = 1 Then
MsgBox("error", "Error", "Portuguese(BR) cannot be selected with Brand2. Please select a different language.")
EndIf
Case $brandButton1, $langButton4
If GUICtrlRead($brandButton1) = 1 And GUICtrlRead($langButton4) = 1 Then
MsgBox("error", "Error", "Russian(RU) cannot be selected with Brand2. Please select a different language.")
EndIf
;~ Case $brandButton1, $langButton0, $langButton2, $langButton3, $langButton4
;~ If GUICtrlRead($brandButton1) = 1 And GUICtrlRead($langButton0) = 1 Then
;~ MsgBox("error", "Error", "German(DE) cannot be selected with Brand2. Please select a different language.")
;~ ElseIf GUICtrlRead($brandButton1) = 1 And GUICtrlRead($langButton2) = 1 Then
;~ MsgBox("error", "Error", "English(US) cannot be selected with Brand2. Please select a different language.")
;~ ElseIf GUICtrlRead($brandButton1) = 1 And GUICtrlRead($langButton3) = 1 Then
;~ MsgBox("error", "Error", "Portuguese(BR) cannot be selected with Brand2. Please select a different language.")
;~ ElseIf GUICtrlRead($brandButton1) = 1 And GUICtrlRead($langButton4) = 1 Then
;~ MsgBox("error", "Error", "Russian(RU) cannot be selected with Brand2. Please select a different language.")
;~ EndIf
;;only allows Russian(RU) to be used with Brand3
Case $brandButton2, $langButton0, $langButton1, $langButton2, $langButton3
If GUICtrlRead($brandButton2) = 1 And GUICtrlRead($langButton0) = 1 Then
MsgBox("error", "Error", "German(DE) cannot be selected with Brand3. Please select a different language.")
ElseIf GUICtrlRead($brandButton2) = 1 And GUICtrlRead($langButton1) = 1 Then
MsgBox("error", "Error", "English(GB) cannot be selected with Brand3. Please select a different language.")
ElseIf GUICtrlRead($brandButton2) = 1 And GUICtrlRead($langButton2) = 1 Then
MsgBox("error", "Error", "English(US) cannot be selected with Brand3. Please select a different language.")
ElseIf GUICtrlRead($brandButton2) = 1 And GUICtrlRead($langButton3) = 1 Then
MsgBox("error", "Error", "Portuguese(BR) cannot be selected with Brand3. Please select a different language.")
EndIf
;;only allows Portuguese(BR) to be used with Brand4
Case $brandButton3, $langButton0, $langButton1, $langButton2, $langButton4
If GUICtrlRead($brandButton3) = 1 And GUICtrlRead($langButton0) = 1 Then
MsgBox("error", "Error", "German(DE) cannot be selected with Brand4. Please select a different language.")
ElseIf GUICtrlRead($brandButton3) = 1 And GUICtrlRead($langButton1) = 1 Then
MsgBox("error", "Error", "English(GB) cannot be selected with Brand4. Please select a different language.")
ElseIf GUICtrlRead($brandButton3) = 1 And GUICtrlRead($langButton2) = 1 Then
MsgBox("error", "Error", "English(US) cannot be selected with Brand4. Please select a different language.")
ElseIf GUICtrlRead($brandButton3) = 1 And GUICtrlRead($langButton4) = 1 Then
MsgBox("error", "Error", "Russian(RU) cannot be selected with Brand4. Please select a different language.")
EndIf
;;only allows Russian(RU) to be used with Brand5
Case $brandButton4, $langButton0, $langButton1, $langButton2, $langButton3
If GUICtrlRead($brandButton4) = 1 And GUICtrlRead($langButton0) = 1 Then
MsgBox("error", "Error", "German(DE) cannot be selected with Brand5. Please select a different language.")
ElseIf GUICtrlRead($brandButton4) = 1 And GUICtrlRead($langButton1) = 1 Then
MsgBox("error", "Error", "English(GB) cannot be selected with Brand5. Please select a different language.")
ElseIf GUICtrlRead($brandButton4) = 1 And GUICtrlRead($langButton2) = 1 Then
MsgBox("error", "Error", "English(US) cannot be selected with Brand5. Please select a different language.")
ElseIf GUICtrlRead($brandButton4) = 1 And GUICtrlRead($langButton3) = 1 Then
MsgBox("error", "Error", "Portuguese(BR) cannot be selected with Brand5. Please select a different language.")
EndIf
;;only allows English(GB) to be used with Brand6
Case $brandButton5, $langButton0, $langButton2, $langButton3, $langButton4
If GUICtrlRead($brandButton5) = 1 And GUICtrlRead($langButton0) = 1 Then
MsgBox("error", "Error", "German(DE) cannot be selected with Brand6. Please select a different language.")
ElseIf GUICtrlRead($brandButton5) = 1 And GUICtrlRead($langButton2) = 1 Then
MsgBox("error", "Error", "English(US) cannot be selected with Brand6. Please select a different language.")
ElseIf GUICtrlRead($brandButton5) = 1 And GUICtrlRead($langButton3) = 1 Then
MsgBox("error", "Error", "Portuguese(BR) cannot be selected with Brand6. Please select a different language.")
ElseIf GUICtrlRead($brandButton5) = 1 And GUICtrlRead($langButton4) = 1 Then
MsgBox("error", "Error", "Russian(RU) cannot be selected with Brand6. Please select a different language.")
EndIf
EndSwitch
WEnd
EndFunc ;==>DoScreenOne

so everything was working until i got to brand 2... the message stopped popping up so i tried to separate all of the instances(as you can see i just commented them out), and that still did'nt work.. most likely its something simple i missed but my brain is fried. help? :(

Link to comment
Share on other sites

  • Moderators

LetsAuto,

That is getting too complicated for its own good. :wacko:

I suggest that we revert to your intiial idea and only allow the user to select the languages that are valid for that brand. Rather than wade through all that code could you let me have a table of which languages are valid for each brand - I will then develop some siutable code for you which should be a lot less complex! :)

But that will be something to work on tomorrow morning - goodnight for now. :bye:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

ya, i was getting that feeling too. and Thanks, ya any time would be great.

so:

Brand0 -- English(US) and German(DE)

Brand1 -- English(GB)

Brand2 -- Russian(RU)

Brand3 -- Portuguese(BR)

Brand4 -- Russian(RU)

Brand5 -- English(GB)

and again, I thank you all for all the help. This forum has proven to be a great help!

also completely off topic.. can i import a VB file into an autoIT script? or vise-versa even.. because if i wrote this is VB and just imported the necesary components from AutoIT that would make life a lot easier seeing as how i already know VB lol. (but if it is possible, i would still prefer to do it in AutoIT) :bye:

Link to comment
Share on other sites

  • Moderators

LetsAuto,

Here is a much simpler version: ;)

#include <GUIConstantsEx.au3>

; Force close with CTRL-Q
HotKeySet("^q", "stop")
Func stop()
    Exit
EndFunc   ;==>stop

DoScreenOne()

Func DoScreenOne()
    Local $msg, $labelWidth, $radWidth = 100
    ; An easy way of declaring small arrays <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Local $brandArr[6] = ["Brand1", "Brand2", "Brand3", "Brand4", "Brand5", "Brand6"]
    Local $langArr[5] = ["German(DE)", "English(GB)", "English(US)", "Portuguese(BR)", "Russian(RU)"]
    ; And use arrays to hold the radio ControlIDs - it is much more useful as you will see <<<<<<<<<<<<<<<<<<
    Local $brandButton[6], $langButton[5]

    GUICreate("Automation Wizard", 400, 400, -1, -1, -1, -1)

    ;brandButton radio group
    GUICtrlCreateGroup("Please Select a Brand", 1, 10, 125, 145) ;start group
    ; Use a loop if the controls are simply posiitoned as in this case <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    For $i = 0 To 5
        ; And now we can use the array we declared earlier to hold the ControlIDs <<<<<<<<<<<<<<<<<<<<<<<<<<
        $brandButton[$i] = GUICtrlCreateRadio($brandArr[$i], 12, 30 + (20 * $i), $radWidth)
    Next
    ; No need to close the group if you start another one afterwards <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ;language radio group
    GUICtrlCreateGroup("Select Language", 130, 10, 125, 130) ;start group
    For $i = 0 To 4
        $langButton[$i] = GUICtrlCreateRadio($langArr[$i], 135, 30 + (20 * $i), $radWidth)
        GUICtrlSetState(-1, $GUI_DISABLE)
    Next
    GUICtrlCreateGroup("", -99, -99, 1, 1) ; But we do need to close the group here <<<<<<<<<<<<<<<<<<<<<<<

    GUISetState($GUI_CHECKED)

    While 1
        $iMsg = GUIGetMsg()
        Switch $iMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $brandButton[0] To $brandButton[5]
                ; Disable all language buttons
                For $i = 0 To 4
                    GUICtrlSetState($langButton[$i], $GUI_DISABLE)
                Next
                ; And now enable only the ones we want
                Switch $iMsg - $brandButton[0] ; This converts the ControlID into a simple index <<<<<<<<<
                    Case 0
                        GUICtrlSetState($langButton[0], $GUI_ENABLE)
                        GUICtrlSetState($langButton[2], $GUI_ENABLE)
                    Case 1
                        GUICtrlSetState($langButton[1], $GUI_ENABLE)
                    Case 2
                        GUICtrlSetState($langButton[4], $GUI_ENABLE)
                    Case 3
                        GUICtrlSetState($langButton[3], $GUI_ENABLE)
                    Case 4
                        GUICtrlSetState($langButton[4], $GUI_ENABLE)
                    Case 5
                        GUICtrlSetState($langButton[1], $GUI_ENABLE)
                EndSwitch

        EndSwitch
    WEnd
EndFunc   ;==>DoScreenOne

I have made a few general comments - look for the <<<<<<<< lines. Please ask if anything is unclear. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

how should i go about creating a button to go to the next screen (ScreenTwo), and save the radio button selections as variables to be used later. clearly i would have to save them as static variables otherwise they would be deleted after the function

Link to comment
Share on other sites

  • Moderators

LetsAuto,

I would do this:

#include <GUIConstantsEx.au3>

; Force close with CTRL-Q
HotKeySet("^q", "stop")
Func stop()
    Exit
EndFunc   ;==>stop

Global $iBrand, $iLang

DoScreenOne()

MsgBox(0, "We Are here", "Brand selected = " & $iBrand & @CRLF & "Lang selected = " & $iLang)

Func DoScreenOne()
    Local $msg, $labelWidth, $radWidth = 100
    ; An easy way of declaring small arrays <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Local $brandArr[6] = ["Brand1", "Brand2", "Brand3", "Brand4", "Brand5", "Brand6"]
    Local $langArr[5] = ["German(DE)", "English(GB)", "English(US)", "Portuguese(BR)", "Russian(RU)"]
    ; And use arrays to hold the radio ControlIDs - it is much more useful as you will see <<<<<<<<<<<<<<<<<<
    Local $brandButton[6], $langButton[5]

    GUICreate("Automation Wizard", 400, 400, -1, -1, -1, -1)

    ;brandButton radio group
    GUICtrlCreateGroup("Please Select a Brand", 1, 10, 125, 145) ;start group
    ; Use a loop if the controls are simply posiitoned as in this case <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    For $i = 0 To 5
        ; And now we can use the array we declared earlier to hold the ControlIDs <<<<<<<<<<<<<<<<<<<<<<<<<<
        $brandButton[$i] = GUICtrlCreateRadio($brandArr[$i], 12, 30 + (20 * $i), $radWidth)
    Next
    ; No need to close the group if you start another one afterwards <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ;language radio group
    GUICtrlCreateGroup("Select Language", 130, 10, 125, 130) ;start group
    For $i = 0 To 4
        $langButton[$i] = GUICtrlCreateRadio($langArr[$i], 135, 30 + (20 * $i), $radWidth)
        GUICtrlSetState(-1, $GUI_DISABLE)
    Next
    GUICtrlCreateGroup("", -99, -99, 1, 1) ; But we do need to close the group here <<<<<<<<<<<<<<<<<<<<<<<

    $cButton_Next = GUICtrlCreateButton("Next", 10, 200, 80, 30)

    GUISetState($GUI_CHECKED)

    While 1
        $iMsg = GUIGetMsg()
        Switch $iMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $brandButton[0] To $brandButton[5]
                ; Disable all language buttons
                For $i = 0 To 4
                    GUICtrlSetState($langButton[$i], $GUI_DISABLE)
                Next
                ; And now enable only the ones we want
                Switch $iMsg - $brandButton[0] ; This converts the ControlID into a simple index <<<<<<<<<
                    Case 0
                        GUICtrlSetState($langButton[0], $GUI_ENABLE)
                        GUICtrlSetState($langButton[2], $GUI_ENABLE)
                    Case 1
                        GUICtrlSetState($langButton[1], $GUI_ENABLE)
                    Case 2
                        GUICtrlSetState($langButton[4], $GUI_ENABLE)
                    Case 3
                        GUICtrlSetState($langButton[3], $GUI_ENABLE)
                    Case 4
                        GUICtrlSetState($langButton[4], $GUI_ENABLE)
                    Case 5
                        GUICtrlSetState($langButton[1], $GUI_ENABLE)
                EndSwitch
            Case $cButton_Next
                For $i = 0 To 5
                    If GUICtrlRead($brandButton[$i]) = 1 Then
                        $iBrand = $i
                        ExitLoop
                    EndIf
                Next
                If $i = 6 Then
                    MsgBox(0, "Error", "Please select a brand")
                    $fFlag = False
                Else
                    For $i = 0 To 4
                        If GUICtrlRead($langButton[$i]) = 1 Then
                            $iLang = $i
                            ExitLoop
                        EndIf
                    Next
                    If $i = 5 Then
                        MsgBox(0, "Error", "Please select a language")
                        $fFlag = False
                    Else
                        ExitLoop
                    EndIf
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>DoScreenOne

All clear? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

LetsAuto,

Having seen your new thread here I take it you are no longer interested in pursuing this? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

well i am, but i think creating a GUI using VB with all of the restrictions might be easier than trying to fight my way through using AutoIt3 and learning the language as i go.. so im gonna trry to creat my GUI, and then in the autoIt script just call the GUI before it starts doing the scripting

Link to comment
Share on other sites

except now thinking about the next screen in the GUI, i need to be able to select specific functions and run them individually, which means id need to be able to call the script form VB, and someone on the other thread said i cant do that.. soo it looks like im going back to the strict AutoIt which is okay, just harder for me personally.

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...