Jump to content

Recommended Posts

Posted (edited)

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
Posted

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

Posted

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)

Posted

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

Posted

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!

Posted

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

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...