Sign in to follow this  
Followers 0
vkrisz81

data delete from for

3 posts in this topic

hi!

i tried to delete the datafield data when i press the button, but certainly it is impossible! i worked from the sample, but fortunately this is not work to me.. certainly!!

pls help me what can the problem ..

i only want to type into the text field the numbers from 1 to 10, and if i turn the button let this field delete.. because if i dont save the field before i write to there, it will simple overwrite that.. so i had to save the datafield before write to .. but why cant i delete this data if i want???

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

GUICreate("My GUI", 200,420)  ; will create a dialog box that when displayed is centered

$nEdit = GUICtrlCreateEdit ("line 0",10,10,190,380)
$gomb1= GUICtrlCreateButton ("torol",10,395,40,20)
GUISetState ()

;For $n=1 To 5
;GUICtrlSetData ($nEdit,@CRLF & "line "& $n)
;Next

; Run the GUI until the dialog is closed
    $msg=GUIGetMsg()
    $data=''
    for $cikl=1 to 10
        $msg=GUIGetMsg()
        if $msg=$gomb1 then 
        $data=''
        else 
        $data=GUICtrlRead($nEdit)
        EndIf
        sleep(500)
        GUICtrlSetData($nEdit, $data & @CRLF & $cikl )
        ;$data=GUICtrlRead($nEdit)
    Next
Do
    $msg=GUIGetMsg()
    if $msg=$gomb1 then $data=''

until $msg=$GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites



Using my crystal ball I think this should give you some ideas.

Clicking on the button now clears the contents of the edit box and restarts the process of adding data.

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

GUICreate("My GUI", 200, 420) ; will create a dialog box that when displayed is centered

$nEdit = GUICtrlCreateEdit("line 0", 10, 10, 190, 380)
$gomb1 = GUICtrlCreateButton("torol", 10, 395, 40, 20)
GUISetState()

;For $n=1 To 5
;GUICtrlSetData ($nEdit,@CRLF & "line "& $n)
;Next

; Run the GUI until the dialog is closed
$cikl = 0
$T = TimerInit()
Do
    $msg = GUIGetMsg()
    $data = ''
    If $cikl < 10 And TimerDiff($T) > 500 Then
        $data = GUICtrlRead($nEdit)
        GUICtrlSetData($nEdit, $data & @CRLF & $cikl)
        $cikl += 1
        $T = TimerInit()
    EndIf
    If $msg = $gomb1 Then
        $data = ''
        $cikl = 0
        GUICtrlSetData($nEdit, $data)
    EndIf
    ;$data=GUICtrlRead($nEdit)
Until $msg = $GUI_EVENT_CLOSE

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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