Sign in to follow this  
Followers 0
VicTT

GUI help - What am I missing?

8 posts in this topic

#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[/quote]

Share this post


Link to post
Share on other sites



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...

Share this post


Link to post
Share on other sites

AutoItWinSetTitle

and

AutoItWinGetTitle

refer to the hidden "Autoit" title...

not your gui

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

@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[/quote]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

WinGetTitle()

WinSetTitle()

go to help, look at the "index" Tab... slide all the way to the bottom and you can see the "win" controls

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#6 ·  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[/quote]

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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[/quote]

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