Jump to content

Recommended Posts

Posted (edited)

$SelectList = GUICtrlCreateList("", 48, 88, 121, 77, -1, 0)
GUICtrlSetData(-1, "1. Auto Fighter|2. Power Cutter|3. Power Fisher|4. Power Miner")

Global $selection = 0
Global $selectiondecipher = GUICtrlRead($SelectList)

Func Selection()
    While 1
    $msg = GUIGetMsg
    Select
        Case $msg = $NextButton
        $username = GUICtrlRead($UsernameInput)
        $password = GUICtrlRead($PasswordInput)
        
        If $selectiondecipher = "1. Auto Fighter" Then
            $selection = 1
        Endif

        
        If $selectiondecipher = "2. Power Cutter" Then
            $selection = 2
        Endif   
        
        If $selectiondecipher = "3. Power Fisher" Then
            $selection = 3
        Endif   
        
        If $selectiondecipher = "4. Power Miner" Then
            $selection = 4
        Endif   
        
        
            
    EndSelect   
    Wend
EndFunc

This is what I'm trying to do, but it says error. I read the help file and it said I should use GUICtrlRead, but GUICtrlRead doesn't work with GUICtrlSetData. Any help would be greatly appreciated. =)

Edited by inline853
Posted

this what you're looking for?

#include <GuiConstants.au3>
#include <GUIList.au3>

$parent = GUICreate("List",400,200)

$SelectList = GUICtrlCreateList("", 10, 10, 121, 77, -1, 0)
GUICtrlSetData($SelectList,"1. Auto Fighter|2. Power Cutter|3. Power Fisher|4. Power Miner")
GuiCtrlCreateLabel("Username",150,10,50,25)
GuiCtrlCreateLabel("Password",150,40,50,25)
$UsernameInput = GuiCtrlCreateInput("",200,10,100,20)
$PasswordInput = GuiCtrlCreateInput("",200,40,100,20)
$NextButton = GuiCtrlCreateButton("Select",150,100,75,25)

Global $selection = 0
Global $selectiondecipher = GUICtrlRead($SelectList)

GUISetState()
Do
$msg = GUIGetMsg()


    Select
        Case $msg = $NextButton
        $username = GUICtrlRead($UsernameInput)
        $password = GUICtrlRead($PasswordInput)
        $selectedindex = _GUICtrlListSelectedIndex($SelectList)
        $selected = _GUICtrlListGetText($SelectList,$selectedindex)
        If $selected = "1. Auto Fighter" Then
            $selection = 1
        Endif

        
        If $selected = "2. Power Cutter" Then
            $selection = 2
        Endif   
        
        If $selected = "3. Power Fisher" Then
            $selection = 3
        Endif   
        
        If $selected = "4. Power Miner" Then
            $selection = 4
        Endif
        MsgBox(0,"Selected","You selected " & $selected)
    EndSelect   

Until $msg = $GUI_EVENT_CLOSE
GUIDelete()
[u]You can download my projects at:[/u] Pulsar Software
Posted

i get this ...

$selectedindex = _GUICtrlListSelectedIndex($SelectList) 
$selectedindex = ^ ERROR

you need to make sure to add the include:

#include <GUIList.au3>

[u]You can download my projects at:[/u] Pulsar Software
Posted (edited)

now when i click the $NextButton, it doesn't open the other GUI. I set it up like this ...

Func Selection()
    While 1
    $selectedindex = _GUICtrlListSelectedIndex($SelectList)
    $selected = _GUICtrlListGetText($SelectList,$selectedindex)

    $msg = GUIGetMsg()
    Select
        
        Case $msg = $NextButton
        $username = GUICtrlRead($UsernameInput)
        $password = GUICtrlRead($PasswordInput)
        
        If $selected = "1. Auto Fighter" Then
            $selection = 1
        Endif
        
        If $selected = "2. Power Cutter" Then
            $selection = 2
        Endif    
        
        If $selected = "3. Power Fisher" Then
            $selection = 3
        Endif    
        
        If $selected = "4. Power Miner" Then
            $selection = 4
        Endif

            
    EndSelect   
    WendoÝ÷ Ù«­¢+Ù%ÀÌØíͱѥ½¸ôÀQ¡¸(%U%MÑMÑÑ¡M]}M!=¤)¹¥)%ÀÌØíͱѥ½¸±ÐìÐìÀQ¡¸(%U%±Ñ ÀÌØí5¥¸¤)¹¥oÝ÷ ÚØb²+-¢^Ø^¢Ø^¬ejëh×6If $selection = 4 then 
    GUISetState(@SW_SHOW);<== Sets the GUI to be Visible
endif

It is supposed to open another GUI when the user selects the 4th option. In this process it also shuts itself down.

Any help?

Edited by inline853
Posted

are you trying to open a child gui? that is probably what you need to do if I am understanding correctly.

it would help if you posted your code in it's entirety.

[u]You can download my projects at:[/u] Pulsar Software

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
  • Recently Browsing   0 members

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