Sign in to follow this  
Followers 0
ajhhanekamp

After background image created buttons dont work

10 posts in this topic

I have created an image and set it as background image but now i cannot click my buttons anymore.... some help would be much appreciated. Thanks in advance.

Share this post


Link to post
Share on other sites



I have created an image and set it as background image but now i cannot click my buttons anymore.... some help would be much appreciated. Thanks in advance.

wild guess: Your background picture is on the foreground.

When you want a more precise answer you will have to show some code.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Amazing how often this gets asked...

( hint, hint )

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You are teasing him too much :-)

from helpfile:

Function GUICtrlCreatePic

If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control : GuiCtrlSetState(-1,$GUI_DISABLE).

Edited by Zedna

Share this post


Link to post
Share on other sites

I was able to put that in but somehow i still can't click any buttons o.O

You are teasing him too much :-)

from helpfile:

Share this post


Link to post
Share on other sites

I was able to put that in but somehow i still can't click any buttons o.O

Did you reply to the first post???

... No, show code and we can help

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Did you reply to the first post???

... No, show code and we can help

8)

Here is my complete code:

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <Sound_Beta.au3>
#include <Sound.au3>


Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $Button_1, $Button_2, $Button_3, $Button_4, $msg, $n
    Local $GUI_DISABLE

     
     GUICreate("Games & Programs Launcher", 800, 600)
     
     HotKeySet("{ESCAPE}", "_Exit")

$vSndID = _SoundOpen("C:\Pangya - carmelldansen.mp3")

While 1
    If _SoundStatus($vSndID) = "stopped" Then _SoundPlay($vSndID)
    Sleep(10)
WEnd

Func _Exit()
    _SoundStop($vSndID)
    Exit
EndFunc

      GuiCtrlCreatePic('C:\Fire.jpg', 0, 0, @Desktopwidth, @DesktopHeight)
     GuiCtrlSetState(1,$GUI_DISABLE)
     
$n = GUICtrlCreatePic("C:\games.jpg", 380, 10, 120, 120)



    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton("Command and Conquer Generals", -480, 15, 170, 50)
    $Button_2 = GUICtrlCreateButton("Command and Conquer Generals Zero: Hour", 140, -50, 220, 50 )
    $Button_3 = GUICtrlCreateButton("NTreev USA Pangya", 110, -50, 120 , 50)
    
    $n = GUICtrlCreatePic("C:\programs.jpg", -490, 30, 300, 100)
    $Button_4 = GUICtrlCreateButton("Microsoft Office Word 2003", -570, 15, 170, 50)
 

     
    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exitloop
            Case $msg = $Button_1
                Run ( "E:\Command and Conquer Generals\generals.exe")

            Case $msg = $Button_2
                Run ( "E:\Command & Conquer Generals Zero Hour\generals.exe")
        
            Case $msg = $Button_3
                Run ( "E:\Ntreev USA\Pangya\update.exe")

            Case $msg = $Button_4
                Run ( "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE")


        EndSelect
    WEnd
EndFunc  

MsgBox(64, 'Notification', 'Games & Programs Launcher will close now')
Exit

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You get caught in the While..wend forever in the Examples Func.

This is your code a little reorganized. Just move the If in the first loop into the second While...Wend loop

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <Sound_Beta.au3>
#include <Sound.au3>


Opt('MustDeclareVars', 1)

Example()

MsgBox(64, 'Notification', 'Games & Programs Launcher will close now')
Exit

Func Example()
    Local $Button_1, $Button_2, $Button_3, $Button_4, $msg, $n
    Local $GUI_DISABLE


    GUICreate("Games & Programs Launcher", 800, 600)

    HotKeySet("{ESCAPE}", "_Exit")

    $vSndID = _SoundOpen("C:\Pangya - carmelldansen.mp3")

    ;While 1
    ;   If _SoundStatus($vSndID) = "stopped" Then _SoundPlay($vSndID)
    ;   Sleep(10)
    ;WEnd


    GUICtrlCreatePic('C:\Fire.jpg', 0, 0, @DesktopWidth, @DesktopHeight)
    GUICtrlSetState(1, $GUI_DISABLE)

    $n = GUICtrlCreatePic("C:\games.jpg", 380, 10, 120, 120)



    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton("Command and Conquer Generals", -480, 15, 170, 50)
    $Button_2 = GUICtrlCreateButton("Command and Conquer Generals Zero: Hour", 140, -50, 220, 50)
    $Button_3 = GUICtrlCreateButton("NTreev USA Pangya", 110, -50, 120, 50)

    $n = GUICtrlCreatePic("C:\programs.jpg", -490, 30, 300, 100)
    $Button_4 = GUICtrlCreateButton("Microsoft Office Word 2003", -570, 15, 170, 50)



    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                Run("E:\Command and Conquer Generals\generals.exe")

            Case $msg = $Button_2
                Run("E:\Command & Conquer Generals Zero Hour\generals.exe")

            Case $msg = $Button_3
                Run("E:\Ntreev USA\Pangya\update.exe")

            Case $msg = $Button_4
                Run("C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE")


        EndSelect
        If _SoundStatus($vSndID) = "stopped" Then _SoundPlay($vSndID)
    WEnd
EndFunc   ;==>Example
Func _Exit()
    _SoundStop($vSndID)
    Exit
EndFunc   ;==>_Exit
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Also change

GUICtrlSetState(1, $GUI_DISABLE)

to

GUICtrlSetState(-1, $GUI_DISABLE)

Also might want to take a look at

Local $GUI_DISABLE

it has no value set.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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