CodyBarrett Posted November 12, 2008 Posted November 12, 2008 yeah... VERY simple question eh? well i dont understand how to make a save button save whats in a inputbox into a .ini file... i cant even make it so when u hit SAVE a msg box pops up... can you guys teach me how to make a GUI button event? it would be very helpfull (help file doesnt help\i have searched the forums) thank you guys [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Achilles Posted November 12, 2008 Posted November 12, 2008 What code do you have now? My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
CodyBarrett Posted November 12, 2008 Author Posted November 12, 2008 Here is my code for my GUI.... i need help with the buttons and the saving and loading .ini, but once i learn how to do the button i should figure out the rest eventually expandcollapse popup; This script shows manual positioning of all controls; ; there are much better methods of positioning... #include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <ButtonConstants.au3> Global $personalinput = GuiCtrlCreateInput(" ", 0, 130, 400, 200) Global $addmembers Global $deletemembers Global $memberinput DirCreate("C:\GUILDINFO") If FileExists("C:\guildinfo\C members.ini") Then MsgBox(0, "Current Members.ini", "DOES Exist") Else MsgBox(64,"no", "Does NOT exists") IniWrite("C:\guildinfo\C members.ini", "CURRENT", "key", "*") MsgBox(64,"NOW", "it exists") EndIf If FileExists("C:\guildinfo\Deserters.ini") Then MsgBox(0, "Deserters.ini", "DOES Exist") Else MsgBox(64,"no", "Does NOT exists") IniWrite("C:\guildinfo\Deserters.ini", "DESERTERS", "key", "*") MsgBox(64,"NOW", "it exists") EndIf If FileExists("C:\guildinfo\Personal.ini") Then MsgBox(0, "Personal.ini", "DOES Exist") Else MsgBox(64,"no", "Does NOT exists") IniWrite("C:\guildinfo\Personal.ini", "Personal", "key", "*") MsgBox(64,"NOW", "it exists") EndIf ; GUI GuiCreate("GUILD INFORMATION", 400, 400) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) ; PIC GuiCtrlCreatePic("guild.bmp",0,0, 399,79) ; TAB GuiCtrlCreateTab(0, 80) GuiCtrlCreateTabItem("Personal") ; INPUT GuiCtrlCreateInput(" ", 0, 130, 400, 200) ; BUTTON GuiCtrlCreateButton("SAVE", 0, 350, 100, 30) Func save() Local $SAVE = GuiCtrlCreateButton("SAVE", 0, 350, 100, 30) GUICtrlSetOnEvent(1, "SAVEPressed") GUISetState(@SW_SHOW) ; Just idle around While 1 Sleep(10) WEnd EndFunc ;==>Example Func SAVEPressed() MsgBox(0, "SAVED") EndFunc ;==>SAVEPressed ; TAB GuiCtrlCreateTab(0, 80) GuiCtrlCreateTabItem("Guild") ; LABLE GUICtrlCreateLabel("GUILD LISTINGS", 10, 110, 150, 50) ; INPUT GuiCtrlCreateInput("Add\Delete Member", 0, 110, 224, 20) ; BUTTON GuiCtrlCreateButton("Add ", 226, 110, 80, 20) ; BUTTON GuiCtrlCreateButton("Delete", 306, 110, 80, 20) ; LIST VIEW $listView = GuiCtrlCreateListView("Member|Rank|Warnings|Test Taken|Gone", 0, 160, 399, 80) GuiCtrlCreateListViewItem("Bobc|1|0|0|0", $listView) GuiCtrlCreateListViewItem("Aniry|1|0|0|0", $listView) ; DATE GuiCtrlCreateDate("", 0, 380, 200, 20) ; GUI MESSAGE LOOP GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd please and thank you... (button presses but nothing else happens) [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
dbzfanatic Posted November 12, 2008 Posted November 12, 2008 You have two While loops. One will never end. You need only to have one.$nMsg = GUIGetMsg() Switch $nMsg Case $Button1 ;code here EndSwitch WEnd Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
CodyBarrett Posted November 12, 2008 Author Posted November 12, 2008 You have two While loops. One will never end. You need only to have one. $nMsg = GUIGetMsg() Switch $nMsg Case $Button1 ;code here EndSwitch WEnd uhhmmm please excuse me for asking... where do i put the lil bit of script u gave me... and i DO see where i dont need another WHILE thanks for pointing that out [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
dbzfanatic Posted November 12, 2008 Posted November 12, 2008 Try to keep all GUI stuff together,then your loop, then functions. It's easier to read. expandcollapse popupinclude <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <ButtonConstants.au3> Global $personalinput = GuiCtrlCreateInput(" ", 0, 130, 400, 200) Global $addmembers Global $deletemembers Global $memberinput DirCreate("C:\GUILDINFO") If FileExists("C:\guildinfo\C members.ini") Then MsgBox(0, "Current Members.ini", "DOES Exist") Else MsgBox(64,"no", "Does NOT exists") IniWrite("C:\guildinfo\C members.ini", "CURRENT", "key", "*") MsgBox(64,"NOW", "it exists") EndIf If FileExists("C:\guildinfo\Deserters.ini") Then MsgBox(0, "Deserters.ini", "DOES Exist") Else MsgBox(64,"no", "Does NOT exists") IniWrite("C:\guildinfo\Deserters.ini", "DESERTERS", "key", "*") MsgBox(64,"NOW", "it exists") EndIf If FileExists("C:\guildinfo\Personal.ini") Then MsgBox(0, "Personal.ini", "DOES Exist") Else MsgBox(64,"no", "Does NOT exists") IniWrite("C:\guildinfo\Personal.ini", "Personal", "key", "*") MsgBox(64,"NOW", "it exists") EndIf ; GUI GuiCreate("GUILD INFORMATION", 400, 400) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) ; PIC GuiCtrlCreatePic("guild.bmp",0,0, 399,79) ; TAB GuiCtrlCreateTab(0, 80) GuiCtrlCreateTabItem("Personal") ; INPUT GuiCtrlCreateInput(" ", 0, 130, 400, 200) ; BUTTON GuiCtrlCreateButton("SAVE", 0, 350, 100, 30) ; TAB GuiCtrlCreateTab(0, 80) GuiCtrlCreateTabItem("Guild") ; LABLE GUICtrlCreateLabel("GUILD LISTINGS", 10, 110, 150, 50) ; INPUT GuiCtrlCreateInput("Add\Delete Member", 0, 110, 224, 20) ; BUTTON GuiCtrlCreateButton("Add ", 226, 110, 80, 20) ; BUTTON GuiCtrlCreateButton("Delete", 306, 110, 80, 20) ; LIST VIEW $listView = GuiCtrlCreateListView("Member|Rank|Warnings|Test Taken|Gone", 0, 160, 399, 80) GuiCtrlCreateListViewItem("Bobc|1|0|0|0", $listView) GuiCtrlCreateListViewItem("Aniry|1|0|0|0", $listView) ; DATE GuiCtrlCreateDate("", 0, 380, 200, 20) ; GUI MESSAGE LOOP GuiSetS While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button1 ;code here EndSwitch WEnd Func save() Local $SAVE = GuiCtrlCreateButton("SAVE", 0, 350, 100, 30) GUICtrlSetOnEvent(1, "SAVEPressed") GUISetState(@SW_SHOW) EndFunc ;==>Example Func SAVEPressed() MsgBox(0, "SAVED") EndFunc ;==>SAVEPressed Cleaned slightly. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
CodyBarrett Posted November 12, 2008 Author Posted November 12, 2008 thanks i appreciate it .... EDIT i seem to have a problem... first i got * undeclared variable* so i fixed that... then the whole GUI didnt even show up im gonna play with it for a while [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
dbzfanatic Posted November 12, 2008 Posted November 12, 2008 Did you do the code for the GUI by hand or through Koda? Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
CodyBarrett Posted November 12, 2008 Author Posted November 12, 2008 i have KODA but i cannot make a button event on it either xD... i did this code bye copying the example GUI and remaking it ( 'cause i just learned how to do GUI like 2 days ago but still haveing trouble).. i did it by hand.... most of it [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
dbzfanatic Posted November 12, 2008 Posted November 12, 2008 For Koda just double click your button and set the event to notify. If you want to do the even by hand just do Case $button_name ;code for event Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
CodyBarrett Posted November 12, 2008 Author Posted November 12, 2008 hmmm i still dont get KODA.... (thickskull eh?) illl stick to SCITE for right now [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
dbzfanatic Posted November 12, 2008 Posted November 12, 2008 Koda is really simple. Open Koda, design your GUI, save if you intend to edit later, press F9, click "Insert into SciTE",and your GUI code will be added at the cursor position. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
CodyBarrett Posted November 12, 2008 Author Posted November 12, 2008 Koda is really simple. Open Koda, design your GUI, save if you intend to edit later, press F9, click "Insert into SciTE",and your GUI code will be added at the cursor position.well.... ok... ill try that later, but i still cant make the buttons have the event i want. i even copeid from some other examples and edited it so it should work.... oh gawd. how do i tell it---- "when button is clicked, do this"---- everytime i try it always seems to do the action BEFORE i click it, like it starts up that way. help? please lol before i start whining xD, ok i got myself under control. anyway any ideas? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
dbzfanatic Posted November 12, 2008 Posted November 12, 2008 I already told you how. Put the Case statements in your While 1 loop, put the code on the line below, then you have a working event. See demo below. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 256, 124, 193, 115) $Input1 = GUICtrlCreateInput("Input1", 16, 24, 121, 21) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 48, 80, 97, 17) $Button1 = GUICtrlCreateButton("Button1", 152, 32, 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(0,"Button 1","Button 1 was clicked") Case $Checkbox1 MsgBox(0,"Checkbox 1","Checkbox 1 is " & GUICtrlRead($Checkbox1)) Case $Input1 MsgBox(0,"Input 1","You typed: " & GUICtrlRead($Input1)) EndSwitch WEnd Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
CodyBarrett Posted November 12, 2008 Author Posted November 12, 2008 wow... well thanks i got it now i dont see how i missed it before... thankyou for your pasience [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
dbzfanatic Posted November 12, 2008 Posted November 12, 2008 You're welcome. Please try to keep up with the big kids next time lol (just teasing) but I'm glad you understand. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
CodyBarrett Posted November 13, 2008 Author Posted November 13, 2008 well now.. i got that... (technically this is still in this topic) how would i go about saveing an edit box into an .ini file once the SAVE button is pressed i tryed INIWRITE("guild.ini", $editbox) but whenever i do that and i open the ini i always see a numeric value like (6) or (7) any hints? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
dbzfanatic Posted November 13, 2008 Posted November 13, 2008 GuiCtrlRead($editbox) instead of $editbox Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
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