Jump to content

Changing objects without closing the gui


Recommended Posts

I want to change some objects within the gui without closing the gui. In my test script I have two labels and 3 buttons. The first button shall change the first label, the second button shall change the second label and the third button shall close the gui. Here is the script:

#include <GUIConstants.au3>

GuiCreate("Test", 300,90)
$Text1 = GuiSetControl("label", "Text1", 10,10,100,15)
$Text2 = GuiSetControl("label", "Text1", 10,25,100,15)

$Button1 = GuiSetControl("button", "Change 1", 10,55,80,25)
GuiSetControlNotify()
$Button2 = GuiSetControl("button", "Change 2", 100,55,80,25)
GuiSetControlNotify()
$Button3 = GuiSetControl("button", "Cancel", 190,55,80,25)

While GuiMsg() = 3
    GuiWrite($Text1, 0, "Changed Text1")
Wend
While GuiMsg() = 4
    GuiWrite($Text2, 0, "Changed Text2")
Wend

If $Button3 = GuiRead() Then msgbox(0,"Message", "Cancel button pushed.")

GuiDelete()

But this doesn't work. I can change both labels. But sometimes I have to click twice on the buttons and sometimes the change buttons are closing the gui. I think the "message queue" noted in this post would help. Or is there any other way?

Regards,Peter Bonge

Link to comment
Share on other sites

I created an example showing you the technique I would use for changing buttons. My example includes 3 buttons. Two of these buttons change text when clicked, and the third changes it's physical position back and forth when clicked. Since my personal server is down (internet connection problems) I have posted the source and exe at the yahoo group in a new folder I have created. See the DynamicButtons.zip file for the files.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

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