gianfun Posted July 23, 2007 Share Posted July 23, 2007 (edited) hi people. i have 2/3 questions. 1) is $i a "special" variable. like $gui_event_close, or is it ALWAYS used only because it is easy to remember 2)how do i make Grids or "color / colour" boxes that are clickable / moveable (movable?) , like the ones in Tetris(movable) and A * Searching Algorithm(clickable)?? do i have to use arrays? i had a look at the A * Searching Algorithm script, and i saw he used arrays to make a square, i tried understanding it, but i had no luck. could someone help me understand it? like if i click a square in a grid, it changes colour. thanks ps. i didnt search for the $i, because i had no idea what to search. if i search $i, all topics that have that in the script will appear, and LOTS of scripts have them ps². i searched for color boxes and arrays. color boxes didnt give me what i wanted, and the array gave me This Link, which i am "studying" now. edit: changed "description" of what im looking for Edited July 23, 2007 by gianfun My own pocket emo http://www.mindistortion.net/pocketemo/?da...1-7-2-0-0-1-0-0LOL[quote name='beerman' post='399180' date='Sep 6 2007, 08:45 AM']I have learned, never think inside the box. The moment you have a bright idea, and stand up to quickly exclaiming, "Eureka, I have it!". You will knock yourself out, from bashing your head on the inside of the box as you stand... So in conclusion it is always safer to think outside the box. :)[/quote] Link to comment Share on other sites More sharing options...
weaponx Posted July 23, 2007 Share Posted July 23, 2007 $i is just a temporary variable name. Generally you use single letter variables in loops to represent an incremental number. Link to comment Share on other sites More sharing options...
gianfun Posted July 23, 2007 Author Share Posted July 23, 2007 $i is just a temporary variable name. Generally you use single letter variables in loops to represent an incremental number.Thanks My own pocket emo http://www.mindistortion.net/pocketemo/?da...1-7-2-0-0-1-0-0LOL[quote name='beerman' post='399180' date='Sep 6 2007, 08:45 AM']I have learned, never think inside the box. The moment you have a bright idea, and stand up to quickly exclaiming, "Eureka, I have it!". You will knock yourself out, from bashing your head on the inside of the box as you stand... So in conclusion it is always safer to think outside the box. :)[/quote] Link to comment Share on other sites More sharing options...
weaponx Posted July 23, 2007 Share Posted July 23, 2007 I don't really have a clue what you are looking for but you can alternate background colors in a gridview like this: ; example 1 #include <GUIConstants.au3> GUICreate("My GUI") ; will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box $LV = GUICtrlCreateListView ( "Column 1|Column 2|Column 3", 10,10,380,380) GuiCtrlSetBkColor(-1,0xFFFFFF) $FLIP = 0 For $X = 1 to 10 If $FLIP = 0 Then $BGCOLOR = 0xFFFFFF $TEXTCOLOR = 0x000000 $FLIP = 1 Else $BGCOLOR = 0x000000 $TEXTCOLOR = 0xFFFFFF $FLIP = 0 EndIf $ITEM = GUICtrlCreateListViewItem ( "text" & $X, $LV) GuiCtrlSetBkColor(-1,$BGCOLOR) GUICtrlSetColor(-1,$TEXTCOLOR) Next ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Link to comment Share on other sites More sharing options...
gianfun Posted July 23, 2007 Author Share Posted July 23, 2007 like if i click a square in a grid, it changes colour. (changed 1st post also0 My own pocket emo http://www.mindistortion.net/pocketemo/?da...1-7-2-0-0-1-0-0LOL[quote name='beerman' post='399180' date='Sep 6 2007, 08:45 AM']I have learned, never think inside the box. The moment you have a bright idea, and stand up to quickly exclaiming, "Eureka, I have it!". You will knock yourself out, from bashing your head on the inside of the box as you stand... So in conclusion it is always safer to think outside the box. :)[/quote] Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 23, 2007 Share Posted July 23, 2007 Just for fun... expandcollapse popup#include <GUIConstants.au3> Opt("GuiOnEventMode", 1) Global $avSquares[5] = [4] Global $avSquareColor[5] = [4, 1, 2, 3, 4] Global $avColors[6] = [5, 0x000000, 0xffffff, 0xFF0000, 0x00FF00, 0x0000FF] $hGUI = GUICreate("Clickable Squares", 230, 230) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") $avSquares[1] = GUICtrlCreateGraphic(10, 10, 100, 100) GUICtrlSetOnEvent(-1, "_SquareClick") $avSquares[2] = GUICtrlCreateGraphic(120, 10, 100, 100) GUICtrlSetOnEvent(-1, "_SquareClick") $avSquares[3] = GUICtrlCreateGraphic(10, 120, 100, 100) GUICtrlSetOnEvent(-1, "_SquareClick") $avSquares[4] = GUICtrlCreateGraphic(120, 120, 100, 100) GUICtrlSetOnEvent(-1, "_SquareClick") GUISetState() For $n = 1 To 4 ControlClick($hGUI, "", $avSquares[$n]) Next While 1 Sleep(20) WEnd Func _SquareClick() For $n = 1 To 4 If @GUI_CtrlId = $avSquares[$n] Then $avSquareColor[$n] += 1 If $avSquareColor[$n] > 5 Then $avSquareColor[$n] = 1 GUICtrlSetBkColor($avSquares[$n], $avColors[$avSquareColor[$n]]) ExitLoop EndIf Next EndFunc ;==>_SquareClick Func _Quit() Exit EndFunc ;==>_Quit 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 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