Jump to content
Sign in to follow this  
Kudzu309

Label "covering up" button

Recommended Posts

Kudzu309

Hi,

I've created a window that I would like to be solid red with a message and a button to click to view a log file.

GUICreate ("program",300,200,-1,-1,$WS_SYSMENU)
GUICtrlCreateLabel (@LF & "Program FAILED.",1,1,300,200,$SS_CENTER)
GUICtrlSetFont (-1,20)
GUICtrlSetColor (-1,0xffffff)
GUICtrlSetBkColor (-1,0xff0000)
$ViewLog = GUICtrlCreateButton ("View Log",130,125,-1,-1,-1)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $ViewLog then
      RunWait(@ComSpec & " /c notepad c:\logfile.log", "", @SW_HIDE)
      ExitLoop
    EndIf
Wend

The problem is that the label seems to "cover up" the button so that I can't click on it, even though it's completely visible. I found this out by decreasing the size of the label until it was above the button and then I could click on it.

I also tried putting GUICtrlCreateButton before GUICtrlCreateLabel, which even made is stranger; the button wasn't visible until the mouse was over it, and then it became visable and clickable. Very weird.

Is there a different way to make the window red? Is there a way to force the button to be "on top" of the label so it's clickable?

Thanks.

Edited by Kudzu309

Share this post


Link to post
Share on other sites
Valuater

maybe this

#include <GuiConstants.au3>
GUICreate ("program",300,200,-1,-1,$WS_SYSMENU)
GUISetBkColor (0xff0000)
GUICtrlCreateLabel ("Program FAILED.",15,25,250,30,$SS_CENTER)
GUICtrlSetFont (-1,20)
GUICtrlSetColor (-1,0xffffff)
;GUICtrlSetBkColor (-1,0xff0000)
$ViewLog = GUICtrlCreateButton ("View Log",130,125,-1,-1,-1)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $ViewLog then
      RunWait(@ComSpec & " /c notepad c:\logfile.log", "", @SW_HIDE)
      ExitLoop
    EndIf
Wend

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Kudzu309

Thanks Valuater, but I had copied the code of that out of a larger script that I had written, that does have #include <GuiConstants.au3> in the beginning, so unfortunately that's not the problem, but thanks for your reply.

maybe this

#include <GuiConstants.au3>
...

8)

Share this post


Link to post
Share on other sites
Valuater

Thanks Valuater, but I had copied the code of that out of a larger script that I had written, that does have #include <GuiConstants.au3> in the beginning, so unfortunately that's not the problem, but thanks for your reply.

that include was for me and had very little to do with the changes i made... so

copy the script i wrote and check it out

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Kudzu309

that include was for me and had very little to do with the changes i made... so

copy the script i wrote and check it out

8)

Oops, I guess that I didn't look at it closely enough (sorry, was in a hurry at the time). Somehow I never saw AutoIt's GUISetBkColor function and was using GUICtrlSetBkColor instead to color the labels. Thanks again for your help!

Share this post


Link to post
Share on other sites
foggw

I beat my head against the wall the other day with the same problem.

Quick check where the label is by adding $SS_SUNKEN to it's style.

Bill

Share this post


Link to post
Share on other sites
Kudzu309

I beat my head against the wall the other day with the same problem.

Quick check where the label is by adding $SS_SUNKEN to it's style.

Bill

Ahh, thanks for the tip. I was using the AutoIt Window Info to outline the peices of the window.

Steve

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.