Skyrimfus

GUICtrlSetData from textfile

2 posts in this topic

Hi. I have the following textfile:

LIST:
1.231
2.456
3.211
4.456
5.788
6.432
7.313

And the follwoing code:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Edit = GUICtrlCreateEdit("", 88, 24, 425, 273, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
$Go = GUICtrlCreateButton("Go", 144, 336, 305, 65)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        case $Go
            $Read = FileRead("C:\Users\Skyrimfus\Documents\Table.txt")
            GUICtrlSetData($Edit,$Read)

    EndSwitch
WEnd

But the text in edit is written all in one line instead having break on every row. Can i somehow do that?

Share this post


Link to post
Share on other sites



10 minutes ago, Skyrimfus said:

Hi. I have the following textfile:

LIST:
1.231
2.456
3.211
4.456
5.788
6.432
7.313

And the follwoing code:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Edit = GUICtrlCreateEdit("", 88, 24, 425, 273, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
$Go = GUICtrlCreateButton("Go", 144, 336, 305, 65)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        case $Go
            $Read = FileRead("C:\Users\Skyrimfus\Documents\Table.txt")
            GUICtrlSetData($Edit,$Read)

    EndSwitch
WEnd

But the text in edit is written all in one line instead having break on every row. Can i somehow do that?

FML i did this before and remeberd that im an idiot. I guess thats what you get for working 5 hours straight

 

I did everything correctly:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Edit = GUICtrlCreateEdit("", 88, 24, 425, 273, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
$Go = GUICtrlCreateButton("Go", 144, 336, 305, 65)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        case $Go
            $Read = FileRead("C:\Users\Skyrimfus\Documents\Table.txt")
            GUICtrlSetData($Edit,$Read,1)

    EndSwitch
WEnd

But at the end i added an unnecessary GuiCtrlSetData($edit,0)

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