Aceguy Posted July 31, 2008 Share Posted July 31, 2008 (edited) when i used this on my laptop, the console reports different numbers...... so i concluded that this way is unreliable.................????? #include<ButtonConstants.au3> #include<GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 333, 445, 370, 172) dim $Pic1[7] dim $but[7] $y=0 for $ct = 1 to 6 $Pic1[$ct]= GUICtrlCreatelabel("", 28, 28+$y, 40, 40) GUICtrlSetBkColor(-1,0x000000) GUICtrlSetState(-1, $GUI_DISABLE) $but[$ct] = GUICtrlCreateButton("",32,32+$y,32,32, $BS_ICON) GUICtrlSetImage (-1,"C:\Users\Ace - PC\Documents\5_audiodev.ico") GUICtrlSetOnEvent(-1,"pressed") $y+=42 Next GUISetState(@SW_SHOW) While 1 sleep(50) WEnd Func pressed() ConsoleWrite("Pressed"&@lf) local $iD = @GUI_CtrlId for $x=1 to 12 if $x= $iD then MsgBox(0,"",$iD,0) Next EndFunc Edited August 1, 2008 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
picaxe Posted July 31, 2008 Share Posted July 31, 2008 This works for me#include<ButtonConstants.au3> #include<GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 333, 445, 370, 172) Dim $Pic1[7] Dim $but[7] $y = 0 For $ct = 1 To 6 $Pic1[$ct] = GUICtrlCreateLabel("", 28, 28 + $y, 40, 40) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetState(-1, $GUI_DISABLE) $but[$ct] = GUICtrlCreateButton("", 32, 32 + $y, 32, 32, $BS_ICON) ConsoleWrite("Button" & $ct & " ControlID" & $ct & "=" & $but[$ct] & @LF) GUICtrlSetImage(-1, "C:\Users\Ace - PC\Documents\5_audiodev.ico") GUICtrlSetOnEvent(-1, "pressed") $y += 42 Next GUISetState(@SW_SHOW) While 1 Sleep(50) WEnd Func pressed() Local $iD = @GUI_CtrlId For $x = 1 To 6 If $iD = $but[$x] Then ConsoleWrite("Button" & $x & " pressed" & @LF) Next EndFunc ;==>pressed Link to comment Share on other sites More sharing options...
Aceguy Posted July 31, 2008 Author Share Posted July 31, 2008 THANKS VM. This is my idea. so far. expandcollapse popup#include<ButtonConstants.au3> #include<GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 333, 445, 370, 172) $buttons=10 dim $Pic1[$buttons+1] dim $but[$buttons+1] $set=0 $last=0 $y=0 for $ct = 1 to $buttons $Pic1[$ct]= GUICtrlCreatelabel("", 4, 4+$y, 40, 40) GUICtrlSetState(-1, $GUI_DISABLE) $but[$ct] = GUICtrlCreateButton("",8,8+$y,32,32, $BS_ICON) GUICtrlSetImage (-1,"C:\Users\Ace - PC\Documents\5_audiodev.ico") GUICtrlSetOnEvent(-1,"pressed") $y+=42 Next GUISetState(@SW_SHOW) While 1 sleep(50) WEnd Func pressed() local $iD = @GUI_CtrlId for $x=1 to ($buttons) if $iD= $but[$x] then ConsoleWrite("BLACK iD -->"&$iD&" X --->"&$x&" Setting ---> "&(int($iD/2)-1)&@lf) GUICtrlSetBkColor($Pic1[(int($iD/2)-1)],0x000000) $set=int($iD/2)-1 EndIf if $last<>$set then GUICtrlSetBkColor($Pic1[$last],0xffffff) Next $last=$set EndFunc [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
picaxe Posted July 31, 2008 Share Posted July 31, 2008 Thats nice Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now