Sign in to follow this  
Followers 0
jfcby

Change label data withot creating a new label?

2 posts in this topic

Hello,

Is there a way to change the label data witout creating a new label?

I've search the forum and Help files and cannot find any examples. If you would let me know what search words to type in to find examples on this forum or what to look for in the help file would greeatly appriciated.

I'm using GUICtrlCreateLabel("Paragraph 1", 10, 25, 75, 100, $SS_NOTIFY) and GUICtrlSetData($LB1,"TEST") but this is not working.

Full Example Code:

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg
    Local $LB1, $btn1
    
    GUICreate("My GUI", 200, 200) ; will create a dialog box that when displayed is centered
    
    $LB1 = GUICtrlCreateLabel("Paragraph 1", 10, 25, 75, 100, $SS_NOTIFY)
    $btn1 = GUICtrlCreateButton("Next", 10, 100, 50, 20)
    
    GUISetState()
    
; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()      
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $btn1               
                MsgBox(0, "Wait", "Waiting...")             
                GUICtrlCreateLabel("Paragraph 1", 10, 25, 75, 100, $SS_NOTIFY)              
        EndSelect   
    WEnd
EndFunc  ;==>Example

Thank you for your help,

jfcby


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This.....

$LB1 = GUICtrlCreateLabel("Paragraph 1", 10, 25, 75, 100, $SS_NOTIFY)

was too big and it covered the button area

and.......

Use GUICtrlSetData()

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg
    Local $LB1, $btn1
    
    GUICreate("My GUI", 200, 200) ; will create a dialog box that when displayed is centered
    
    $LB1 = GUICtrlCreateLabel("Paragraph 1", 10, 25, 75, 20, $SS_NOTIFY)
    $btn1 = GUICtrlCreateButton("Next", 10, 100, 50, 20)
    
    GUISetState()
    
; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()        
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $btn1                 
                MsgBox(0, "Wait", "Waiting...")                
                GUICtrlSetData( $LB1, "Paragraph 2")                
        EndSelect    
    WEnd
EndFunc  ;==>Example

8)

Edited by Valuater

NEWHeader1.png

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  
Followers 0