Jump to content

Recommended Posts

Posted

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=E:\AutoIt\UDF\KODA\Actual koda\Forms\AForm1.kxf
$Form1 = GUICreate("AForm1", 633, 447, 193, 115)
$Save = GUICtrlCreateButton("Save", 272, 248, 99, 25, 0)
GUICtrlSetOnEvent(-1, "AButton1Click")
$Graphic1 = GUICtrlCreateGraphic(272, 144, 100, 100)
$Start = GUICtrlCreateButton("Start", 192, 184, 75, 25, 0)
GUICtrlSetOnEvent(-1, "AButton2Click")
$Stop = GUICtrlCreateButton("Stop", 376, 184, 75, 25, 0)
GUICtrlSetOnEvent(-1, "AButton3Click")
$Name = GUICtrlCreateInput("Name", 256, 120, 129, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AutoItWinSetTitle("000000")
While 1
    Sleep(100)
WEnd
        
Func AButton1Click()
FileWriteLine("colors.txt",GUICtrlRead($name)&"="&AutoItWinGetTitle())
EndFunc

        
Func AButton2Click()
$delay=InputBox("Color tester","Input delay")
Global $brun=True
while $brun
Sleep($delay)
GUICtrlSetBkColor($Graphic1,"0x"&AutoItWinGetTitle())
AutoItWinSetTitle(Hex(Dec(AutoItWinGetTitle())+1))
wend
EndFunc

        
Func AButton3Click()
Global $brun=False
EndFunc

        
Func NameChange()

EndFunc

2 questions:

Why doesn't it set the GUI window title as it should (AutoItWinSetTitle)?

and

How come that after I click the stop button, nothing happens?

Quote

Together we might liveDivided we must fall

 

Posted

The stop button only stops the delay in Abutton2Click, there is no exit. Your While 1 loop is still running.

Aha.. I have unlocked it's secrets.. world domination is within my grasp...

Posted

@JaySquared

It is a while $brun loop, not a while 1 loop

It should normally keep running the instructions in the while loop, and when interrupted (Button2 clicked ==> $brun=false), it should exit the while loop..

@Valuater

Then what functions should I use for the GUI window?

Quote

Together we might liveDivided we must fall

 

Posted (edited)

@Valuater

Thank you, Valuater..I was just hoping it won't have to come to WinGetTitle, WinSetTitle..

Any idea on how to rewrite the rest of the code?

EDIT: I don't want to use GUIGetMsg(), but rather events..

Edited by VicTT
Quote

Together we might liveDivided we must fall

 

Posted

Why not try setting WinTitleMatchMode to 4 and calling it by your gui handle? Then just change it to WinGetTitle($Form1) and WinSetTitle($Form1,"", NewTitle)

Aha.. I have unlocked it's secrets.. world domination is within my grasp...

Posted

I already did that...that's not really an issue, I just hated writing things like my GUI window were ANY OTHER window..Anyway..the main problem remains writing the program through GUI events..

Quote

Together we might liveDivided we must fall

 

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
×
×
  • Create New...