Jump to content

guictrldelete


Recommended Posts

I know this has probably been answered already, but how come when I want to delete a control and then recreate it later it doesn't recreate. Could the reason be that i'm using the same variable name again or is there some redraw thing i'm missing in my code?

Link to comment
Share on other sites

I thought about that one too Volly, but I really don't know the answer to the question... :D

8)

Hiding the control is the right way to go. I think the proble stems from the GUI not refreshing and I'm not sure if another GUISetState(@SW_Show) will resolve that or not.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Can we get a difnitive answer on this one, obviously I couple of us "helpers" would like to know for sure

8)

I think I have a difinitive answer. There is anoher problem in the OPs code. Test this.

;
$Frm_Main = GUICreate("Test Form")
$Input = GUICtrlCreateInput("", 10, 10, 100, 20)
$Btn = GUICtrlCreateButton("Proceed", 10,40, 60,30)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $Btn
            GUICtrlDelete($Input)
            $Input = GUICtrlCreateInput("Input", 10, 10, 100, 20)
        Case -3
            Exit
    EndSwitch
Wend
;

It works and I am resonably confident that it replicates wht the OP was attempting to do.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Dammit, why are you confusing me? :D

Because it's so damn easy to do Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Because it's so damn easy to do

...joke, joke:

This guy sits on the rock. The oher one comes by and says: "... so you are sitting and thinking. That's nice!!". 
- "No.. no, I'm just sitting"

I had this (modification of help file example):

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $Button_1, $Button_2, $Button_3, $msg
    Local $iX = 1
    GUICreate("My GUI Button"); will create a dialog box that when displayed is centered

    $Button_1 = GUICtrlCreateButton("Do thing wih ->", 10, 30, 100)
    $Button_2 = GUICtrlCreateButton("Button Test", 130, 30, 100)
    $Button_3 = GUICtrlCreateButton("Button Test 2", 10, 70, 100)

    GUISetState(); will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                If $iX Then
                    GUICtrlDelete($Button_2)
                    $iX = 0
                Else
                    $Button_2 = GUICtrlCreateButton("Button Test", 130, 30, 100)
                    $iX = 1
                EndIf
            Case $msg = $Button_2
                MsgBox(0, 'Testing', 'Button Test was pressed'); Will demonstrate Button 2 being pressed
            Case $msg = $Button_3
                MsgBox(0, 'Testing', 'Button Test 2 was pressed')
        EndSelect
    WEnd
EndFunc ;==>Example
Edited by trancexx

♡♡♡

.

eMyvnE

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...