Jump to content
Sign in to follow this  
xZZTx

Combo Box Help

Recommended Posts

xZZTx

Im new to makein combo box gui things so i was hopeing some one can help

can some one make me a fast script that does this

if $combobox = "On" Then

a gui input appears and the gui box grows a bit to fit it

but if it = "Off" then

the input is hideing and the gui shrinks to fill in the gap

that is really the only way i can explane it


Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times..

Share this post


Link to post
Share on other sites
PsaltyDS

Im new to makein combo box gui things so i was hopeing some one can help

can some one make me a fast script that does this

I hope not, but we'll help you make your own.

if $combobox = "On" Then

a gui input appears and the gui box grows a bit to fit it

but if it = "Off" then

the input is hideing and the gui shrinks to fill in the gap

that is really the only way i can explane it

Start with the example script in the help file under GuiCtrlCreateCombo(). Do you have a basic GUI with the combo box in it yet? Can you read the current selection already?

Next would be the example in the help file for WinMove().

For the input you want the example for GuiCtrlSetState().

Put it all together and you'll have your script. Post your code if get stuck.

Welcome to AutoIt.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
xZZTx

Well i have no idea how todo Gui but this is my code so far

#include <GUIConstants.au3>
Global $a,$p,$n

Call("read") 
GUICreate(" Account Config", 220,210, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018)
GUICtrlCreateLabel("Account Name Here",60,5,200,15)
$account = GUICtrlCreateInput ( $a,10 ,20 , 200, 20)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
GUICtrlCreateLabel("Password Here",72,45,200,15)
$password = GUICtrlCreateInput ($p, 10,  60, 200, 20)
GUICtrlCreateLabel("Character Number",65,85,200,15)
$number = GUICtrlCreateInput ($n, 10,  100, 200, 20)
GUICtrlCreateLabel("Attack #",30,125,80,15)
$attack = GUICtrlCreateCombo("Attack 1", 10, 140,100,30)
GUICtrlSetData(-1, "Attack 2|Attack 3|Attack 4|Attack 5", "Attack 3")
GUICtrlCreateLabel("Game",135,125,80,15)
$que = GUICtrlCreateCombo("Wsg", 110, 140,100,30)
GUICtrlSetData(-1, "Av|Ab|Eots", "Wsg")
$btn = GUICtrlCreateButton ("Save Info", 70, 175, 80, 30)

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
       Case $msg = $btn
                Call("save")
               exitloop
           EndSelect
Wend

Func save()
IniWrite("info.ini","login","account",GUICtrlRead($account))
IniWrite("info.ini","login","password",GUICtrlRead($password))
IniWrite("info.ini","login","number",GUICtrlRead($number))
IniWrite("info.ini","battle","ground",GUICtrlRead($que))
IniWrite("info.ini","battle","attack",GUICtrlRead($attack))
EndFunc

Func read()
    $a = IniRead("info.ini","login","account","") 
    $p = IniRead("info.ini","login","password","") 
    $n = IniRead("info.ini","login","number","") 
EndFunc

Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times..

Share this post


Link to post
Share on other sites
covaks

Just on a side note, not sure if I should post this in another topic or not, maybe Psalty or someone can help me with this? :-)

I tried to do an example, but I'm having problems. Here is my code below:

#include <GuiConstants.au3>

$hWnd = GuiCreate("",150,50)
$hCombo = GUICtrlCreateCombo("",5,5,80)
GUICtrlSetData(-1,"ON|OFF","OFF")
$hInput = GuiCtrlCreateInput("",5,40,100,20)
GUICtrlSetState($hInput,$GUI_HIDE)

GuiSetState()

While 1
    $msg = GuiGetMsg()
    
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hCombo
            If GuiCtrlRead($hCombo) = "ON" Then
                $pos = WinGetPos($hWnd)
                GUICtrlSetState($hInput,$GUI_SHOW)
                Sleep(1000)
                WinMove($hWnd,"",$pos[0],$pos[1],250,200)

            ElseIf GuiCtrlRead($hCombo) = "OFF" Then
                $pos = WinGetPos($hWnd)
                WinMove($hWnd,"",$pos[0],$pos[1],156,87)
                GuiCtrlSetState($hInput,$GUI_HIDE)
            EndIf
    EndSwitch
WEnd

When I do this, When I select "ON" From the combobox, the input box appears, then disappears as soon as the WinMove function is executed. I added a one second delay so you can see it. What happened to the input box? Why does it disappear when I adjust the size of the window?

Share this post


Link to post
Share on other sites
PsaltyDS

Just on a side note, not sure if I should post this in another topic or not, maybe Psalty or someone can help me with this? :-)

I tried to do an example, but I'm having problems. Here is my code below:

When I do this, When I select "ON" From the combobox, the input box appears, then disappears as soon as the WinMove function is executed. I added a one second delay so you can see it. What happened to the input box? Why does it disappear when I adjust the size of the window?

Your input is there, but it gets automatically moved by resizing the window.

Put this right below your creation of the input:

GUICtrlSetResizing(-1, $GUI_DOCKALL)

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
PsaltyDS

Well i have no idea how todo Gui but this is my code so far

1. You don't need Call() to call your fuctions. Just use them like you would any native AutoIt function:
read()

2. Your message loop was a little awkward. Try this:

While 1 
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $btn
            save()
            ExitLoop
    EndSelect
WEnd

Note my reply to covaks about resizing when you add that to your GUI.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.