Jump to content

Help with GUI Tabs/Buttons~


Recommended Posts

I have looked everywere for help to try and fix this problem but cant seem to find how to fix it. When I start my app the buttons mess up. A ghost image stay on the other tabs dont really know why. Anyways heres the code try it out and see for your self.

;Script By: Possessed.no-ip.org
;The Server~ Version 0.1
;------------------------
;GUI stuff
#include <Inet.au3>
#include <GUIConstants.au3>
;preload stuff
$getip = _GetIP()
$g_IP = "127.0.0.1"
$font="Lucida Console"

GUICreate("Possessed Portal", 300, 480)
GUISetBkColor(0x000000)
$output = GUICtrlCreateEdit('**************************Console V1.0***************************' & @CRLF, 0, 270, 300, 210, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY, $WS_EX_STATICEDGE)
GUICtrlSetFont (-1,7, 400, $font)
$font="Lucida Console"
$tab=GUICtrlCreateTab (0,0, 300,270)

$tab0=GUICtrlCreateTabitem ("Settings")
$tab0input=GUICtrlCreateInput ("", 130,40,70,20,$ES_NUMBER)
GUICtrlSetTip(-1,"Enter a Port number.")
$tabbutton1=GUICtrlCreateButton ("Start TCPListen", 10,40,100,20)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetCursor($tabbutton1, 0)
GUISetState(@SW_SHOW)


$tab1=GUICtrlCreateTabitem ("Options")


$tab2=GUICtrlCreateTabitem ("Commands")


$tab3=GUICtrlCreateTabitem ("Tools")
$Button1 = GUICtrlCreateButton('Ping', 10, 40, 80, 20, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetCursor($Button1, 0)
GUISetState(@SW_SHOW)

$Button2 = GUICtrlCreateButton('Netstat -n', 10, 65, 80, 20, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetCursor($Button2, 0)
GUISetState(@SW_SHOW)

$Button3= GUICtrlCreateButton('Return IP', 10, 90, 80, 20, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetCursor($Button3, 0)
GUISetState(@SW_SHOW)



;Handling the GUI
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE;Exit form GUI
            ExitLoop
        Case $msg = $Button1
            GUICtrlSetData($output, GUICtrlRead($output) & Return_ping() & @CRLF)
        Case $msg = $tabbutton1
                GUICtrlSetData($output,GUICtrlRead($output) &  & @CRLF)
        Case $msg = $Button2
                GUICtrlSetData($output, GUICtrlRead($output) & Return_Netstats() & @CRLF)
        Case $msg = $Button3
                GUICtrlSetData($output, GUICtrlRead($output) & Return_IP () & @CRLF)
        Case Else
           ; Something else
    EndSelect
WEnd
;My Func's
Func Return_ping()
    Local $iPID = Run(@ComSpec & ' /c ping ' & $getip & ' -n 1', '', @SW_HIDE, 2), $sHold = ''
    While Not @error
        $sHold &= StdoutRead($iPID)
    WEnd
    Return $sHold
EndFunc  ;==>Return_ping

Func Return_Netstats()
    Local $netID = Run(@ComSpec & ' /c netstat ' & ' -n', '', @SW_HIDE, 2), $sHold1 = ''
    While Not @error
        $sHold1 &= StdoutRead($netID)
    WEnd
    Return $sHold1
EndFunc  ;==>Return_nestat -n info

Func Return_IP ()
  $IP = _GetIP()
  Return $IP
EndFunc  ;==>Return_Ip info
Link to comment
Share on other sites

  • Moderators
CODE
;Script By: Possessed.no-ip.org
;The Server~ Version 0.1
;------------------------
;GUI stuff
#include <Inet.au3>
#include <GUIConstants.au3>
;preload stuff
$getip = _GetIP()
$g_IP = "127.0.0.1"
$font="Lucida Console"

$gui = GUICreate("Possessed Portal", 300, 480)
GUISetBkColor(0x000000)
$output = GUICtrlCreateEdit('**************************Console V1.0***************************' & @CRLF, 0, 270, 300, 210, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY, $WS_EX_STATICEDGE)
GUICtrlSetFont (-1,7, 400, $font)
$font="Lucida Console"
$tab=GUICtrlCreateTab (0,0, 300,270)

$tab0=GUICtrlCreateTabitem ("Settings")
$tab0input=GUICtrlCreateInput ("", 130,40,70,20,$ES_NUMBER)
GUICtrlSetTip(-1,"Enter a Port number.")
$tabbutton1=GUICtrlCreateButton ("Start TCPListen", 10,40,100,20)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetCursor($tabbutton1, 0)

$tab1=GUICtrlCreateTabitem ("Options")

$tab2=GUICtrlCreateTabitem ("Commands")

$tab3=GUICtrlCreateTabitem ("Tools")
$Button1 = GUICtrlCreateButton('Ping', 10, 40, 80, 20, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetCursor($Button1, 0)

$Button2 = GUICtrlCreateButton('Netstat -n', 10, 65, 80, 20, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetCursor($Button2, 0)

$Button3= GUICtrlCreateButton('Return IP', 10, 90, 80, 20, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Lucida Console")
GUICtrlSetCursor($Button3, 0)
GUICtrlCreateTabItem('')

GUISetState(@SW_SHOW)

;Handling the GUI
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE;Exit form GUI
            ExitLoop
        Case $msg = $Button1
            GUICtrlSetData($output, GUICtrlRead($output) & Return_ping() & @CRLF)
        Case $msg = $tabbutton1
                GUICtrlSetData($output,GUICtrlRead($output) &  & @CRLF)
        Case $msg = $Button2
                GUICtrlSetData($output, GUICtrlRead($output) & Return_Netstats() & @CRLF)
        Case $msg = $Button3
                GUICtrlSetData($output, GUICtrlRead($output) & Return_IP () & @CRLF)
        Case Else
           ; Something else
    EndSelect
WEnd
;My Func's
Func Return_ping()
    Local $iPID = Run(@ComSpec & ' /c ping ' & $getip & ' -n 1', '', @SW_HIDE, 2), $sHold = ''
    While Not @error
        $sHold &= StdoutRead($iPID)
    WEnd
    Return $sHold
EndFunc  ;==>Return_ping

Func Return_Netstats()
    Local $netID = Run(@ComSpec & ' /c netstat ' & ' -n', '', @SW_HIDE, 2), $sHold1 = ''
    While Not @error
        $sHold1 &= StdoutRead($netID)
    WEnd
    Return $sHold1
EndFunc  ;==>Return_nestat -n info

Func Return_IP ()
  $IP = _GetIP()
  Return $IP
EndFunc  ;==>Return_Ip info

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Its been doing that befor i put all that in and even tryed moving it. Still "ghosts" the buttons ????

The script I posted ran fine for me.... the one you posted was all over the place with a ton of GUISetState() (You only need one) and you didn't close the tab items.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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

  • Recently Browsing   0 members

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