DesireDenied Posted September 27, 2007 Posted September 27, 2007 expandcollapse popup#include <GUIConstants.au3> $box = 6 $i = 0 $Form1 = GUICreate("", 118, 140, 197, 137) $Label1 = GUICtrlCreateLabel("How to?", 8, 8, 100, 17, BitOR($SS_CENTER,$SS_SUNKEN)) $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 35, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 41, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 47, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 53, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 59, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 65, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 71, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 77, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 83, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 89, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 95, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 101, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 107, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 113, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 119, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next $x = 0 For $i = 0 To 32 $square1 = GUICtrlCreateLabel("", 8+$x, 125, $box, $box,$SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $i = $i + 1 $x = $x + $box Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $square1 GUICtrlSetBkColor($square1, 0x0000FF) EndSwitch WEndoÝ÷ Ù³ÑR[öî®
DesireDenied Posted September 27, 2007 Author Posted September 27, 2007 (edited) already solved my problem in this way Global $x, $y, Global $step = 8 Global $box = 8 Dim $square[193][193] For $x = 0 To 32*6 Step 6 For $y = 0 To 32*6 Step 6 $square[$x][$y] = GUICtrlCreateLabel("",8+$x, 35+$y, $box, $box, $SS_SUNKEN) GUICtrlSetBkColor(-1, 0xFF0000) $step = $step+8 Next Next Edited September 27, 2007 by DesireDenied
smashly Posted September 27, 2007 Posted September 27, 2007 (edited) Hi, But anyways hope it helps.. expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Global $Label[273][2], $lx = 8, $ly = 35, $box = 6 $Form1 = GUICreate("", 118, 140, 197, 137) $Label1 = GUICtrlCreateLabel("How to?", 8, 8, 100, 17, BitOR($SS_CENTER,$SS_SUNKEN)) For $i = 1 To 272 $Label[$i][0] = GUICtrlCreateLabel("", $lx, $ly, $box, $box,$SS_SUNKEN) GUICtrlSetOnEvent(-1, "Labels") GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetTip(-1, "Square: " & $i & @LF & "Color: Red") $lx += $box If mod($i, 17) = 0 Then $lx = 8 $ly += $box EndIf Next GUISetOnEvent($GUI_EVENT_CLOSE, "Close", $Form1) GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func Labels() For $i = 1 To 272 If @GUI_CtrlId = $Label[$i][0] Then If $Label[$i][1] = 0 Then $Label[$i][1] = 1 GUICtrlSetBkColor($Label[$i][0], 0x0000FF) GUICtrlSetTip($Label[$i][0], "Square: " & $i & @LF & "Color: Blue") Else $Label[$i][1] = 0 GUICtrlSetBkColor($Label[$i][0], 0xFF0000) GUICtrlSetTip($Label[$i][0], "Square: " & $i & @LF & "Color: Red") EndIf EndIf Next EndFunc Func Close() Exit EndFunc Cheers Edit changed the amount of labels to match the same amount as your original. Edit again: I liked argumentum post below for the tooltip idea so I added tooltips to the labels PS. argumentum The button change color you did doesn't work for me, but your tooltips work well Edited September 27, 2007 by smashly
argumentum Posted September 27, 2007 Posted September 27, 2007 #include <GUIConstants.au3> $Form1 = GUICreate("", 118, 140, 197, 137) $Label1 = GUICtrlCreateLabel("How to?", 8, 8, 100, 17, BitOR($SS_CENTER,$SS_SUNKEN)) GUISetState(@SW_SHOW) Const $Width = 8 FOR $Row = 35 TO 16 * $Width STEP $Width FOR $Column = 8 TO 13 * $Width STEP $Width Assign("Square"&Execute($Column -8) / 8 &"_"&Execute($Row - 35) / 8 , GUICtrlCreateLabel("", $Column, $Row, 8, 8,$SS_SUNKEN) ) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetTip(-1,"Square"&Execute($Column -8) / 8 &"_"&Execute($Row - 35) / 8 ) NEXT NEXT While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case Eval("square1_1") GUICtrlSetBkColor(Eval("square1_1"), 0x0000FF) Case Eval("square3_3") GUICtrlSetBkColor(Eval("square3_3"), 0x0000FF) EndSwitch WEnd Exit well, maybe this helps you in your code, is all I can do, best of luck Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting
DesireDenied Posted September 28, 2007 Author Posted September 28, 2007 THANKS guys, you helped me a lot. was having some difficulties on see entire "picture", now i got how it works. regards DesireDenied
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