Jump to content

Unable to select buttons after adding background picture.


Recommended Posts

#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

Link to comment
Share on other sites

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!"
Link to comment
Share on other sites

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!"
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 1 month later...

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?

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