Jump to content

clear gui


cracker
 Share

Recommended Posts

hello in my actuall program it would be nice to easylie clear the wohle gui. that means just to del all labels, input boxes etc... that would be a kind of repaint(). Or is there no other way then to destroy gui and to create an new one?

thanks for help

Edited by cracker
Link to comment
Share on other sites

Maybe you could create it new. (EDIT: Sorry, I just saw, you wrote it) Thats how I did an identical task in my program... :whistle:

But could you describe, why you want all buttons and so on empty???

As far as I know: In the new beta should be some kind of refresh!

Edited by Earthquake
Yes, I am a noob! But at least I try to learn!Moddingtech.de - Home of the german Modding-Scene!
Link to comment
Share on other sites

@ fossil rock no this dont helps me because the input fields etc are not declared in variables.

i dont want it only empty i want that all items go away so guictrlsetsate($all,@sw_hide) is what i want. but i think i will solve this problem other because its not possible (it looks like) thx for your tries

Link to comment
Share on other sites

i want that all items go away so guictrlsetsate($all,@sw_hide) is what i want. but i think i will solve this problem other because its not possible (it looks like) thx for your tries

You could add your controls into an array, then loop through them to hide them all with GuiCtrlSetState().

To make it easy to address your controls, then consider using Enum on the variables to use for indexing the array.

Small example

#include <GUIConstants.au3>

Global $ctrl[3]
Enum $gui, $button1, $button2

$ctrl[$gui] = GUICreate('title')
$ctrl[$button1] = GUICtrlCreateButton('text 1', 0,  0)
$ctrl[$button2] = GUICtrlCreateButton('text 2', 0, 30)
GUISetState()

Sleep(3000)

For $i = 1 To UBound($ctrl)-1
    GUICtrlSetState($ctrl[$i], $GUI_HIDE)
Next

While WinActive('title')
    Sleep(1000)
WEnd

:whistle:

Link to comment
Share on other sites

  • Moderators

Or is there no other way then to destroy gui and to create an new one?

That got me thinking... I'd never done this before but works well:
#include <guiconstants.au3>

Local $Main = _GUI_CreateMain()
GUISetState(@SW_SHOW, $Main[1])

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $Main[3]
            GUIDelete($Main[1])
            $Main = _GUI_CreateMain()
            GUISetState(@SW_SHOW, $Main[1])
    EndSwitch
WEnd

Func _GUI_CreateMain()
    Local $aCtrls[4]
    $aCtrls[1] = GUICreate('Some GUI', 200, 100)
    $aCtrls[2] = GUICtrlCreateCombo('', 10, 10, 180, 100)
    $aCtrls[3] = GUICtrlCreateButton('Click Me', 75, 50, 50, 30)
    Return $aCtrls
EndFunc
The same concept of using arrays as MHz.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

yeah it works great !!! thx a lot again. but now i have an other problem. I want to make my window scrollable so i created it like this:

: AutoIt

GUICreate("Delete It",600,500,-1,-1,$WS_VSCROLL+$WS_SIZEBOX+$WS_SYSMENU)

but if i scroll now the window doesn´t goes down... iam sure i have to tell the window "how to scroll" but i didn´t found the answer in the help file how to do this can you help me again?

Link to comment
Share on other sites

  • Moderators

does nobody understand where my problem is or should i create a new thread for a new quesion???(sorry for double post...) :P:nuke:

I really didn't know what you were saying, do you have a working example of what it is you'd like to be done and what it is you'd like to change?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

oh i will try to explain it more exactly:

i have a gui the size is for example 500 x 400 . now i add in a while loop elemts to the gui (labels, checkbox and so on). And its logical that the gui is at any time full and the next elemts would be displayed out of the gui (for example:

GUICtrlCreateLabel("test",40,500) oÝ÷ Ù»­¡÷(º»§¶Ú,yè­²u×jÇ+¢Y[j¶®¶­sduT7&VFRgV÷C·FW7BgV÷C²ÃSÃCÂÓÂÓÂb33cµu5õe45$ôÄÂ

now i see the scrollbar on the right side but if i scroll down it "dont moves down" maybe the screenshot in the attachment can help you to understand my problem. Or maybe you just have a example with a gui and $WS_VSCROLL

thanks :P

Link to comment
Share on other sites

  • Moderators

No, what I meant was, I don't feel like making my own GUI to try and provide a "working" example for you. Since this is a request, I would suggest making a working GUI, with the example that is not working, so we can debug it for you.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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