Jump to content
Sign in to follow this  
fenix114

create automatic list

Recommended Posts

fenix114

HI

I would like to create a list with a few name listed vertical probably with "GUICtrlCreateList" 

I would like the first name to be selected, when I start the form the "GUICtrlCreateInput" is selected and that was not my intention. Than I want the selected name to be read and put in a function ( I already got the function for that) after the function is done I want it to selected the name bellow, so it will finish the whole list of name's.

can somebody please help me with this

Share this post


Link to post
Share on other sites
Melba23

fenix114,

Welcome to the AutoIt forum. :)

Please post the script you are using so we can offer sensible help - see here how to do it. ;)

M23

Edit: And why do you share an IP and an email address with ArcLite86? Multiple accounts are not permitted here. :naughty:

Edited by Melba23

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
GordonFreeman

I think is better use a ComboBox, can be more hard for you get item clicked to exec the func on this type of control

Edited by GordonFreeman

Share this post


Link to post
Share on other sites
fenix114

fenix114,

Welcome to the AutoIt forum. :)

Please post the script you are using so we can offer sensible help - see here how to do it. ;)

M23

thanks Melba23

Here i have the code and a screenshot I hope its all clear what I am trying to accomplish

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 487, 437, 368, 124)
$List1 = GUICtrlCreateList("", 136, 24, 345, 396)
$Button1 = GUICtrlCreateButton("start function", 8, 24, 113, 41)
$addname = GUICtrlCreateInput("(add new name)", 16, 112, 113, 21)
$Button2 = GUICtrlCreateButton("add new name", 16, 144, 113, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
 GUICtrlSetData($list1, "example1|example2|example3|example4|example5|example6|example7|example8|example9|")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Button2
            
            ; a function..

    EndSwitch
WEnd

radcud.jpg

Share this post


Link to post
Share on other sites
GordonFreeman

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 487, 437, 368, 124)
$List1 = GUICtrlCreateList("", 136, 24, 345, 396)
$Button1 = GUICtrlCreateButton("start function", 8, 24, 113, 41)
$addname = GUICtrlCreateInput("(add new name)", 16, 112, 113, 21)
$Button2 = GUICtrlCreateButton("add new name", 16, 144, 113, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
 GUICtrlSetData($list1, "example1|example2|example3|example4|example5|example6|example7|example8|example9|")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Button2
            
            MsgBox(0,"", GUICtrlRead($List1));Get the text of select item in List and show in a MsgBox

    EndSwitch
WEnd

I still do not understand what you want (I'm bad with english). But maybe this can help

Edited by GordonFreeman

Share this post


Link to post
Share on other sites
Melba23

fenix114,

Before we go any further, please answer the question I posed above: :naughty:

 

why do you share an IP and an email address with ArcLite86?

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
fenix114
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 487, 437, 368, 124)
$List1 = GUICtrlCreateList("", 136, 24, 345, 396)
$Button1 = GUICtrlCreateButton("start function", 8, 24, 113, 41)
$addname = GUICtrlCreateInput("(add new name)", 16, 112, 113, 21)
$Button2 = GUICtrlCreateButton("add new name", 16, 144, 113, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
 GUICtrlSetData($list1, "example1|example2|example3|example4|example5|example6|example7|example8|example9|")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Button2
            
            MsgBox(0,"", GUICtrlRead($List1));Get the text of select item in List and show in a MsgBox

    EndSwitch
WEnd

I still do not understand what you want (I'm bad with english). But maybe this can help

That was not exactly wat I wanted

first I want the "example1" to be selected

than when I hit the "start function" button it starta a function and select's the name bellow in this case "example2" till the last name "example9"

I also want to create a function with "add new name" button so when i type a name in the input a push the button a new name will appear on the list

i have also looked the "ComboBox" but that was not really what I wanted

Share this post


Link to post
Share on other sites
Melba23

fenix114,

Answer my question now! :mad:

M23

Edited by Melba23

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
fenix114

fenix114,

Before we go any further, please answer the question I posed above: :naughty:

 

M23

we are not the same persons but we do share the same pc and I had a quick questions ( he recommended me to use this forum)  I had some problems with login intro my email accounttahts why i used his and he didnt want me to use his account, I dont hope this is a problem

Share this post


Link to post
Share on other sites
Melba23

fenix114,

That is fine - I just wanted to know. :)

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
fenix114

ok :) soon i will have acces to my email and be at my own pc 

Share this post


Link to post
Share on other sites
fenix114

but could we please get back to my question:

 

GordonFreeman, on 08 Mar 2014 - 8:01 PM, said:

That was not exactly wat I wanted

first I want the "example1" to be selected

than when I hit the "start function" button it starta a function and select's the name bellow in this case "example2" till the last name "example9"

I also want to create a function with "add new name" button so when i type a name in the input a push the button a new name will appear on the list

 

i have also looked the "ComboBox" but that was not really what I wanted

Share this post


Link to post
Share on other sites
Melba23

fenix114,

Is this close to what you want? :huh:

#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>

Global $iIndex = 0

$Form1 = GUICreate("Form1", 487, 437, 368, 124)

$List1 = GUICtrlCreateList("", 136, 24, 345, 396)
$Button1 = GUICtrlCreateButton("start function", 8, 24, 113, 41)
$addname = GUICtrlCreateInput("(add new name)", 16, 112, 113, 21)
$Button2 = GUICtrlCreateButton("add new name", 16, 144, 113, 25)

GUISetState(@SW_SHOW)

GUICtrlSetData($List1, "example1|example2|example3|example4|example5|example6|example7|example8|example9")
_GUICtrlListBox_SetCurSel($List1, $iIndex)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            _GUICtrlListBox_AddString($List1, GUICtrlRead($addname))
        Case $Button1
            ; Function
            MsgBox($MB_SYSTEMMODAL, "Function", "Running on: " & GUICtrlRead($List1))
            ; Move on
            $iIndex += 1
            If $iIndex = _GUICtrlListBox_GetCount($List1) Then $iIndex = 0
            _GUICtrlListBox_SetCurSel($List1, $iIndex)

    EndSwitch
WEnd
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
fenix114

fenix114,

Is this close to what you want? :huh:

#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>

Global $iIndex = 0

$Form1 = GUICreate("Form1", 487, 437, 368, 124)

$List1 = GUICtrlCreateList("", 136, 24, 345, 396)
$Button1 = GUICtrlCreateButton("start function", 8, 24, 113, 41)
$addname = GUICtrlCreateInput("(add new name)", 16, 112, 113, 21)
$Button2 = GUICtrlCreateButton("add new name", 16, 144, 113, 25)

GUISetState(@SW_SHOW)

GUICtrlSetData($List1, "example1|example2|example3|example4|example5|example6|example7|example8|example9")
_GUICtrlListBox_SetCurSel($List1, $iIndex)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            _GUICtrlListBox_AddString($List1, GUICtrlRead($addname))
        Case $Button1
            ; Function
            MsgBox($MB_SYSTEMMODAL, "Function", "Running on: " & GUICtrlRead($List1))
            ; Move on
            $iIndex += 1
            If $iIndex = _GUICtrlListBox_GetCount($List1) Then $iIndex = 0
            _GUICtrlListBox_SetCurSel($List1, $iIndex)

    EndSwitch
WEnd
M23

 

thank you very much that was exaclty what in wanted :)

Share this post


Link to post
Share on other sites
fenix114

one last question, is it also possible to  load a large list of name's from a excel (or a  text ) fille, so i dont have to write all the name's over and over again

Share this post


Link to post
Share on other sites
Melba23

fenix114,

Yes, look at FileReadToArray if you want to use a text file or the _Excel* functions if you want to use a spreadsheet. :)

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
fenix114

ok thank you very much Melba23

Share this post


Link to post
Share on other sites
fenix114

is it also possible to do this with 2 lists at the same time? so when start up the 2 first name''s of the 2 list are selected and when I press the "start funcion" button it will select the second name of the lists

Share this post


Link to post
Share on other sites
Melba23

fenix114,

Easier to show than to explain: ;)

#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>

Global $iIndex = 0

$Form1 = GUICreate("Form1", 500, 500)

$List1 = GUICtrlCreateList("", 140, 20, 170, 180)
$List2 = GUICtrlCreateList("", 320, 20, 170, 180)
$Button1 = GUICtrlCreateButton("start function", 10, 20, 120, 40)
$addname1 = GUICtrlCreateInput("(add new name 1)", 15, 100, 110, 20)
$addname2 = GUICtrlCreateInput("(add new name 2)", 15, 130, 110, 20)
$Button2 = GUICtrlCreateButton("add new name", 15, 160, 110, 25)

GUISetState(@SW_SHOW)

GUICtrlSetData($List1, "example1|example2|example3|example4|example5|example6|example7|example8|example9")
GUICtrlSetData($List2, "test1|test2|test3|test4|test5|test6|test7|test8|test9")
_GUICtrlListBox_SetCurSel($List1, $iIndex)
_GUICtrlListBox_SetCurSel($List2, $iIndex)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            _GUICtrlListBox_AddString($List1, GUICtrlRead($addname1))
            _GUICtrlListBox_AddString($List2, GUICtrlRead($addname2))
        Case $Button1
            ; Function
            MsgBox($MB_SYSTEMMODAL, "Function", "Running on: " & GUICtrlRead($List1) & " - " & GUICtrlRead($List2))
            ; Move on
            $iIndex += 1
            If $iIndex = _GUICtrlListBox_GetCount($List1) Then $iIndex = 0
            _GUICtrlListBox_SetCurSel($List1, $iIndex)
            _GUICtrlListBox_SetCurSel($List2, $iIndex)
    EndSwitch
WEnd
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

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  

×