Jump to content

GUICtrlDelete not working/?


layer
 Share

Recommended Posts

hey, i was wondering, what is wrong with this? :"> doesn't seem to be anything wrong..

Func Clear ()
    GUICtrlDelete ($char)
    $char= GUICtrlCreateInput ("# of characters outputted", 10, 20, 140)
    GUICtrlSetState ($char, $GUI_FOCUS)
    EndFunc

:lmao:

any help will be appreciated!! thanks! o:)

EDIT: lets just say $char is defined already... before i create the new one

Edited by layer
FootbaG
Link to comment
Share on other sites

Why are you deleting and re-creating the actual control?

GuiCtrlSetData($char, "# of characters outputted")
GUICtrlSetState ($char, $GUI_FOCUS)

Also, what do you mean by "what's wrong": Does your code crash, loop infinitely, not do what you expect?

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

i mean, it doesnt do anything... well, i could use your method... but even that doesnt work, a bug or what? whne i say it doesnt do anything, i mean, it doest reset the data :lmao: heres the full code..

#include <GUIConstants.au3>
GUICreate ("Random Generator", 200, 100)
$char= GUICtrlCreateInput ("# of characters outputted", 10, 20, 140)
$make= GUICtrlCreatebutton ("Make", 10, 60)
$pw= GUICtrlCreateEdit ("", 70, 63.5, 125, 20, $ES_READONLY)
GUICtrlCreateLabel ("Output:", 135, 40)
GUISetState ()
GUICtrlSetState ($char, $GUI_FOCUS)
$clear= GUICtrlCreateButton ("Clear", 155, 15)
While 1
   $get= GUIGetMsg ()
   If $get= $make then
      Generate ()
      If $get= $clear Then
      Clear ()
      EndIf
   EndIf
   If $get= -3 then Exit
WEnd
    
Func Generate ()
   $read= GUICtrlRead ($char)
   If NOT StringIsDigit($read) Then Return
   $read= Number($read)
   GuictrlSetData ($pw, "")
   GUICtrlSetLimit ($pw, $read)
   For $i = 1 To $read
      $pass= Chr(Random(Asc("a"), Asc("z"), 1))
      GuictrlSetData ($pw, $pass, 1)
      GUICtrlSetData ($pw, Random (0, 9, 1), 1)
   Next
EndFunc

Func Clear ()
    GuiCtrlSetData($char, "# of characters outputted")
    GUICtrlSetState ($char, $GUI_FOCUS)
    EndFunc
FootbaG
Link to comment
Share on other sites

There's your problem.

If $get= $make then
      Generate ()
      If $get= $clear Then
      Clear ()
      EndIf
   EndIf

I'm too lazy to do the full select-case or if-then-else:

While 1
   $get= GUIGetMsg ()
   If $get= $make Then Generate ()
   If $get= $clear Then  Clear ()
   If $get= -3 then Exit
WEnd

Learn to use MsgBox(4096,"debug", "This is called from the Clear function... testing 1 2 3")

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...