Gadget Actions
BlitzPlus Forums/BlitzPlus Programming/Gadget Actions
| ||
Why is it that I have to press a button twice to get it to work? What have I done wrong? lol. mainWindow=CreateWindow( "Game Project Manager",0,0,800,600,0,13 ) treeview=CreateTreeView(0, 0, 250, 500, mainWindow) artNode=AddTreeViewNode("Art",TreeViewRoot(treeview)) art1=AddTreeViewNode("Modelling",artNode) art2=AddTreeViewNode("Texturing",artNode) art3=AddTreeViewNode("Animation",artNode) art4=AddTreeViewNode("Testing",artNode) codeNode=AddTreeViewNode("Code",TreeViewRoot(treeview)) code1=AddTreeViewNode("3D Engine",codeNode) code2=AddTreeViewNode("GUI",codeNode) code3=AddTreeViewNode("Networking",codeNode) code4=AddTreeViewNode("Tools",codeNode) addTaskWin=CreateWindow("Add Task", 0, 0, 400, 200, 0, 13) HideGadget addTaskWin addTaskButt=CreateButton("Add Task", 1, 502, 100, 25, mainWindow, 1) SelectTreeViewNode artNode Repeat ; - MAIN LOOP - FlushEvents() ; Wait till someone presses that important X! If WaitEvent()=$803 If EventSource()=mainWindow Exit Else HideGadget EventSource() EnableGadget mainwindow ActivateWindow mainWindow End If Else If WaitEvent()=$401 ; - Wait till someone presses the Add Task button If EventSource()=addTaskButt DisableGadget mainWindow ShowGadget addTaskWin End If End If Forever End ; - QUIT |
| ||
here you go, this is from the repeat down:Repeat ; - MAIN LOOP - ;No need to flush events. ;FlushEvents() ; Wait till someone presses that important X! ;Use wait event only once.. ThisEvent = WaitEvent() If ThisEvent=$803 If EventSource()=mainWindow Exit Else HideGadget EventSource() EnableGadget mainwindow ActivateWindow mainWindow End If Else If ThisEvent=$401 ; - Wait till someone presses the Add Task button If EventSource()=addTaskButt DisableGadget mainWindow ShowGadget addTaskWin End If End If Forever End ; - QUIT Everytime you use waitevent the program stops until someone does something. Even though you checked for an event on one waitevent, it wont stay in the event queue when you call waitevent again.. Meaning that the user will have to press the button again on the second waitevent to queue up the event again. Hope this helps. |
| ||
Ohhhh, thank you very much! :D |