Jump to content
Sign in to follow this  
goodmanjl531

Group Caption

Recommended Posts

goodmanjl531

Is it possible to change the caption of a group at a later point in your code?

Below is my GUI setup

$Form1_1 = GUICreate("Ping Utility", 395, 412, 299, 204)
$Input_1 = GUICtrlCreateInput("", 64, 8, 97, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
GUICtrlSetLimit(-1, 4)
$Input_2 = GUICtrlCreateInput("64", 248, 9, 81, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
$Group_Main = GUICtrlCreateGroup("Main Router", 8, 40, 377, 185)
$Group_POS = GUICtrlCreateGroup("POS", 16, 56, 217, 161)
$Checkbox_Reg1 = GUICtrlCreateCheckbox("Register 1", 24, 80, 81, 41)
GUICtrlSetState(-1, $GUI_CHECKED)
$Checkbox_Reg2 = GUICtrlCreateCheckbox("Register 2", 120, 80, 81, 41)
GUICtrlSetState(-1, $GUI_CHECKED)
$Checkbox_Reg3 = GUICtrlCreateCheckbox("Register 3", 24, 128, 81, 41)
$Checkbox_Reg4 = GUICtrlCreateCheckbox("Register 4", 120, 128, 81, 41)
$Checkbox_RmtPRT = GUICtrlCreateCheckbox("Remote Printer", 64, 179, 105, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Checkbox_RTR = GUICtrlCreateCheckbox("Router", 256, 64, 97, 41)
GUICtrlSetState(-1, $GUI_CHECKED)
$Checkbox_Shoppertrak = GUICtrlCreateCheckbox("Shopper Trak", 256, 151, 89, 41)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("PING", 8, 360, 161, 41, $BS_DEFPUSHBUTTON)
$BTN_Exit = GUICtrlCreateButton("Exit", 224, 360, 161, 41)
$Group_Uplink = GUICtrlCreateGroup("Uplink Router/Switch", 8, 232, 377, 113)
$Checkbox_Rtr2 = GUICtrlCreateCheckbox("Uplink Router\Switch", 16, 256, 129, 33)
$Checkbox_CCTV = GUICtrlCreateCheckbox("CCTV", 152, 256, 57, 33)
$Checkbox_DMX = GUICtrlCreateCheckbox("DMX", 224, 256, 45, 33)
$Checkbox_Style = GUICtrlCreateCheckbox("Style Wall", 288, 256, 89, 33)
$Checkbox_BRT1 = GUICtrlCreateCheckbox("BrightSign-1", 16, 304, 80, 33)
$Checkbox_BRT2 = GUICtrlCreateCheckbox("BrightSign-2", 104, 304, 80, 33)
$Checkbox_BRT3 = GUICtrlCreateCheckbox("BrightSign-3", 200, 304, 80, 33)
$Checkbox_BRT4 = GUICtrlCreateCheckbox("BrightSign-4", 296, 304, 80, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label2 = GUICtrlCreateLabel("Store:", 8, 8, 45, 17)
$Label1 = GUICtrlCreateLabel("Packet Size:", 176, 7, 61, 17)
GUISetState(@SW_SHOW)

I want to after this is completed and the user hits buton 1 to cahnge the caption on $Group_Main

I tired

GUICtrlSetData($Group_Main, Caption = "Main Router  " & $Ping_Rtr)

  $Ping_Rtr   gets defined prior to me trying to change the captionm

without luck

 

Thanks ahead of time...

Share this post


Link to post
Share on other sites
Danyfirex

Hi.

use Guictrlsetdata(ControlID,"New Name")

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>



$Form1_1 = GUICreate("Ping Utility", 395, 412, 299, 204)
$Input_1 = GUICtrlCreateInput("", 64, 8, 97, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
GUICtrlSetLimit(-1, 4)
$Input_2 = GUICtrlCreateInput("64", 248, 9, 81, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
$Group_Main = GUICtrlCreateGroup("Main Router", 8, 40, 377, 185)
$Group_POS = GUICtrlCreateGroup("POS", 16, 56, 217, 161)
$Checkbox_Reg1 = GUICtrlCreateCheckbox("Register 1", 24, 80, 81, 41)
GUICtrlSetState(-1, $GUI_CHECKED)
$Checkbox_Reg2 = GUICtrlCreateCheckbox("Register 2", 120, 80, 81, 41)
GUICtrlSetState(-1, $GUI_CHECKED)
$Checkbox_Reg3 = GUICtrlCreateCheckbox("Register 3", 24, 128, 81, 41)
$Checkbox_Reg4 = GUICtrlCreateCheckbox("Register 4", 120, 128, 81, 41)
$Checkbox_RmtPRT = GUICtrlCreateCheckbox("Remote Printer", 64, 179, 105, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Checkbox_RTR = GUICtrlCreateCheckbox("Router", 256, 64, 97, 41)
GUICtrlSetState(-1, $GUI_CHECKED)
$Checkbox_Shoppertrak = GUICtrlCreateCheckbox("Shopper Trak", 256, 151, 89, 41)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("PING", 8, 360, 161, 41, $BS_DEFPUSHBUTTON)
$BTN_Exit = GUICtrlCreateButton("Exit", 224, 360, 161, 41)
$Group_Uplink = GUICtrlCreateGroup("Uplink Router/Switch", 8, 232, 377, 113)
$Checkbox_Rtr2 = GUICtrlCreateCheckbox("Uplink Router\Switch", 16, 256, 129, 33)
$Checkbox_CCTV = GUICtrlCreateCheckbox("CCTV", 152, 256, 57, 33)
$Checkbox_DMX = GUICtrlCreateCheckbox("DMX", 224, 256, 45, 33)
$Checkbox_Style = GUICtrlCreateCheckbox("Style Wall", 288, 256, 89, 33)
$Checkbox_BRT1 = GUICtrlCreateCheckbox("BrightSign-1", 16, 304, 80, 33)
$Checkbox_BRT2 = GUICtrlCreateCheckbox("BrightSign-2", 104, 304, 80, 33)
$Checkbox_BRT3 = GUICtrlCreateCheckbox("BrightSign-3", 200, 304, 80, 33)
$Checkbox_BRT4 = GUICtrlCreateCheckbox("BrightSign-4", 296, 304, 80, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label2 = GUICtrlCreateLabel("Store:", 8, 8, 45, 17)
$Label1 = GUICtrlCreateLabel("Packet Size:", 176, 7, 61, 17)
GUISetState(@SW_SHOW)

Sleep(1000)
GUICtrlSetData($Group_Main,"New Name")
Sleep(1000)

Saludos

  • Like 1

Share this post


Link to post
Share on other sites
JLogan3o13

This is working for me. My question would be how are you setting $Ping_Rtr, I don't see it anywhere in your code.

While 1
    Local $msg = GUIGetMsg()

        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button1
                GUICtrlSetData($Group_Main, "Text Changed")
        EndSelect
WEnd

Edit: Dang page didn't refresh. Too slow :)

Edited by JLogan3o13
  • Like 1

√-1 2^3 ∑ π, and it was delicious!

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  

×