Jump to content
Sign in to follow this  
Drew

Question - Buttons...

Recommended Posts

Drew

Alright. I'm trying to put some buttons on my GUI. Thats cool and all but...

When testing the form , I can't PRESS the buttons. They show up , their there , blah... But I can't press them. I was thinking maybe this was because the buttons don't have anything assigned to them yet...

So I assigned a simple MsgBox to pop up when its pressed like this:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            MsgBox( 0, "Yep", "Works")
    EndSwitch
WEnd

Unless I assigned the button wrong, dont think I did, I can't understand why I cannot press the button. Because the button doesn't sink in , what normally happens when you press a button... nor does it trigger the MsgBox.

Help Please =(

Share this post


Link to post
Share on other sites
Valuater

That should work fine, show us the GUI/Button creations

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
GEOSoft

Do you happen to have GUIOnEventMode 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
Drew

Alright. Through trial and error I've come to the conclusion your not able to have a button on top of a pic?

Well , I resized the pic and moved the buttons off , just changing the color of the form to black ( to match the background of the pic ) so visually theres no difference.

HOWEVER... Now I can't make my buttons black. The color of the text changes fine , olive or w/e , but I want the button itself to be black. And It won't work.

Someone once said something about it being XP and having to have something with it? Idk. They didn't elaborate much.

Here's my GUI script: More info on what on I'm trying to do will follow it

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

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 476, 513, 204, 122)
GUISetBkColor(0x000000)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Dreu\Desktop\GUI_Images\Skull.JPG", 8, 0, 481, 401, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("D2War Installer V1.0.0", 16, 480, 166, 25)
GUICtrlSetFont(-1, 12, 800, 2, "Palatino Linotype")
GUICtrlSetColor(-1, 0x808000)
$Label2 = GUICtrlCreateLabel("By: Dreu ( Aka Veteran )", 288, 480, 177, 25)
GUICtrlSetFont(-1, 12, 800, 2, "Palatino Linotype")
GUICtrlSetColor(-1, 0x808000)
$ReadMe = GUICtrlCreateButton("Read Me", 192, 416, 113, 25, 0)
GUICtrlSetFont(-1, 10, 800, 2, "Palatino Linotype")
GUICtrlSetColor(-1, 0x808000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ReadMe
            MsgBox( 0, "Yep", "Works")
    EndSwitch
WEnd

You'll can't see my image because you'll don't have the .bmp , but it takes up the upper 4/5's of the GUI. The buttons will make up the bottom fifth of the frame.

I have the background set to black , and I want my buttons black too. I want the text on them olive. I've got a STATICEDGE on the buttons that make them look pretty cool. But one problem , after doing all those options to the buttons.

THE BUTTONS WONT TURN BLACK >.<

Maybe you can't have black buttons on a black background? Idk. I'm running out of troubleshooting ideas. Please help if you can. Thanks,

Share this post


Link to post
Share on other sites
flip209

Add after the button GUICtrlSetbkColor(-1, 0x808000)

Edited by flip209

" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Share this post


Link to post
Share on other sites
Drew

Wewt. Your example worked perfectly ( except 0x808000 = olive , I needed black )

But by putting the wrong color I had to take the time to learn WHY I had to do that NOT just copy and paste.

Thank you for your time and help :D

Share this post


Link to post
Share on other sites
AdmiralAlkex

If you want to have a picture as a background you must disable it, or else all clicks go to the picture!!

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites
Pain

Wewt. Your example worked perfectly ( except 0x808000 = olive , I needed black )

But by putting the wrong color I had to take the time to learn WHY I had to do that NOT just copy and paste.

Thank you for your time and help :D

black = 0x000000

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  

×