Jump to content

[Resolved] Read button ID


fxg4758
 Share

Recommended Posts

Hi. Can someone help me correct this code the read the correct button ID. In this code, i can read only the ID of buttons in the last tab. :x

Regards!

#include <GUIConstantsEx.au3>

#Include <Array.au3>

$optbar = IniReadSectionNames("index.ini")

If Not IsArray($optbar) Then Exit

_ArraySort($optbar)

$hGUI = GUICreate('Ini GUI', 600,600,10,10)

$varTab = GUICtrlCreateTab(10, 10, 200, 100)

For $z = 1 To UBound($optbar) - 1

$optbarAreas = IniReadSectionNames($optbar[$z])

_ArraySort($optbarAreas)

Local $varTabItem[uBound($optbarAreas) - 1], $Button[uBound($optbarAreas) - 1]

$varTabItem[$z - 1] = GUICtrlCreateTabItem(StringTrimRight($optbar[$z],4))

For $x = 1 To UBound($optbarAreas) - 1

$var = IniReadSection($optbar[$z],$optbarAreas[$x])

If @error Then ContinueLoop

$X_Coord = 10 + (($x - 1) * 180)

$Button[$x - 1] = GUICtrlCreateButton($optbarAreas[$x], $X_Coord, 30, 150, 30)

Next

GUISetState()

Next

GUICtrlCreateTabItem(""); end tabitem definition

GUISetState(@SW_SHOW)

While 1

$Msg = GUIGetMsg()

If $Msg = $GUI_EVENT_CLOSE Then Exit

For $i = 0 To UBound($Button) - 1

If $Msg = $Button[$i] Then

MsgBox(0, '$Msg = ' & $Msg, GuiCtrlRead($Button[$i]) & ' Pressed', 2)

EndIf

Next

WEnd

Edited by fxg4758
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...