Sign in to follow this  
Followers 0
Tasmania

Today must be a bad day for me... GUICtrlSetColor

14 posts in this topic

You know, I must be really bad at AutoIt or something :)

#Region ### START Koda GUI section ### Form=c:\documents and settings\uspjefe\desktop\projects\frmconfirm.kxf
   $frmConfirm = GUICreate("Syte Line Automation - Please Confirm", 411, 535, -1, -1)
   $lblHeader = GUICtrlCreateLabel("The following information is going to automatically be filled in. Please confirm this.", 0, 0, 410, 17, $SS_CENTER)
   $lblAttn2 = GUICtrlCreateLabel("Attn:", 8, 32, 26, 17)
   $txtAttn2= GUICtrlCreateInput($attn, 88, 32, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblEmail2 = GUICtrlCreateLabel("Email:", 8, 56, 32, 17)
   $txtEmail2 = GUICtrlCreateInput($email, 88, 56, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPwo2 = GUICtrlCreateLabel("PWO #:", 8, 80, 43, 17)
   $txtPwo2 = GUICtrlCreateInput($pwo, 88, 80, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblInum2 = GUICtrlCreateLabel("Full Item #:", 8, 104, 56, 17)
   $txtInum2 = GUICtrlCreateInput($inum, 88, 104, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblDesc2 = GUICtrlCreateLabel("Desc:", 8, 128, 32, 17)
   $edtDesc2 = GUICtrlCreateEdit($desc, 88, 128, 121, 41, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL))
   $lblRqstDate2 = GUICtrlCreateLabel("Request Date:", 8, 176, 73, 17)
   $txtRqstDate2 = GUICtrlCreateInput($date, 88, 176, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblType2 = GUICtrlCreateLabel("Type:", 8, 200, 31, 17)
   $txtType2 = GUICtrlCreateInput($type, 88, 200, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPcode2 = GUICtrlCreateLabel("Product Code:", 8, 224, 72, 17)
   $txtPcode2 = GUICtrlCreateInput($pcode, 88, 224, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPO2 = GUICtrlCreateLabel("PO #:", 224, 32, 32, 17)
   $txtPO2 = GUICtrlCreateInput($ponum, 280, 32, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPOamt2 = GUICtrlCreateLabel("PO Amt:", 224, 56, 43, 17)
   $txtPOamt2 = GUICtrlCreateInput($poamt, 280, 56, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPOdisc2 = GUICtrlCreateLabel("PO Disc:", 224, 80, 46, 17)
   $txtPOdisc2 = GUICtrlCreateInput($podisc, 280, 80, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPE2 = GUICtrlCreateLabel("Proj. Enj:", 224, 104, 46, 17)
   $txtPE2 = GUICtrlCreateInput($pe, 280, 104, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblPM2 = GUICtrlCreateLabel("Proj. Mngr:", 224, 128, 55, 17)
   $txtPM2 = GUICtrlCreateInput($pm, 280, 128, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblCharge2 = GUICtrlCreateLabel("Charge:", 224, 152, 41, 17)
   $txtCharge2 = GUICtrlCreateInput($charge, 280, 152, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblQty2 = GUICtrlCreateLabel("Qty:", 224, 176, 23, 17)
   $txtQty2 = GUICtrlCreateInput($qty, 280, 176, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblMat2 = GUICtrlCreateLabel("Material:", 224, 200, 44, 17)
   $txtMat2 = GUICtrlCreateInput($material, 280, 200, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblGauge2 = GUICtrlCreateLabel("Gauge:", 224, 224, 39, 17)
   $txtGauge2 = GUICtrlCreateInput($gauge, 280, 224, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $lblExNotes2 = GUICtrlCreateLabel("Extra Notes:", 8, 296, 62, 17)
   $edtExNotes2 = GUICtrlCreateEdit($exnotes, 8, 320, 393, 89, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL))
   $btnRun2 = GUICtrlCreateButton("&Run", 328, 440, 75, 25, $BS_DEFPUSHBUTTON)
   $btnBack2 = GUICtrlCreateButton("&Back", 328, 472, 75, 25, 0)
   $btnExit2 = GUICtrlCreateButton("E&xit", 328, 504, 75, 25, 0)
   $lblBicNotes2 = GUICtrlCreateLabel("BIC Notes:", 8, 248, 55, 17)
   $txtBicNotes2 = GUICtrlCreateInput($bicnotes_r, 88, 248, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $chkDup2 = GUICtrlCreateCheckbox("Duplicate Of", 224, 248, 81, 17, BitOR($BS_CHECKBOX,$WS_TABSTOP))
   GUICtrlSetState(-1, $GUI_DISABLE)
   $chkCom2 = GUICtrlCreateCheckbox("Common To", 320, 248, 81, 17)
   GUICtrlSetState(-1, $GUI_DISABLE)
   $lblCID2 = GUICtrlCreateLabel("Cust. Itm. Dsc:", 8, 272, 73, 17)
   $txtCID2 = GUICtrlCreateInput($cid, 88, 272, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
   $edtConsisting2 = GUICtrlCreateEdit($consisting, 8, 440, 305, 89, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL))
   $lblConsisting2 = GUICtrlCreateLabel("Consisting Of:", 8, 416, 69, 17)
   
   If $comto Then
    GUICtrlSetState($chkDup2, $GUI_UNCHECKED)
    GUICtrlSetState($chkCom2, $GUI_CHECKED)
   Else
    GUICtrlSetState($chkCom2, $GUI_UNCHECKED)
    GUICtrlSetState($chkDup2, $GUI_CHECKED)
   EndIf
   
   If StringLen($email) < 1 Then
    GUICtrlSetColor($txtEmail2, 0xFF0000)
   EndIf
   
   If StringLen($attn) < 1 Then
    GUICtrlSetColor($txtAttn2, 0xFF0000)
   EndIf
   
   If StringLen($pwo) < 1 Then
    GUICtrlSetColor($txtPwo2, 0xFF0000)
   EndIf
   
   If StringLen($desc) < 1 Then
    GUICtrlSetColor($txtDesc2, 0xFF0000)
   EndIf
   
   If StringLen($pe) < 1 Then
    GUICtrlSetColor($txtPE2, 0xFF0000)
   EndIf
   
   If StringLen($pm) < 1 Then
    GUICtrlSetColor($txtPM2, 0xFF0000)
   EndIf
   
   If StringLen($charge) < 1 Then
    GUICtrlSetColor($txtCharge2, 0xFF0000)
   EndIf
   
   GUISetState(@SW_SHOW, $frmConfirm)
   #EndRegion ### END Koda GUI section ###

That is used in the middle of my code (so the include gui info is already there), and I am recieving this error:

C:\Documents and Settings\USPJEFE\Desktop\Projects\2.0\SLA-2.0.au3 (239) : ==> Variable used without being declared.:

GUICtrlSetColor($txtEmail2, 0xFF0000)

GUICtrlSetColor(^ ERROR

I'm thinking this may have something to do with the version of autoit that I'm running, but I don't know because it seems to be an option that Scite recognizes as an AutoIt function, indicating that it should work. Right now, I'm running 3.2.8.1 (according to the help file.)

Share this post


Link to post
Share on other sites



Ok I got rid of the error, however it's not changing the color of my text. I'm not sure why, however. The error was due to the fact that I had duplicate entries and the variable txtEmail hadn't been created by the GUI yet.

Share this post


Link to post
Share on other sites

From the context of the block of code it whould work fine. Im guessing there's somthign more to your script though becuase that code block doesn't compile by itself...what is the rest of the code?

Share this post


Link to post
Share on other sites

Ok... well um... the rest of the code... alright. Hehe... here is what you need/want to make it so you can go back and forth between the two gui's.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ok I got rid of the error, however it's not changing the color of my text. I'm not sure why, however. The error was due to the fact that I had duplicate entries and the variable txtEmail hadn't been created by the GUI yet.

This works fine for me:

#include <guiconstants.au3>

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test", 300, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")

$email = "some.body@no.where.com"
$txtEmail2 = GUICtrlCreateInput($email, 10, 10, 280, 20, BitOR($ES_AUTOHSCROLL,$ES_READONLY))

GUISetState()

Sleep(2000)
GUICtrlSetColor($txtEmail2, 0xFF0000)

While 1
    Sleep(20)
WEnd

Func _Quit()
    Exit
EndFuncoÝ÷ Ù:ò®éçx-+(*.®÷«²*'ýéïº'éíée£ÒN¬r^v¬m±ç¦¶ëǺÚ"µÍYÝ[Ó[   ÌÍÙ[XZ[
H   ÈH[ÕRPÝÙ]ÛÛÜ ÌÍÝ[XZ[
B[Y

You are only changing the color if there is not text to color (StringLen = 0)?

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

It works. Odd... now I'm confused.

Share this post


Link to post
Share on other sites

I've got it. It's because the strings no longer are less than 1. They equal N/A now.

Share this post


Link to post
Share on other sites

I've got it. It's because the strings no longer are less than 1. They equal N/A now.

or

If StringLen($attn) > 1 Then: you can use greater than

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Har, thanks man (or woman...) :)

Share this post


Link to post
Share on other sites

Har, thanks man (or woman...) :)

Appraiser = Valuater

Valuater = Robert

lol

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

I figured I would be politically correct when thanking you... hehe :)

Share this post


Link to post
Share on other sites

Valuater = Robert

...who has a pretty husky voice... for a chick... :)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

...who has a pretty husky voice... for a chick... :)

LOL

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

...who has a pretty husky voice... for a chick... :)

Lmao! ;)

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  
Followers 0