Chobyhy Posted August 22, 2007 Share Posted August 22, 2007 Global $Test Func _NewAccountForm() $NewAcc = GUICtrlCreateInput("Default", 100, 90, 100, 20) $AddNewAcc = GUICtrlCreateButton("Add", 100, 115, 50, 20) GUICtrlSetOnEvent(-1, "_AddNewAccount") $AddNewAccCancle = GUICtrlCreateButton("Cancel", 150, 115, 50, 20) GUICtrlSetOnEvent(-1, "_AddNewAccountCancle") EndFunc Func _AddNewAccount() If Not $NewAcc = "" Then $AccountCount = IniRead($IniDir, "Main", "Acc", "0") $AccountCount = $AccountCount + 1 IniWrite($IniDir, "Main", "Account" & $AccountCount, $NewAcc) IniWrite($IniDir, "Main", "Acc", $AccountCount) EndIf EndFunc This is just a part of the code and the problem is that it keeps writing in the Ini that $NewAcc = 14 even though I put in a different value in the inbox. Any suggestion? Link to comment Share on other sites More sharing options...
Gif Posted August 22, 2007 Share Posted August 22, 2007 (edited) the problem is that you need GuiCtrlRead() to retrieve the value from controls , so try:Global $Test Func _NewAccountForm() $NewAcc = GUICtrlCreateInput("Default", 100, 90, 100, 20) $AddNewAcc = GUICtrlCreateButton("Add", 100, 115, 50, 20) GUICtrlSetOnEvent(-1, "_AddNewAccount") $AddNewAccCancle = GUICtrlCreateButton("Cancel", 150, 115, 50, 20) GUICtrlSetOnEvent(-1, "_AddNewAccountCancle") EndFunc Func _AddNewAccount() If Not GuiCtrlRead($NewAcc) == "" Then $AccountCount = IniRead($IniDir, "Main", "Acc", "0") $AccountCount = $AccountCount + 1 IniWrite($IniDir, "Main", "Account" & $AccountCount, GuiCtrlRead($NewAcc)) IniWrite($IniDir, "Main", "Acc", $AccountCount) EndIf EndFuncPS: add GuiCtrlRead() anywere else you are reading from a control Edited August 22, 2007 by Gif Link to comment Share on other sites More sharing options...
sandman Posted August 22, 2007 Share Posted August 22, 2007 (edited) Just for reference, Gif is correct, and what it is returning without reading it first is the ID / handle of the control. You always need to use GUICtrlRead(), unless you specifically want to get the handle. Edited August 22, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center] Link to comment Share on other sites More sharing options...
Chobyhy Posted August 22, 2007 Author Share Posted August 22, 2007 Thanks for the help Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now