Jump to content

Cannot CtrlSetData when Edit Field Variable is passed as a function Argument


CT83
 Share

Recommended Posts

Dir_Load("Target1", "GS1_TarToday", $GS1_TarToday)
;here Target1 is a dir. and GS1_TarToday is a filename.  $GS1_TarToday is the edit box in which i want to display info set by dir_load function

Func Dir_Load($cS_Group,$cS_Name,$cVData,$cSavedPath="Configurations\Default")
Local $cCurrent_Path=String($cSavedPath&"\"&$cS_Group&"\"&$cS_Name&".ct83")
Local $cFileData
If Not _FileReadToArray($cCurrent_Path,$cFileData, 0) Then
MsgBox($MB_SYSTEMMODAL, "", "There was an error Reading the "& $cS_Group&"\"&$cS_Name &".ct83 File ! Please Try again! ")
EndIf
Local $cFileData1 = _ArrayToString($cFileData)
GUICtrlSetData($cVData,$cFileData1)
Endfunc

The above code is meant to set the data of the edit box to a file GS1_TarToday.ct83 in Target1 folder ( $cFileData1 ) but this code simply does nothing. No errors are returned. still the data of the edit box remains as it is, 

Link to comment
Share on other sites

Add an error checking line after _ArrayToString call and see what happens:

if @error then consolewrite("Error: " & @error & @crlf)

 

Edited by j0kky
Link to comment
Share on other sites

See the output of:

consolewrite(GUICtrlSetData($cVData,$cFileData1) & @crlf)

Anyhow, to help you, you should post the entire code, I think there is something wrong with $GS1_TarToday

Edited by j0kky
Link to comment
Share on other sites

15 minutes ago, j0kky said:

See the output of:

consolewrite(GUICtrlSetData($cVData,$cFileData1) & @crlf)

Anyhow, to help you, you should post the entire code, I think there is something wrong with $GS1_TarToday

yeah i will post the entire code in a while :) ... btw  consolewrite(GUICtrlSetData($cVData,$cFileData1) & @crlf) just returns "0" what should i be expecting?

Link to comment
Share on other sites

16 minutes ago, j0kky said:

If it outputs 1 there was real a problem :) Now I'm quite sure the problem resides in $GS1_TarToday

Yes you are right! :):)  and as it turns out $GS1_TarToday was the variable which stored text from $S1_TarToday and not the actual edit box :(   . So all the time i was trying to set a entirely different variable.  oh i am so embarrassed. :( 

Thanks for your help! You guys are awesome! :) 

Edited by CT83
Link to comment
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
 Share

×
×
  • Create New...