Jump to content

Unable to create "graphical" button. [SOLVED]


jokke
 Share

Recommended Posts

Take a look at example inn zip file.

Trying basicly to create this:

#include <GUIConstants.au3>

$GUI = GUICreate("Test gui", 120, 50, -1, -1)
GUISetBkColor(0x000000)

$button =   GUICtrlCreateGraphic(10,10,100,22)
            GUICtrlSetColor(-1,0xFFFFFF)
            GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetCursor(-1, 0)
            GUICtrlCreateLabel("Button",43,14,70,15) ;Adding text to "button"
            GUICtrlSetColor(-1,0xFFFFFF)
            GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
            GUICtrlSetCursor(-1, 0)

GUISetState()


While 1
    $nMsg = GUIGetMsg($GUI)
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button
            MsgBox(64,"Click","Button was clicked.")
    EndSwitch
WEnd

Inn a gui skinned with a png file. Proper code, removed tcp functions:

GUI.zip

Edited by jokke
UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

Found a drity trick to make it work.

If anyone ever wonder heres how i did it:

Func LoginGui($server,$connection)
    
    Local $input[2],$timer[3],$lable[1]
    
    $pngSrc = @scriptdir & "\greenwide.png"
    $hImage = _GDIPlus_ImageLoadFromFile($pngSrc)


    $width =  _GDIPlus_ImageGetWidth ($hImage)
    $height = _GDIPlus_ImageGetHeight($hImage)


    $GUI = GUICreate("Login...", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
    SetBitMap($GUI, $hImage, 255)
    
    $button[4] =    GUICtrlCreateGraphic(160,142,100,18) ;Moving grapical buttons to GUI instead of controlGUI
                    GUICtrlSetColor(-1,0xFFFFFF)
                    GUICtrlSetBkColor(-1,0xFFFFFF)
                    GUICtrlSetCursor(-1, 0)
                    
    GUISetState()

    $controlGui = GUICreate("ControlGUI", $width, $height, 0,0,$WS_POPUP,BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
    GUICtrlCreatePic(@ScriptDir & "\grey.gif",0,0,$width,$height)
    GuiCtrlSetState(-1,$GUI_DISABLE)

                    GUICtrlCreateLabel("Username",65,40,60,20)
                    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor(-1,0xFFFFFF)
    $input[0] =     GUICtrlCreateInput("testuser",120,38,120,20)
                    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)

                    GUICtrlCreateLabel("Password",65,70,60,20)
                    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor(-1,0xFFFFFF)
    $input[1] =     GUICtrlCreateInput("password",120,68,120,20,$ES_PASSWORD)
                    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)

    $button[0] =    GUICtrlCreateLabel("Login",55,120,100,18,$SS_SUNKEN+$SS_CENTER   )
                    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor(-1,0xFFFFFF)
                    GUICtrlSetCursor(-1, 0)
                    GUICtrlSetFont(-1,9,600)
                    
    $button[1] =    GUICtrlCreateLabel("Exit",160,120,100,18,$SS_SUNKEN+$SS_CENTER   )
                    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor(-1,0xFFFFFF)
                    GUICtrlSetCursor(-1, 0)
                    GUICtrlSetFont(-1,9,600)
                    
    $button[2] =    GUICtrlCreateLabel("Regiser",55,142,100,18,$SS_SUNKEN+$SS_CENTER   )
                    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor(-1,0xFFFFFF)
                    GUICtrlSetCursor(-1, 0)
                    GUICtrlSetFont(-1,9,600)
                    
    $button[3] =    GUICtrlCreateLabel("Visit us",160,142,100,18,$SS_SUNKEN+$SS_CENTER   )
                    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
                    GUICtrlSetColor(-1,0xFFFFFF)
                    GUICtrlSetCursor(-1, 0)
                    GUICtrlSetFont(-1,9,600)
    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE,$button[1]
                $state = "Exit"
                ExitLoop
            Case $button[4]
                ExitLoop
        EndSwitch
        
    WEnd
    GUIDelete($GUI)
    GUIDelete($controlGui)
    
EndFunc
UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

The result got pretty neat:

Posted Image

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

Its done, new file inn first post.

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

Because, this function is only usable to one "gui" at once. This function is what makes the GUI dragable by its interface.

Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
  if ($hWnd = $GUI) and ($iMsg = $WM_NCHITTEST) then Return $HTCAPTION
EndFunc

Thats why i have declared $GUI as a global at line 11

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
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...