Sign in to follow this  
Followers 0
yellow

Trouble to add @CRLF while using GUICtrlSetData

6 posts in this topic

#1 ·  Posted (edited)

Look at my script , I don't know why I can't add the @CRLF. when I use it the window can't display properly.

opt("GUIOnEventMode",1)

#include <GUIConstants.au3>

$mainwindow=GUICreate("My GUI edit")

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

$myedit=GUICtrlCreateEdit ("", 176,32,121,97,$ES_AUTOVSCROLL+$WS_VSCROLL)

GUISetState ()

$file = FileOpen("c:\test.txt", 0)

If $file = -1 Then

GUICtrlSetData ($myedit,"NO Log",1)

EndIf

While 1

$line = FileReadLine($file)

GUICtrlSetData ($myedit,$line & @CRLF,1)

If @error = -1 Then ExitLoop

Wend

FileClose($file)

Func CLOSEClicked()

If @GUI_WINHANDLE = $mainwindow Then

Exit

EndIf

EndFunc

Edited by yellow

Share this post


Link to post
Share on other sites



have you ever tried

GUICtrlSetData ($myedit,$line & @CRLF); instead of GUICtrlSetData ($myedit,$line & @CRLF, 1)

this should work - at least it does on my pc :o

It still can't work well in my pc! I can't see any lines. :geek: But thanx for your reply!

Share this post


Link to post
Share on other sites

your script works! (now)

#include <file.au3>
opt("GUIOnEventMode",1)
#include <GUIConstants.au3>
$mainwindow=GUICreate("My GUI edit") 
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$myedit=GUICtrlCreateEdit ("", 176,32,121,97,$ES_AUTOVSCROLL+$WS_VSCROLL)
GUISetState ()
$file = "c:\test.txt"
If not FileExists($file) Then
GUICtrlSetData ($myedit,"NO Log",1)
EndIf
$line = _filecountlines ($file)
msgbox (0, $line, $line)
for $i = 1 to $line step 1
$line = FileReadLine($file, $i)
GUICtrlSetData ($myedit,$line & @CRLF,1)
next
Func CLOSEClicked()
If @GUI_WINHANDLE = $mainwindow Then 
Exit
EndIf 
EndFunc
while 1
    sleep (100)
WEnd

this should work by now you just made a little mistake

Share this post


Link to post
Share on other sites

That's good! I will check why I am wrong. Thanks!

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