Jump to content

How to change text of a group ?


n0way
 Share

Recommended Posts

Hi,

My question could seems to be stupid, and i'm used to search before posting, but I didn't find anything, neither in Help neither in Google, neither in Search modul.

So i've got a Form, with 2 things, a Group and a List

Global $Group1 = GUICtrlCreateGroup("MY TEXT", 120, 0, 273, 385)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Global $List1 = GUICtrlCreateList("", 8, 8, 105, 342,  BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetFont(-1, 8, 400, 0, "Arial")

I would like to change "MY TEXT" by what i selected in my list

Case $List1
    $selitems2 = _GUICtrlListBox_GetSelItemsText($List1)
        $selected = $selitems[1]

I've got that for the moment. I managed to put what i selected in a variable ...

Then, i've got this idea... but i doesn't work :x

$selected = ""

Global $Group1 = GUICtrlCreateGroup($selected, 120, 0, 273, 385)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Global $List1 = GUICtrlCreateList("", 8, 8, 105, 342,  BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetFont(-1, 8, 400, 0, "Arial")

Case $List1
    $selitems2 = _GUICtrlListBox_GetSelItemsText($List1)
    $selected = $selitems[1]

Thanks for your help,

n0way

EDIT : I just found a solution, but it doesn't seems to be the best method

Case $List1
            $selitems2 = _GUICtrlListBox_GetSelItemsText($List1)
            $nicknick2 = $selitems2[1]
            GUICtrlDelete($Group1)
            Global $Group1 = GUICtrlCreateGroup($nicknick2, 120, 0, 273, 385)
            GUICtrlCreateGroup($nicknick2, -99, -99, 1, 1)

I'm still aware

Link to comment
Share on other sites

GuiCtrlSetData(), just like a label:

#include <GuiConstantsEx.au3>

$hGUI = GUICreate("Test", 300, 300)
$sGroupTitle = "My Group"
$idGroup = GUICtrlCreateGroup($sGroupTitle, 10, 10, 280, 280)
$idList = GUICtrlCreateList("<Select Item>", 30, 30, 240, 240)
GUICtrlSetData($idList, "Item 1|Item 2|Item 3|Item 4|Item 5")
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            If $sGroupTitle <> GUICtrlRead($idList) Then
                $sGroupTitle = GUICtrlRead($idList)
                GUICtrlSetData($idGroup, $sGroupTitle)
            EndIf
    EndSwitch
WEnd

:x

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...