DarkBoost Posted October 2, 2008 Share Posted October 2, 2008 (edited) This is my first attempt at creating a GUI and have drawn up what I am trying to achieve. Any thoughts regarding how I should tackle the coding would be greatly appreciated. Edited October 2, 2008 by DarkBoost Link to comment Share on other sites More sharing options...
Achilles Posted October 2, 2008 Share Posted October 2, 2008 Have you tried Koda at all? It comes with scite... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
DarkBoost Posted October 7, 2008 Author Share Posted October 7, 2008 I have found endless examples/tutorials of how to create a GUI window but none which show how to program them. Example 1. How to add a checkbox but not how to program it when it is ticked/unticked Example 2. How to add a button but now how to program it when a user clicks on it. Is there any examples/tutorials which will take you past creating the GUI and onto coding it? Sucks being a noob :-( Link to comment Share on other sites More sharing options...
Cdma1X Posted October 7, 2008 Share Posted October 7, 2008 after creating the gui with koda generate the code. example of gui with a button #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 268, 210, 252, 172) $Button1 = GUICtrlCreateButton("Button1", 96, 72, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd now if you want to show a message box on clicking the button then #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 268, 210, 252, 172) $Button1 = GUICtrlCreateButton("Button1", 96, 72, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(64, "Test", "Button is working and will timeout in 10sec.", 10) EndSwitch WEnd see the difference line 15-18 to know how "Cases" works! Link to comment Share on other sites More sharing options...
Cdma1X Posted October 7, 2008 Share Posted October 7, 2008 i think i could not understand what you really want to achieve/accomplish. can you explain your problem? i think you want to know how controls/buttons works.... Link to comment Share on other sites More sharing options...
crzftx Posted October 7, 2008 Share Posted October 7, 2008 There is something wrong with this forum... Everything is continually freezing. Here's my attempt, hope you learn best by example: expandcollapse popupOpt("GUIOnEventMode",1) Global $guiMain, $labelInstalled[5], $buttonInstall[5] $guiMain = GUICreate("Application GUI",345,150) GUICtrlCreateLabel("Notepad",5,5,100,20) GUICtrlCreateLabel("App 2",5,35,100,20) GUICtrlCreateLabel("App 3",5,65,100,20) GUICtrlCreateLabel("App 4",5,95,100,20) GUICtrlCreateLabel("App 5",5,125,100,20) For $z = 0 To 4 $labelInstalled[$z] = GUICtrlCreateLabel("Installed",120,5 + 30 * $z,100,20) GUICtrlSetColor(-1,0x00FF00) $buttonInstall[$z] = GUICtrlCreateButton("Remove",240,5 + 30 * $z,100,20) GUICtrlSetOnEvent(-1,"InstallApp") Next GUISetOnEvent(-3,"Quit") GUISetState() While 1 Sleep(25) WEnd Func InstallApp() Local $index = (@GUI_CtrlId - $buttonInstall[0])/2 If GUICtrlRead($labelInstalled[$index]) = "Installed" Then GUICtrlSetData($labelInstalled[$index],"Not Installed") GUICtrlSetColor($labelInstalled[$index],0xFF0000) GUICtrlSetData($buttonInstall[$index],"Install") Else GUICtrlSetData($labelInstalled[$index],"Installed") GUICtrlSetColor($labelInstalled[$index],0x00FF00) GUICtrlSetData($buttonInstall[$index],"Remove") EndIf EndFunc Func Quit() Exit EndFunc 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