dexxa Posted January 2, 2007 Posted January 2, 2007 (edited) i am writing this sudoku script just for fun. i wrote it so that when u click on a button/number, a child window will come up and give u 9 numbers to select. the problem is that the child window sometimes doesnt come up and i get stucked in an infinite loop. i cant figure out why it wouldnt come up. thank you in advance expandcollapse popup#include <guiconstants.au3> Global $b[3][3][3][3] Global $selected_numb = 0 $parent = GUICreate("Sudoku by me", 290,290,100,100) GUISetState() $labels = 1 For $square = 0 To 2 For $i = 0 To 2 For $j = 0 To 2 For $k = 0 to 2 $b[$square][$i][$j][$k] = GUICtrlCreateButton("",($i*100)+($k*30),($square*100)+($j*30),30,30);create buttons ;~ TrayTip("",$square&","&$i&","&$j&","&$k,1) If $labels = 9 Then $labels = 0 EndIf $labels += 1 ;~ sleep(500) Next Next Next Next While 1 $msg = GUIGetMsg() If $msg = $Gui_Event_Close Then Exit EndIf For $big_row = 0 to 2 For $big_column = 0 to 2 For $row = 0 to 2 For $column = 0 to 2 If $msg = $b[$big_row][$big_column][$row][$column] Then $ctrlpos = ControlGetPos("Sudoku by me","",$b[$big_row][$big_column][$row][$column]) $winpos = WinGetPos("Sudoku by me") $child = GUICreate("",30,121,$ctrlpos[0]+$winpos[0]+2,$ctrlpos[1]+$winpos[1]+25,BitOr($WS_POPUP,$WS_BORDER,$WS_EX_MDICHILD),-1,$parent);child window GUISetState(@SW_SHOW,$child) $numb = GUICtrlCreateList("",-1,-1,33,125);list of numbers GUICtrlSetData($numb,"1|2|3|4|5|6|7|8|9") GUICtrlSetState($numb,bitor($GUI_FOCUS,$GUI_ONTOP)) $selected_numb = 0 While $selected_numb = 0 $selected_numb = GUICtrlRead($numb) WEnd GUIDelete($child) GUICtrlSetData($b[$big_row][$big_column][$row][$column],$selected_numb) EndIf Next Next Next Next WEnd Edited January 2, 2007 by dexxa
Uten Posted January 2, 2007 Posted January 2, 2007 Are you able to give us a sample on how to get it stuck? I have tried your code and I don't get stuck. Do I have to hit keys, right or left click? Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
_Kurt Posted January 2, 2007 Posted January 2, 2007 (edited) Hey I looked over the Child GUI part of the script and, I attempted to fix your problem. Try to replace this:GUISetState(@SW_SHOW,$child) $numb = GUICtrlCreateList("",-1,-1,33,125);list of numbers GUICtrlSetData($numb,"1|2|3|4|5|6|7|8|9") GUICtrlSetState($numb,bitor($GUI_FOCUS,$GUI_ONTOP)) $selected_numb = 0 While $selected_numb = 0 $selected_numb = GUICtrlRead($numb) WEnd GUIDelete($child) GUICtrlSetData($b[$big_row][$big_column][$row][$column],$selected_numb)UNTESTED*EDIT* Your script seems work perfectly either way (maybe yours was missing an ExitLoop).Hope it works Kurt Edited January 2, 2007 by _Kurt Awaiting Diablo III..
dexxa Posted January 2, 2007 Author Posted January 2, 2007 i would click on a button in the parent window and the child window wouldnt come out. then i would get stucked at the small while loop. anyway kurt's code fixed it. thank you.
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