Jump to content

Can't Start Func . with button


Recommended Posts

Hi there, i'm having some weird problem. My function doesn't start when i click on the buttons.

Here is my code...

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ComboConstants.au3>

__steam_window('DiskSakla - by kontinyu', 500, 300) ; WIDTH NOT SMALLER THEN 400 | HEIGHT NOT SMALLER THEN 200 === TRUST ME

Func __steam_window($sWINDOW_TITLE, $iWINDOW_WIDTH, $iWINDOW_HEIGHT)
    Local $oWINDOW = GUICreate($sWINDOW_TITLE, $iWINDOW_WIDTH, $iWINDOW_HEIGHT, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU, $WS_MINIMIZEBOX), $WS_EX_LAYERED) ; BitOR($WS_EX_TOOLWINDOW, $WS_EX_LAYERED))
    GUISetFont(8, 400, 0, 'Tahoma')
    GUISetBkColor(0x494E49)
    GUICtrlCreatePic('hdr.bmp', 0, 0, $iWINDOW_WIDTH - 16, 20, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 16, 0, 11, 5, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 16, 16, 11, 4, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 5, 0, 5, 20, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateGraphic(0, 20, 1, $iWINDOW_HEIGHT)
    GUICtrlSetColor(-1, 0x686A65)
    GUICtrlCreateGraphic($iWINDOW_WIDTH - 1, 20, 1, $iWINDOW_HEIGHT)
    GUICtrlSetColor(-1, 0x686A65)
    GUICtrlCreateGraphic(0, $iWINDOW_HEIGHT - 1, $iWINDOW_WIDTH, 1)
    GUICtrlSetColor(-1, 0x686A65)
    Local $oCLOSE = GUICtrlCreatePic('cls.bmp', $iWINDOW_WIDTH - 16, 5, 11, 11, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    Local $oLABELHEADER = GUICtrlCreateLabel($sWINDOW_TITLE, 6, 0, $iWINDOW_WIDTH - 22, 20, $SS_CENTERIMAGE)
    GUICtrlSetColor(-1, 0xD8DED3)
    GUICtrlSetBkColor(-1, 0x5A6A50)

    #cs ==============================
    EXAMPLE SECTION ==================
    #ce ==============================

    Global $oBUTTON_1 = GUICtrlCreateButton('Gizle', 10, 30, 140, 20)
    GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma')
    GUICtrlSetOnEvent($oBUTTON_1,'Hide')
    Local $oBUTTON_2 = GUICtrlCreateButton('Göster', 10, 60, 140, 20)
    GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma')
    GUICtrlSetOnEvent($oBUTTON_2,'Show')
    Local $oBUTTON_3 = GUICtrlCreateButton('Tümünü Gizle!', 10, 90, 140, 20)
    GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma')
    GUICtrlSetOnEvent($oBUTTON_2,'HideALL')
    Local $oBUTTON_4 = GUICtrlCreateButton('Tümünü Göster!', 10, 120, 140, 20)
    GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma')
    GUICtrlSetOnEvent($oBUTTON_2,'ShowALL')
    #cs


    Local $oBUTTON_5 = GUICtrlCreateButton('Button 5', 10, 150, 140, 20)
    GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma')
    #ce
    GUICtrlCreateGraphic(1, 20, 160, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x464646)
    GUICtrlSetBkColor(-1, 0x464646)
    GUICtrlCreateGraphic(158, 20, 1, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x3D423D)
    GUICtrlCreateGraphic(159, 20, 1, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x424742)
    GUICtrlCreateGraphic(160, 20, 1, $iWINDOW_HEIGHT - 21)
    GUICtrlSetColor(-1, 0x454A45)

    $oLABELTOP = GUICtrlCreateLabel('HardDisk Bölümü:', 180, 31, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE)
    GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma')
    GUICtrlSetColor(-1, 0xC4B550)

    GUICtrlCreateGraphic(170, 51, $iWINDOW_WIDTH - 180, 1)
    GUICtrlSetColor(-1, 0x636763)
#cs
    GUICtrlCreateLabel('combo control', 190, 70, 100, 20, BitOR($SS_RIGHT,$SS_CENTERIMAGE))
    GUICtrlSetColor(-1, 0xE6ECE0)
    GUICtrlCreateCombo('', 300, 70, 200, 20, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, 'Combo Item 1|Combo Item 2|Combo Item 3')

    GUICtrlCreateLabel('input control', 190, 100, 100, 20, BitOR($SS_RIGHT,$SS_CENTERIMAGE))
    GUICtrlSetColor(-1, 0xE6ECE0)
    GUICtrlCreateInput('', 300, 100, 200, 20)
#ce
Global $drives = DriveGetDrive( "all" )
Global $dcount = $drives[0]
    If NOT $drives[$dcount] = "" Then
        $chekbox1 = GUICtrlCreateCheckbox($drives[1],190,70,57,25)
        GUICtrlSetFont($chekbox1,11)

    EndIf
    If $dcount > 1 Then
        $chekbox2 = GUICtrlCreateCheckbox($drives[2],190,100,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 2 Then
        $chekbox3 = GUICtrlCreateCheckbox($drives[3],190,130,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 3 Then
        $chekbox4 = GUICtrlCreateCheckbox($drives[4],190,160,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 4 Then
        $chekbox5 = GUICtrlCreateCheckbox($drives[5],190,190,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 5 Then
        $chekbox6 = GUICtrlCreateCheckbox($drives[6],190,220,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 6 Then
        $chekbox7 = GUICtrlCreateCheckbox($drives[7],190,250,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 7 Then
        $chekbox8 = GUICtrlCreateCheckbox($drives[8],250,70,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 8 Then
        $chekbox9 = GUICtrlCreateCheckbox($drives[9],250,100,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 9 Then
        $chekbox10 = GUICtrlCreateCheckbox($drives[10],250,130,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 10 Then
        $chekbox11 = GUICtrlCreateCheckbox($drives[11],250,160,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 11 Then
        $chekbox12 = GUICtrlCreateCheckbox($drives[12],250,190,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 12 Then
        $chekbox13 = GUICtrlCreateCheckbox($drives[13],250,220,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 13 Then
        $chekbox14 = GUICtrlCreateCheckbox($drives[14],250,250,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 14 Then
        $chekbox15 = GUICtrlCreateCheckbox($drives[15],310,70,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 15 Then
        $chekbox16 = GUICtrlCreateCheckbox($drives[16],310,100,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 16 Then
        $chekbox17 = GUICtrlCreateCheckbox($drives[17],310,130,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 17 Then
        $chekbox18 = GUICtrlCreateCheckbox($drives[18],310,160,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 18 Then
        $chekbox19 = GUICtrlCreateCheckbox($drives[19],310,190,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 19 Then
        $chekbox20 = GUICtrlCreateCheckbox($drives[20],310,220,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 20 Then
        $chekbox21 = GUICtrlCreateCheckbox($drives[21],310,250,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 21 Then
        $chekbox22 = GUICtrlCreateCheckbox($drives[22],370,70,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 22 Then
        $chekbox23 = GUICtrlCreateCheckbox($drives[23],370,100,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 23 Then
        $chekbox24 = GUICtrlCreateCheckbox($drives[24],370,130,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 24 Then
        $chekbox25 = GUICtrlCreateCheckbox($drives[25],370,160,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 25 Then
        $chekbox26 = GUICtrlCreateCheckbox($drives[26],370,190,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    If $dcount > 26 Then
        $chekbox27 = GUICtrlCreateCheckbox($drives[27],370,210,57,25)
        GUICtrlSetFont(-1,11)
    EndIf
    GUICtrlCreateGraphic(170, 30, $iWINDOW_WIDTH - 180, $iWINDOW_HEIGHT - 40) ; THIS CONTROL NEEDS TO BE LAST DUE TO OVERLAY ISSUES
    GUICtrlSetColor(-1, 0x686A65)

    #cs ==============================
    EXAMPLE SECTION ==================
    #ce ==============================

    GUICtrlCreatePic('cnr.bmp', 0, 0, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', $iWINDOW_WIDTH - 1, 0, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', 0, $iWINDOW_HEIGHT - 1, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreatePic('cnr.bmp', $iWINDOW_WIDTH - 1, $iWINDOW_HEIGHT - 1, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG)
    GUISetState(@SW_SHOW)

    While 1

        Local $eMSG = GUIGetMsg()
        Switch $eMSG
            Case $GUI_EVENT_CLOSE
                Local $iWINDOW_TRANS
            For $iWINDOW_TRANS = 255 To 0 Step -10
                If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS)
                Sleep(10)
                Next
                Exit
            Case $oCLOSE
                Local $iWINDOW_TRANS
                For $iWINDOW_TRANS = 255 To 0 Step -10
                    If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS)
                    Sleep(10)
                Next
                Exit
        EndSwitch
    WEnd
EndFunc
#cs
        $PID = ProcessExists("explorer.exe") ; Will return the PID or 0 if the process isn't found.
        If $PID Then ProcessClose($PID)
        Run("explorer.exe")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer","NoDrives","REG_DWORD",4)
    If @error Then
        MsgBox(0,"aaa",@error)
        EndIf
        #ce
Func Hide()

    MsgBox(0,"aa","hideok")

        EndFunc
Func Show()
    MsgBox(0,"aa","hideok")
EndFunc
Func HideALL()
    MsgBox(0,"aa","hideok")
        EndFunc
Func ShowALL()
    MsgBox(0,"aa","hideok")
        EndFunc

I can't see the problem... But i'm sure someone will :mellow:. Also if there is any way to make creating checkboxes action simple plz warn me!

Link to comment
Share on other sites

  • Moderators

continyu,

This is becoming an epidemic - I must have said this 3 times this week already! :mellow:

You are mixing OnEvent and GetMessage modes in your script - you should only have one or the other. Switching modes in mid-script is fraught with danger and should only be attempted in exceptional circumstances - and then alarm bells should be going off asking why the circumstances are so exceptional and whether you would be better recasting your code.

So go away and rewrite your using one or other of the GUI modes - but not both at the same time! :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...