Jump to content
Sign in to follow this  
Ster

can i edit and existing GUI label?

Recommended Posts

Ster

can i change the text of an existing GUI label after its created and displayed?

Share this post


Link to post
Share on other sites
t0ddie

guictrlsetdata can


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites
nycram

guictrlsetdata can

<{POST_SNAPBACK}>

As far as I can figure out, that was true last fall but isn't true now!

NYcram

Share this post


Link to post
Share on other sites
seandisanti

As far as I can figure out, that was true last fall but isn't true now!

NYcram

<{POST_SNAPBACK}>

I've done it very recently with both the full release and the beta without issue... make sure you're including GUIConstants.au3, and may want to make sure that your casing is correct on the function calls... sometimes i run into issues where 'GuiCtrlSetData()' won't work, but 'GUICtrlSetData()' will...

Share this post


Link to post
Share on other sites
nycram

I've done it very recently with both the full release and the beta without issue... make sure you're including GUIConstants.au3, and may want to make sure that your casing is correct on the function calls... sometimes i run into issues where 'GuiCtrlSetData()' won't work, but 'GUICtrlSetData()' will...

<{POST_SNAPBACK}>

I'm a newbie, so I cut and paste from the autit help in scite. Here's my gui window:

; Make my Window

#include <GUIConstants.au3>

OPt("GUIOnEventMode", 1)

Opt("WinTitleMatchMode", 0) ; any substring will match

$WindowHandle = GUICreate ( "xxxxxxxx Automation" , 300 , 200 , 500, 500 ) ; W H L T

$Step1Flag = GUICtrlCreateLabel ( " ", 10, 20 , 20 ,15 ) ;L T W H

$Step1Text = GUICtrlCreateLabel ( "xxxxxxx", 40, 20 , 100 ,15 ) ;L T W H

$Step2Flag = GUICtrlCreateLabel ( " ", 10, 40 , 20 ,15 ) ;L T W H

$Step2Text = GUICtrlCreateLabel ( "xxxxxx", 40, 40 , 100 ,15 ) ;L T W H

$Step3Flag = GUICtrlCreateLabel ( " ", 10, 60 , 20 ,15 ) ;L T W H

$Step3Text = GUICtrlCreateLabel ( "xxxxxx", 40, 60 , 100 ,15 ) ;L T W H

$ActionReqd = GUICtrlCreateLabel ( " hoho ", 40, 200 , 100 ,15 ) ;L T W H

;GUICtrlSetColor ( $ActionReqd, 0xFF0000)

$StartButton = GUICtrlCreateButton ( "Start", 10, 100 , 40 ,20 ) ;L T W H

GUICtrlSetOnEvent ( $StartButton, "Startxxxx" )

$StopButton = GUICtrlCreateButton ( "Stop", 120, 100 , 40 ,20 ) ;L T W H

GUICtrlSetOnEvent ( $StopButton, "Stopxxxx" )

GuiSetState(@SW_SHOW)

WinSetOnTop ($WindowHandle, "", 1 )

HotKeySet("{ESC}", "killthis")

and here's the beginning of the Startxxx func that gets started when I push the Start button:

Func Startxxxx()

msgbox(4096,"Startxxxx", "got here")

If WinExists("The window I want") = 0 Then

GUICtrlSetData( $ActionReqd, "Start xxxxxx" )

WinWaitActive("The window I want")

Else

WinActivate("The window I want")

EndIf

msgbox(4096,"Startxxx", "found window")

etc.

I never get the text of $ActionReqd to change. I do get both msgboxes, so the code executes.

NYcram

Share this post


Link to post
Share on other sites
seandisanti

I'm a newbie, so I cut and paste from the autit help in scite. Here's my gui window:

; Make my Window

#include <GUIConstants.au3>

OPt("GUIOnEventMode", 1)

Opt("WinTitleMatchMode", 0)            ; any substring will match

$WindowHandle = GUICreate ( "xxxxxxxx Automation" , 300 , 200 , 500, 500 ) ; W H L T

$Step1Flag    = GUICtrlCreateLabel ( "  ", 10, 20 , 20 ,15 ) ;L T W H

$Step1Text    = GUICtrlCreateLabel ( "xxxxxxx", 40, 20 , 100 ,15 ) ;L T W H

$Step2Flag    = GUICtrlCreateLabel ( "  ", 10, 40 , 20 ,15 ) ;L T W H

$Step2Text    = GUICtrlCreateLabel ( "xxxxxx", 40, 40 , 100 ,15 ) ;L T W H

$Step3Flag    = GUICtrlCreateLabel ( "  ", 10, 60 , 20 ,15 ) ;L T W H

$Step3Text    = GUICtrlCreateLabel ( "xxxxxx", 40, 60 , 100 ,15 ) ;L T W H

$ActionReqd  = GUICtrlCreateLabel ( "  hoho        ", 40, 200 , 100 ,15 ) ;L T W H

;GUICtrlSetColor ( $ActionReqd, 0xFF0000)

$StartButton  = GUICtrlCreateButton ( "Start", 10, 100 , 40 ,20  ) ;L T W H

GUICtrlSetOnEvent ( $StartButton, "Startxxxx" )

$StopButton  = GUICtrlCreateButton ( "Stop", 120, 100 , 40 ,20  ) ;L T W H

GUICtrlSetOnEvent ( $StopButton, "Stopxxxx" )

GuiSetState(@SW_SHOW)

WinSetOnTop ($WindowHandle, "", 1 )

HotKeySet("{ESC}", "killthis")

and here's the beginning of the Startxxx func that gets started when I push the Start button:

Func Startxxxx()

msgbox(4096,"Startxxxx", "got here")

If WinExists("The window I want") = 0 Then

  GUICtrlSetData( $ActionReqd, "Start xxxxxx" )

  WinWaitActive("The window I want")

Else

  WinActivate("The window I want")

EndIf

msgbox(4096,"Startxxx", "found window")

      etc.

I never get the text of $ActionReqd to change. I do get both msgboxes, so the code executes.

NYcram

<{POST_SNAPBACK}>

it works on my pc... one thing i had to change was i had to move the label because it wasn't being displayed...

Share this post


Link to post
Share on other sites
nycram

it works on my pc... one thing i had to change was i had to move the label because it wasn't being displayed...

<{POST_SNAPBACK}>

Damn. You don't know how often I stared at the parameters in the window def and compared them against the ones in the label def, without remembering that the parameters are reversed. This after carefully writing the meaning of the parameters in the comments.

Sorry.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.