Sign in to follow this  
Followers 0
rambo3889

Gui problem with buttons.

12 posts in this topic

Hey guys.

My problem is my Gui where i have a main gui and a small gui where a user can search for ip. But before i can get that to work ill need to get a button to work which work like this = User presses the buttons a msgbox comes up and ask a question and wait until the question have been answered, But the problem is that when i press the button ABSOLUTE nothing happens and i dont know why the heck nothing happens because i have a loop with messages and the button is in that Select Statement, Not sure why nothing happens i hope anybody can help me

Code:

#include <GUIconstants.au3>

Opt("TrayMenuMode", 1)
#region TheGuis
$title = "Blah"

$maingui = GUICreate($title, 600, 550, -1, -1, -1)
$pos=WinGetPos($maingui,"")
$hideAbout = GUICtrlCreateButton("Hide About", 30, 50, 90, 25)
$ShowAbout = GUICtrlCreateButton("Show About", 30, 85, 90, 25)
GUICtrlCreateGroup('Slide options',30,120,95,70)
$slideoption=GUICtrlCreateButton('Enable',32,140,90)
$hidesearch=GUICtrlCreateButton("Hide search ips",130,50,90,25)
$showsearch=GUICtrlCreateButton("Show search ips",130,85,90,25)
GUISetState(@SW_SHOW)
$searchipgui=GUICreate("Ip search", 300, 275, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUICtrlCreateLabel("Ip: (without last numbers)",0,0,125)
$searchipip=GUICtrlCreateInput(@IPAddress1,125,0,90,20)
GUICtrlCreateLabel("Port number:",0,25,75,20)
$searchipport=GUICtrlCreateInput("666",75,25,75,20)
GUICtrlCreateLabel("From:",0,50,25)
GUICtrlCreateLabel("To:",85,50,20)
$123=GUICtrlCreateButton("Search",0,80,90,20);THIS IS THE BUTTON THAT I TALK ABOUT
$searchstartnr=GUICtrlCreateInput("",30,50,50,20)
$searchendnr=GUICtrlCreateInput("",105,50,50,20)
$searchedipsinfo=GUICtrlCreateListView("Ip|Computername|Username",0,100,300,150)

$searchstatus=GUICtrlCreateLabel("Status..",0,250,300,20,$SS_SUNKEN)
WinMove($searchipgui, "",$pos[0]-300,$pos[1]+25,300)
GUISetState(@SW_HIDE)

TrayCreateItem("")
$showitem = TrayCreateItem("Show")
$exititem = TrayCreateItem("Exit")
TraySetState()

While 1

    $msg = GUIGetMsg()
    $traymsg = TrayGetMsg()
    Switch $traymsg
    Case $showitem
            
            $pos=WinGetPos($title,'')
            MouseMove($pos[0]+200,$pos[1]+100)
            DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $maingui, "int", 500, "long", 0x00040001 )
            WinActivate($title, "")
            
        Case $exititem
            Exit
    EndSwitch

    Select
        
    Case $msg=$123
        ;*****************************************************
        ;WHY THE HECK ISNT THIS CODE Called, i think it should
        ;Why doesnt this come up??
        $askforsearch=MsgBox(4,"Warning!","By searching the net for computers which you can connect to will cause the program to disconnect from you currently connected server Press yes if you still want to search or no to stop the search and reamain    connected")
        if $askforsearch=6 then ;The user wants to search 

    EndIf   
    if $askforsearch = 7 Then
        MsgBox(0,"Fine.","okay the connection have not been terminated")
    EndIf
    ;End of code problem
    ;***********************************************************
Case  $msg=$slideoption
        if GUICtrlRead($slideoption) = 'Disable' Then
        _setslide(1)
        GUICtrlSetData($slideoption,'Enable')
        Else
        _setslide()
        GUICtrlSetData($slideoption,'Disable')
    EndIf
Case  $msg=$showsearch
    _searchgui(1)
Case  $msg=$hidesearch
    _searchgui(0)
Case $msg= $GUI_EVENT_CLOSE
    Exit
    EndSelect
WEnd
TCPShutdown()

Func _setslide($disableorenable=0)
if $disableorenable=1 Then;Disable it
AdlibDisable()
EndIf
If $disableorenable=0 Then
AdlibEnable('_slideleft')
EndIf
EndFunc

Func _slideleft()
;This function is the function which slides the gi away if it is adlib enabled
$mousepos=MouseGetPos()
$pos=WinGetPos($title,'')
if $mousepos[0] < $pos[0] Then
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $maingui, "int", 500, "long", 0x00050002)
EndIf
if $mousepos[0] >  $pos[0]+$pos[2] Then
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $maingui, "int", 500, "long", 0x00050002)
EndIf
if $mousepos[1] < $pos[1] Then
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $maingui, "int", 500, "long", 0x00050002)
EndIf
if $mousepos[1] > $pos[1]+$pos[3] Then
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $maingui, "int", 500, "long", 0x00050002)
EndIf
if $mousepos[0]=0 and $mousepos[1]=0 Then
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $maingui, "int", 200, "long", 0x00040001 )
MouseMove($pos[0]+200,$pos[1]+100,0)
EndIf
EndFunc


Func _searchgui($way = 0)
    $pos = WinGetPos($maingui)
    If $way = 1 Then ;SHOW
        WinMove($searchipgui, "",$pos[0]-300,$pos[1]+25,300)
        DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $searchipgui, "int", 1, "long", 0x00090000 );AWAY
        DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $searchipgui, "int", 400, "long", 0x00040002 )
    EndIf
    If $way = 0 Then;HIDE
        WinMove($searchipgui, "",$pos[0]-300,$pos[1]+25,300)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $searchipgui, "int", 400, "long", 0x00050002)
    EndIf
EndFunc

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites



Um try this. No grarentees or anything that it'll work.

While 1
    $msg = GUIGetMsg()
    $traymsg = TrayGetMsg()
    Switch $traymsg
        Case $showitem
            $pos=WinGetPos($title,'')
            MouseMove($pos[0]+200,$pos[1]+100)
            DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $maingui, "int", 500, "long", 0x00040001 )
            WinActivate($title, "")
        Case $exititem
            Exit
    EndSwitch
       
        Case $msg=$123
            $askforsearch=MsgBox(4,"Warning!","By searching the net for computers which you can connect to will cause the program to disconnect from you currently connected server Press yes if you still want to search or no to stop the search and reamain    connected")
            if $askforsearch=6 then ;The user wants to search 
            EndIf   
            if $askforsearch = 7 Then
            MsgBox(0,"Fine.","okay the connection have not been terminated")
            EndIf
        Case $msg=$slideoption
            if GUICtrlRead($slideoption) = 'Disable' Then
            _setslide(1)
            GUICtrlSetData($slideoption,'Enable')
            Else
            _setslide()
            GUICtrlSetData($slideoption,'Disable')
            EndIf
        Case  $msg=$showsearch
            _searchgui(1)
        Case  $msg=$hidesearch
            _searchgui(0)
        Case $msg= $GUI_EVENT_CLOSE
        Exit
    EndSelect
WEnd

I didn't test it.

BTW whats end switch? Is it a udf? or something in beta??

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The endswitch and Switch are another way to check something but it is shorter for a whole Gui loop

Thanks for you try but i it didnt work :lmao:

Edited by rambo3889

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

Bump ,anyone got a answer? or couuld help


My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

yea... i worked hard on this one.... but i got it

Func _searchgui($way = 0)
    $pos = WinGetPos($maingui)
    If $way = 1 Then ;SHOW
        WinMove($searchipgui, "",$pos[0]-300,$pos[1]+25,300)
        DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $searchipgui, "int", 1, "long", 0x00090000 );AWAY
        DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $searchipgui, "int", 400, "long", 0x00040002 )
        GUISetState( @SW_SHOW,  $searchipgui)
    EndIf
    If $way = 0 Then;HIDE
        WinMove($searchipgui, "",$pos[0]-300,$pos[1]+25,300)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $searchipgui, "int", 400, "long", 0x00050002)
    EndIf
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

@Valuater Thank you Valuater ..Thank you Valuater. Glad somebody could help me

could you please tell me the problem? My guess is " Is it did Guisetstate" Which get it working ??


My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

@Valuater Thank you Valuater ..Thank you Valuater. Glad somebody could help me

could you please tell me the problem? My guess is " Is it did Guisetstate" Which get it working ??

Welcome...

.... yepper twas "Guisetstate"

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

[angry]

:lmao::ph34r::geek: <-- That is me!

[/angry]


My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

No... i almost removed "EVERYTHING" and then finally found the problem, so it wasn't easy for me either

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Okay thanks for i could borrow your time, How did you find out that it was a guisetstate problem?


My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Okay thanks for i could borrow your time, How did you find out that it was a guisetstate problem?

like i said... i just started removing anythng ( controls, labels... everything ) that had NOTHING to do with the problem... then when i narrowed it down to the dllcall to slide, it wouldn't work... so i just tried GUISetState and it worked

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Okay i understand now


My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

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  
Followers 0