Sign in to follow this  
Followers 0
Lempke

Need help with GuiCtrlCreateInput

4 posts in this topic

#1 ·  Posted (edited)

I want to read a value from a ini file which will appear in a GUI. I want to be able to change the value in the GUI and the write it back to the ini file.

I can't seem to get it working.

This is a portion of my script:

$FirstName = IniRead("C:\Lempke\USER.ini", "USERDATA", "FirstName", "")
GUICtrlCreateLabel("FirstName",  25, 35, 100, 20)
$FirstName = GuiCtrlCreateInput("" & $FirstName, 120, 30, 200, 20)
........
........
........
GuiSetState()

While 1     
  $msg = guigetmsg()
.........
.........
.........
GUICtrlRead($FirstName)
IniWrite("C:\Lempke\USER.ini", "USERDATA", "FirstName", $FirstName)
.........
.........
.........

It only returns the ControlID. I don't know whats wrong...please help

Edited by Lempke

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

GuiCtrlRead() just stores the returns the value so you need to store it in a variable or pass it directly to IniWrite.

A. Store In Variable

$Value=GUICtrlRead($FirstName)
IniWrite("C:\Lempke\USER.ini", "USERDATA", "FirstName", $Value)
Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

GuiCtrlRead() just stores the returns the value so you need to store it in a variable or pass it directly to IniWrite.

A. Store In Variable

$Value=GUICtrlRead($FirstName)
IniWrite("C:\Lempke\USER.ini", "USERDATA", "FirstName", $Value)
I thought that I had tried option B and that it didn't work, but it works fine. Also option A works fine.

THX SolidSnake

Edited by Lempke

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