Jump to content

Loop and set another data in GUICtrlCreateCombo


Recommended Posts

 

;I'd like to on the end of the function, script changed for another option in the combolist. This will be part of the loop

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 418, 177, 192, 114)
$Combo1 = GUICtrlCreateCombo("exe Files", 16, 24, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GuiCtrlSetData(-1,'ini Files|Txt Files|Cfg files')
$Combo2 = GUICtrlCreateCombo("Find A", 176, 24, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GuiCtrlSetData(-1,'Find B')
$Input1 = GUICtrlCreateInput("Input1", 16, 56, 321, 21)
$Button = GUICTRLCreateButton("check", 10, 10, 20,20)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 80, 97, 25)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 80, 97, 25)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 224, 80, 113, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg

        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

 

 

Edited by galan2015
Link to comment
Share on other sites

  • Moderators

Can you please explain more clearly what you are trying to do? This...

script changed for another option in the combolist.

...is very vague. 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

galan2015,

Is your question related to this thread?  If so, does my response help?  If not, see JLogan3o13 above.

kylomas

I would like to take a snapshot of data from text files. No.

1. My first combo [Select file]
2. My second combo [Male | Female]
3. My third combo [Michael | Jordan | Natasha]

I would like to function if it is proven options to choose from in ComboList1, ComboList2, Combolist3. After selecting ComboList3 (CL2 is a sub-CL1 and CL2 CL3 is a sub-category) and then to change to the next available option.

Link to comment
Share on other sites

  • Moderators

galan2015,

Does this help?

#include <GUIConstantsEx.au3>

$sData_1 = "Option 1|Option 2|Option 3"
$sData_2A = "|Option 101|Option 201|Option 301"
$sData_2B = "|Option 402|Option 502|Option 602"
$sData_2C = "|Option 703|Option 803|Option 903"

$hGUI = GUICreate("Test", 500, 500)

$cCombo_1 = GUICtrlCreateCombo("", 10, 10, 200, 20)
GUICtrlSetData($cCombo_1, $sData_1)

$cCombo_2 = GUICtrlCreateCombo("", 250, 10, 200, 20)
GUICtrlSetState($cCombo_2, $GUI_DISABLE)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cCombo_1
            Switch GUICtrlRead($cCombo_1)
                Case "Option 1"
                    GUICtrlSetData($cCombo_2, $sData_2A)
                    GUICtrlSetState($cCombo_2, $GUI_ENABLE)
                Case "Option 2"
                    GUICtrlSetData($cCombo_2, $sData_2B)
                    GUICtrlSetState($cCombo_2, $GUI_ENABLE)
                Case "Option 3"
                    GUICtrlSetData($cCombo_2, $sData_2C)
                    GUICtrlSetState($cCombo_2, $GUI_ENABLE)
            EndSwitch

    EndSwitch

WEnd

If this is nowhere close, then please try and explain what you are trying to do in more detail as you are not being very clear at present.

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

I need to change the data in 60,000 files. The function appends a line to each file.
I have three combo list:
1. The first combo A | B | C | .. | Z after selecting a name in the pop Combo 2
2. The names of clients
3. The third combo contains a list of files in a folder on my misfortune number of files to be edited for any user: 8.

After selecting the data manually from the combo letter, after pressing the button that activates the function appends data to a single file.

But I would like to function After adding in the file lines jumped to the next file and performed the function again. The file names in a combo 2 and 3 are variable.

Link to comment
Share on other sites

  • Moderators

galan2015,

That reads nothing like what you described in your earlier posts - and really does not advance us very much further forward. I will try and ask specific questions to see if I can tease out some more details.

- 1. The combo which the user actions first - what does it contain?

- 2. The combo which holds the "names of clients" - from where does it get these? Is its content alphabetically linked to the "A-Z" combo?

- 3. Where does the combo with a file list come in? I really hope you do not intend to put all 60,000 filenames in it!  You say you want to "jump[...] to the next file" - how do you define "the next file" if you can only select one at a time in the combo?

You answer those points clearly and we might be able to make some progress.

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

Combo1 contains a list from A to Z.
Combo2
contains a list of names from txt file.              ;;;;;;;;;; Made by myself, User1|User2|User4

Combo 3 contains a list of paths to files from txt file ;;;;;;;;;;;; usrini.txt|user.txt|backup.txt|class.txt|forum.txt|log.txt ... and two others

I want to do :
Pick Combo1[A]
Pick Combo2[Andrzej1]
PIck Combo3[1] ; $i = 8, 8 files
Function
Pick Combo3[2]
Function
Pick Combo3[3]
Function

Pick Combo3[4]
Function

Pick Combo3[5]
Function

Pick Combo3[6]
Function

Pick Combo3[7]
Function
Pick Combo3[8]
Function

Pick Combo2[Andrzej2]
Pick Combo3[1]

Function
Pick Combo3[2]
Function
Pick Combo3[3]
Function

Pick Combo3[4]
Function

Pick Combo3[5]
Function

Pick Combo3[6]
Function

Pick Combo3[7]
Function
Pick Combo3[8]
Function


.........

Edited by galan2015
Link to comment
Share on other sites

galan2015,

Total entries or selected entries?  As I said in the thread that I pointed you to earlier, definition of the relationships of the data in the combo controls is the only difficult task here.  Combo1 is related to combo2...is related to combo2...etc...

Perhaps if you post some real world example data with an explanation of it's use it will become clearer. 

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

  • Moderators

galan2015,

Looking at what you want to do, why are you even thinking of using combos? All you do is run through their entries one by one in order - and that is a job for loops, not combos.

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

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 458, 122, 192, 114)
$Combo1 = GUICtrlCreateCombo("ComboA", 0, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUiCtrlSetData(-1,"ComboB")
$Combo2 = GUICtrlCreateCombo("Sex", 152, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Combo3 = GUICtrlCreateCombo("Combo3", 304, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 56, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 56, 97, 17)
$Button = GUICtrlCreateButton('write file',280,56,50,30)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

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

            Exit
        Case $Combo1
        $if1 = GuiCtrlRead($combo1)
IF      $if1 = 'ComboA' then
            GuiCtrlSetData($Combo2,"")
    GuiCtrlSetData($Combo2,"Male")
    EndIf
IF      $if1 = 'ComboB' then
        GuiCtrlSetData($Combo2,"")
    GuiCtrlSetData($Combo2,"Female")
    EndIf
        Case $Combo2
        $if1 = GuiCtrlRead($combo2)
IF      $if1 = 'Female' then
    GuiCtrlSetData($Combo3,"")
    GuiCtrlSetData($Combo3,"Agnieszka|Ania")
    EndIf
IF      $if1 = 'Male' then
    GuiCtrlSetData($Combo3,"")
    GuiCtrlSetData($Combo3,"Andrzej|Adam")
    Endif
        Case $Combo3
IF      $if1 = 'Andrzej' then
EndIf
        Case $Button
              GUICtrlSetState($Checkbox2,1)
              Sleep(150)
            GUICtrlSetState($Checkbox2,1)
            MSgBox(1,'ANd what now script should do','Script should pick Another option from $combo3. That is it')
    EndSwitch
WEnd

 

Link to comment
Share on other sites

  • Moderators

Personally I would do something like this. Of course, if you get into multiple sub choices this is going to be a PITA to support:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 458, 122, 192, 114)
$Combo1 = GUICtrlCreateCombo("Choose Combo", 0, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUiCtrlSetData(-1,"ComboA|ComboB", "Choose Combo")
$Combo2 = GUICtrlCreateCombo("Choose Sex", 152, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUiCtrlSetData(-1,"Male|Female", "Choose Sex")
$Combo3 = GUICtrlCreateCombo("Choose Name", 304, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
        GUiCtrlSetData(-1,"Fred|Judy", "Choose Name")

$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 56, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 56, 97, 17)
$Button = GUICtrlCreateButton('write file',280,56,50,30)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            If GUICtrlRead($Combo1) = "Choose Combo" Then
                GUICtrlSetData($Combo2, "Choose Sex")
                GUICtrlSetData($Combo3, "Choose Name")
            Else
                GUICtrlSetData($Combo2, (GUICtrlRead($combo1) = "ComboA") ? "Male" : "Female")
                    If GUICtrlRead($Combo2) <> "Choose Sex" Then GUICtrlSetData($Combo3, (GUICtrlRead($combo2) = "Male") ? "Fred" : "Judy")
            EndIf
    EndSwitch
WEnd

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Personally I would do something like this. Of course, if you get into multiple sub choices this is going to be a PITA to support:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 458, 122, 192, 114)
$Combo1 = GUICtrlCreateCombo("Choose Combo", 0, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUiCtrlSetData(-1,"ComboA|ComboB", "Choose Combo")
$Combo2 = GUICtrlCreateCombo("Choose Sex", 152, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUiCtrlSetData(-1,"Male|Female", "Choose Sex")
$Combo3 = GUICtrlCreateCombo("Choose Name", 304, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
        GUiCtrlSetData(-1,"Fred|Judy", "Choose Name")

$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 56, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 56, 97, 17)
$Button = GUICtrlCreateButton('write file',280,56,50,30)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            If GUICtrlRead($Combo1) = "Choose Combo" Then
                GUICtrlSetData($Combo2, "Choose Sex")
                GUICtrlSetData($Combo3, "Choose Name")
            Else
                GUICtrlSetData($Combo2, (GUICtrlRead($combo1) = "ComboA") ? "Male" : "Female")
                    If GUICtrlRead($Combo2) <> "Choose Sex" Then GUICtrlSetData($Combo3, (GUICtrlRead($combo2) = "Male") ? "Fred" : "Judy")
            EndIf
    EndSwitch
WEnd

 

​no that is big fail :P hope i will learn by myself and show u how  how i solve the problem

 

Link to comment
Share on other sites

  • Moderators

As I said, it would be a pain in the ass to manage, but you're insisting to do it with combos rather than a loop (as at least one member has already suggested).

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

×
×
  • Create New...