Jump to content

Trouble to add @CRLF while using GUICtrlSetData


yellow
 Share

Recommended Posts

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
Link to comment
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!
Link to comment
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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...