Jump to content
Sign in to follow this  
thetwistedpanda

Unable to select buttons after adding background picture.

Recommended Posts

thetwistedpanda

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

$CtrlTrigger = -1;
$AltTrigger = -1;

$GUI = GUICreate("Panda's 'Toggle Program'", 354, 500, "")

$B1 = GUICtrlCreateButton("Start", 260, 110, 65, 25);
$B2 = GUICtrlCreateButton("Stop", 260, 140, 65, 25);
$B3 = GUICtrlCreateButton("Close", 260, 170, 65, 25);

GUICtrlCreatePic("00001475-n.jpg", 0, 0, 354, 500)

GUISetState()

GUISetOnEvent($GUI_EVENT_CLOSE, "QuitProgram")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "")
GUISetOnEvent($B1, "StartProgram")
GUISetOnEvent($B2, "StopProgram")
GUISetOnEvent($B3, "QuitProgram")

While 1
    Sleep(1000)
WEnd

Func StartProgram()
    if(WinExists("Guild Wars")) Then
        $CtrlTrigger = 1;
        $AltTrigger = 1;
        DoBind()
        TrayTip("Guild Wars : Toggle", "Program Enabled", 5);
    Else
        MsgBox(4096, "Error", "Guild Wars must be open for this program to run")
    EndIf
EndFunc

Func StopProgram()
    if(WinExists("Guild Wars")) Then
        $CtrlTrigger = -1;
        $AltTrigger = -1;
        StopBind()
        TrayTip("Guild Wars : Toggle", "Program Disabled", 5);
    Else
        MsgBox(4096, "Error", "Guild Wars must be open for this program to run")    
    EndIf
EndFunc

Func QuitProgram()
    $CtrlTrigger = "";
    $AltTrigger = "";
    Exit
EndFunc

Func DoBind()
    HotKeySet(",", "BindControl")
    HotKeySet(".", "BindAlt")
EndFunc

Func StopBind()
    HotKeySet(",", "")
    HotKeySet(".", "")  
EndFunc
        
Func BindControl()
    If WinActive("Guild Wars") Then
        If $CtrlTrigger = 1 Then
            Send("{CTRLDOWN}")
        Else
            Send("{CTRLUP}")
        EndIf
    EndIf
EndFunc

Func BindAlt()
    If WinActive("Guild Wars") Then
        If $AltTrigger = 1 Then
            Send("{ALTDOWN}")
        Else
            Send("{ALTUP}")
        EndIf
    EndIf   
EndFunc

Func BindBreak()
    $CtrlTrigger = -1;
    $AltTrigger = -1;
EndFunc

I just started working on a key toggling program for a game I play and it seemed to work relatively okay until I decided to convert it into a GUI. I've done several things such as the above code for various games without problems, but for some reason this GUI is being a pain, but I'm pretty sure I know why.

The program works fine without the use of "GUICtrlCreatePic("00001475-n.jpg", 0, 0, 354, 500)". The picture seems to take priority over my GUI buttons and I can find no way to take that priority away. Are there any easy methods for allowing me to click my buttons (other than removing the GUI, as well as tab / space combo)?

Thanks,

Panda.

post-13536-1178318666_thumb.jpg

Share this post


Link to post
Share on other sites
gsb

I really have no clue, but did you try moving the image:

GUICtrlCreatePic("00001475-n.jpg", 0, 0, 354, 500)

...above (in the code) the buttons?

$GUI = GUICreate("Panda's 'Toggle Program'", 354, 500, "")

GUICtrlCreatePic("00001475-n.jpg", 0, 0, 354, 500)

$B1 = GUICtrlCreateButton("Start", 260, 110, 65, 25)

$B2 = GUICtrlCreateButton("Stop", 260, 140, 65, 25)

$B3 = GUICtrlCreateButton("Close", 260, 170, 65, 25)

GUISetState()

gsb


"Did you ever stop to think? ...and forget to restart!"

Share this post


Link to post
Share on other sites
thetwistedpanda

Yeah, that's how I had it originally and it didn't work. The only thing with having the picture after the buttons seems to do is hide them until a mouse hover.

Edited by thetwistedpanda

Share this post


Link to post
Share on other sites
gsb

It is GUICtrlSetOnEvent() as in:

GUICtrlSetOnEvent($B1, "StartProgram")

GUICtrlSetOnEvent($B2, "StopProgram")

GUICtrlSetOnEvent($B3, "QuitProgram")

...not

GUISetOnEvent($B1, "StartProgram")

GUISetOnEvent($B2, "StopProgram")

GUISetOnEvent($B3, "QuitProgram")

gsb


"Did you ever stop to think? ...and forget to restart!"

Share this post


Link to post
Share on other sites
thetwistedpanda

Nope still doesn't work. GUISetOnEvent / GUICtrlSetOnEvent both work on the buttons though, just doesn't help my GUI problem T_T. Thanks for trying though.

Share this post


Link to post
Share on other sites
daslick

Disable the background picture so it doesn't cover your controls.

Share this post


Link to post
Share on other sites
thetwistedpanda

That's the obvious answer that I'm trying to get around from having to do. I want to have a picture on my GUI and I've done it before on several other programs. For some reason this one seems to be covering my buttons though.

Share this post


Link to post
Share on other sites
Valuater

Disable the background picture so it doesn't cover your controls.

Like he said!!!

it will work

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
thetwistedpanda

I know it works without a background - I came here looking for a way to make it work WITH a background.

Edited by thetwistedpanda

Share this post


Link to post
Share on other sites
Valuater

I know it works without a background - I came here looking for a way to make it work WITH a background.

I Know That!!!

OK.... It will work WITH the background

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
daslick

Disabling the picture will only disable the control... so that it doesn't cover the other controls. You will still see it.

Try it.

Share this post


Link to post
Share on other sites
Vindicator209

GUICtrlSetState("control",@SW_DISABLE)

=D


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites
Gyzmok

In your code, it should look like this :

...
GUICtrlCreatePic("00001475-n.jpg", 0, 0, 354, 500)
GuiCtrlSetState(-1,$GUI_DISABLE) ; <----------------------------- Just add this

;and move the create button code AFTER the create picture code 
$B1 = GUICtrlCreateButton("Start", 260, 110, 65, 25);
$B2 = GUICtrlCreateButton("Stop", 260, 140, 65, 25);
$B3 = GUICtrlCreateButton("Close", 260, 170, 65, 25);
...

D2charkeeper = No more 'expired characters' in D2.File Date Changer = Change the file date(s), attributes and the filename case of multiple files @ once.Updater_full = Copy/Update your autoitscripts, pictures, .mp3, .avi etc ... subdirs from your PC to your memory stick or to your external harddisk. Now with scheduling and logging.Questmapper

Share this post


Link to post
Share on other sites
Horadrim

The image still covers the controls. I have another, simple idea, which I`m sure t`would work. Why dont you just slice the image on smaller images and not positionate them on the gui and just leaving space for the controls?

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  

×