Jump to content

Edit Counting when added?


Recommended Posts

Is this true?

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 158, 202)
$Edit1 = GUICtrlCreateEdit("", 8, 16, 137, 121)
GUICtrlSetData(-1, "Edit1")
$Label1 = GUICtrlCreateLabel("Number added : ", 8, 160, 83, 17)
$additionsLabel = GUICtrlCreateLabel("", 96, 160, 36, 17)
GUISetState(@SW_SHOW)

While 1
    _AddedNum() ;Is this true?
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func _AddedNum()
Local $Edititems = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF)
For $i = 0 To UBound($Edititems[0])
            GUICtrlSetData($additionsLabel, $Edititems[$i])
Next
EndFunc

 

Link to comment
Share on other sites

  • Moderators

Is it true that you have posted code? Yes

Is it true you have done so in English? Yes

Is it true that you have given us very little to go on to answer your question? Yes

Aside from this, how about a more thorough explanation of what you're after ;)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

And then there was this.

#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 158, 202)
$Edit1 = GUICtrlCreateEdit("", 8, 16, 137, 121)
GUICtrlSetData(-1, "Edit1" & @CRLF & "another")
$Label1 = GUICtrlCreateLabel("Total Number of Lines : ", 8, 160, 110, 17)
$additionsLabel = GUICtrlCreateLabel("", 120, 160, 36, 17)
GUISetState(@SW_SHOW)

While 1
    GUICtrlSetData($additionsLabel, StringSplit(GUICtrlRead($Edit1), @LF)[0]) ; This is true.
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

Edited by Malkey
StringStripCR() not really needed.
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...