FireFox Posted September 1, 2013 Share Posted September 1, 2013 (edited) What's the minimum number of GUI-s that would require GUISetState with array?The array is only for the return values of GUIGetMsg WITH the advanced mode, read the helpfile again and again. Edano did on the first page a script with 2 GUI-s, but no arrays. Means 3 require an array?I don't see that. And no, it has nothing to deal with how many GUIs you are using but the way you use the GUIGetMsg function and if you are using the event mode or not.Br, FireFox. Edited September 1, 2013 by FireFox Link to comment Share on other sites More sharing options...
FireFox Posted September 1, 2013 Share Posted September 1, 2013 (edited) All I can see is that you are making assumptions on functions without reading the helpfile for them; try the examples to see how it works. Edited September 1, 2013 by FireFox Link to comment Share on other sites More sharing options...
CroatianPig Posted September 1, 2013 Author Share Posted September 1, 2013 (edited) All I can see is that you are making assumptions on functions without reading the helpfile for them, trying the examples to see how it works. Ok I go read again. This ok? http://www.autoitscript.com/wiki/Managing_Multiple_GUIs Edited September 1, 2013 by CroatianPig YES, I know I ask facepalm questions. YES, I know you asked the God why I had to register to the forum where normal people are. YES, I know everything! Link to comment Share on other sites More sharing options...
CroatianPig Posted September 1, 2013 Author Share Posted September 1, 2013 (edited) What happens when function ends? Does it continue at that line, or it returns 1 step after we started the function? Example... What's the next that happens here? ..... ..... ...... bla bla bla While 1 Switch bla bla bla Case bla bla func() Msgbox (1) <------------ EndSwitch WEnd Func func() bla bla bla EndFunc Msgbox (2) <----------- After the function ends, will I get the msgbox 1 or 2? 1 right? Edited September 1, 2013 by CroatianPig YES, I know I ask facepalm questions. YES, I know you asked the God why I had to register to the forum where normal people are. YES, I know everything! Link to comment Share on other sites More sharing options...
CroatianPig Posted September 1, 2013 Author Share Posted September 1, 2013 (edited) This is the script from that page: expandcollapse popup#include <GUIConstantsEx.au3> Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements gui1() Func gui1() $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100) $hButton1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30) $hButton2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30) GUISetState() While 1 $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array Switch $aMsg[1] ; check which GUI sent the message Case $hGUI1 Switch $aMsg[0] ; Now check for the messages for $hGUI1 Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit <<<<<<<<<<<<<<< ExitLoop Case $hButton1 MsgBox("", "MsgBox 1", "Test from Gui 1") Case $hButton2 GUICtrlSetState($hButton2, $GUI_DISABLE) gui2() EndSwitch Case $hGUI2 Switch $aMsg[0] ; Now check for the messages for $hGUI2 Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<< GUIDelete($hGUI2) GUICtrlSetState($hButton2, $GUI_ENABLE) Case $hButton3 MsgBox("", "MsgBox", "Test from Gui 2") EndSwitch EndSwitch WEnd EndFunc ;==>gui1 Func gui2() $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350) $hButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30) GUISetState() EndFunc ;==>gui2 The [0] isnt decleared, only [1], but it works. Edited September 1, 2013 by CroatianPig YES, I know I ask facepalm questions. YES, I know you asked the God why I had to register to the forum where normal people are. YES, I know everything! Link to comment Share on other sites More sharing options...
BrewManNH Posted September 1, 2013 Share Posted September 1, 2013 What happens when function ends? Does it continue at that line, or it returns 1 step after we started the function? Example... What's the next that happens here? ..... ..... ...... bla bla bla While 1 Switch bla bla bla Case bla bla func() Msgbox (1) <------------ EndSwitch WEnd Func func() bla bla bla EndFunc Msgbox (2) <----------- After the function ends, will I get the msgbox 1 or 2? 1 right? You will always get the first message box because you're inside the While loop with no way out of it. MsgBox 2 will never execute because of this. When a function ends, it returns back to the main program. EndFunc acts like the Return statement. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
NewPlaza Posted September 2, 2013 Share Posted September 2, 2013 (edited) This may be a bit off topic but I must say CroatianPig, you definitely have determination. Good for you. Edited September 2, 2013 by NewPlaza Link to comment Share on other sites More sharing options...
CroatianPig Posted September 2, 2013 Author Share Posted September 2, 2013 I got it working with 2 GUI-s. expandcollapse popup; ; ; ; ; ; IMPORTANT: Has 7 GUI-s: ; 1. GUI 1 is just to start ; 2. GUI 2 is the main window where products should be chosen ; 3. GUI 3 is where all the non-alcoholic drinks are ; 4. GUI 4 is where all alcoholic drinks are ; 5. GUI 5 IS A GUI WITH VARIABLE INPUT, for quantity, and price ; 6. GUI 6 is where a new product should be entered ; 7. GUI 7 is where a person can see the storehouse wares (to know for example, which items to order) ; This is the INI file we will write to. It will be created on the Desktop. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> Global Const $SS_CENTER = 1 Global Const $SS_CENTERIMAGE = 1 Global $GUI_2 = 9999, $storehouse = 9999 Global $GUI_storehouse = 9999, $exit_storehouse = 9999 Local $sIni = @DesktopDir & "\AutoIt-Test.ini" Local $Section = "Coca Cola" Local $Code = "018719" Local $Quantity = "312"; It would be best to keep intergers from strings. Local $QuantityType = "0,25l Bottles"; It would be best to keep intergers from strings. ;Demonstrate creating a new section using a string as input. IniWrite($sIni, $Section, "Code", $Code) IniWrite($sIni, $Section, "Quantity", $Quantity) IniWrite($sIni, $Section, "QuantityType", $QuantityType) Global $colors_green = 0x00FF00 Global $colors_yellow = 0xFFFF00 Global $colors_red = 0xFF0000 Global $colors_black = 0x000000 ;GUI_1: $GUI_1= GUICreate("BEN", 400, 300, Default, Default) ;==> draws GUI GUISetBkColor(0x000000) GUISetFont(14, 400, "", "Cambria") ;GUI_1_buttons: $GUI_1_start= GUICtrlCreateButton("Ulaz", 20, 25, 360, 120) GUICtrlSetFont(-1, 40, 800) GUICtrlSetBkColor(-1, $colors_green) $GUI_1_exit= GUICtrlCreateButton("Izlaz", 20, 155, 360, 120) GUICtrlSetFont(-1, 40, 800) GUICtrlSetBkColor(-1, $colors_yellow) ;GUISetState() gui_1() Func gui_1() GUISetState() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $GUI_1 Switch $msg[0] ; Now check for the messages for $hGUI1 Case $GUI_1_start gui_2() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_1_exit ExitLoop EndSwitch Case $GUI_2 Switch $msg[0] ; Now check for the messages for $hGUI2 Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<< GUIDelete($GUI_2) GUICtrlSetState($GUI_1_start, $GUI_ENABLE) Case $storehouse MsgBox("", "MsgBox", "Test from Gui 2") EndSwitch EndSwitch WEnd EndFunc Func gui_2() $GUI_2= GUICreate("Main window", 1800, 900, Default, Default) $no_alcohol = GUICtrlCreateButton("Non-alcohol", 20, 20, 200, 200) GUISetState() EndFunc ;==>gui2 ;GUI_2: $GUI_2= GUICreate("Main window", 1800, 900, Default, Default) GUISetBkColor($colors_black) GUISetFont(14, 400, "", "Cambria") ;GUI_2_buttons: $no_alcohol = GUICtrlCreateButton("Non-alcohol", 20, 20, 200, 200) GUICtrlSetFont(-1, 16, 800) GUICtrlSetBkColor(-1, $colors_green) $alcohol = GUICtrlCreateButton("Alcohol", 240, 20, 200, 200) GUICtrlSetFont(-1, 16, 800) GUICtrlSetBkColor(-1, $colors_green) $storehouse = GUICtrlCreateButton ("Storehouse", 1260, 20, 300, 300) GUICtrlSetFont (-1, 16, 800) GUICtrlSetBkColor (-1, $colors_green) $finish = GUICtrlCreateButton("Finish", 40, 740, 1720, 80) ;GUI_7: ;$GUI_storehouse = GUICreate("Storehouse", 1400, 900, Default, Default) ;==> draws GUI ;GUISetBkColor(0x000000) ;GUISetFont(14, 400, "", "Cambria") ;GUI_7_buttons: ;$exit_storehouse = GUICtrlCreateButton("Exit", 20, 20, 200, 200) ;GUICtrlSetFont(-1, 16, 800) ;GUICtrlSetBkColor(-1, $colors_green) #cs ;GUI_2_labels: GUICtrlCreateLabel("I", 200, 10, 450, 100) GUICtrlSetFont(-1, 16, 800) GUICtrlSetColor(-1, $colors_green) GUICtrlCreateLabel("Wares", 45, 60, 450, 50) GUICtrlSetFont(-1, 12, 800) GUICtrlSetColor(-1, $colors_green) GUICtrlCreateLabel("Prices", 350, 60, 450, 50) GUICtrlSetFont(-1, 12, 800) GUICtrlSetColor(-1, $colors_green) ;GUICtrlCreateLabel("2:", 490, 20, 450, 100) ;GUICtrlSetFont(-1, 20, 800) ;GUICtrlSetColor(-1, $colors_green) ;GUI_2_combos+inputs: Global $checkbox_1 = GUICtrlCreateCheckbox("", 10, 105, 20, 20) Global $item_1 = GUICtrlCreateCombo("1", 40, 100, 300, Default) ; create first item GUICtrlSetData(-1, "2|3|4|5|6|7|8|", "1") ; add other item snd set a new default GUICtrlSetFont(-1, 12, 600) Global $quantity_1= GUICtrlCreateInput( '', 345, 100, 160, 31) GUICtrlSetLimit(-1,10) #ce GUICtrlSetFont(-1, 12, 600) ;GUI_2_buttons: The point is that a user can always get from any GUI to any GUI indefinitely times, ie. never to be stuck in a script. Now I will try to put the 3. GUI (warehouse). YES, I know I ask facepalm questions. YES, I know you asked the God why I had to register to the forum where normal people are. YES, I know everything! Link to comment Share on other sites More sharing options...
CroatianPig Posted September 2, 2013 Author Share Posted September 2, 2013 I did it ! Here, it can go indefinitely long, but question please ! Maybe the first non-facepalm question I ask... First, here is the script: expandcollapse popup; ; ; ; ; ; IMPORTANT: Has 7 GUI-s: ; 1. GUI 1 is just to start ; 2. GUI 2 is the main window where products should be chosen ; 3. GUI 3 is where all the non-alcoholic drinks are ; 4. GUI 4 is where all alcoholic drinks are ; 5. GUI 5 IS A GUI WITH VARIABLE INPUT, for quantity, and price ; 6. GUI 6 is where a new product should be entered ; 7. GUI 7 is where a person can see the storehouse wares (to know for example, which items to order) ; This is the INI file we will write to. It will be created on the Desktop. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> Global Const $SS_CENTER = 1 Global Const $SS_CENTERIMAGE = 1 Global $GUI_2 = 9999 Global $storehouse = 9999 Global $GUI_storehouse = 9999 Global $no_alcohol = 9999 Global $storehouse_exit Local $sIni = @DesktopDir & "\AutoIt-Test.ini" Local $Section = "Coca Cola" Local $Code = "018719" Local $Quantity = "312"; It would be best to keep intergers from strings. Local $QuantityType = "0,25l Bottles"; It would be best to keep intergers from strings. ;Demonstrate creating a new section using a string as input. IniWrite($sIni, $Section, "Code", $Code) IniWrite($sIni, $Section, "Quantity", $Quantity) IniWrite($sIni, $Section, "QuantityType", $QuantityType) Global $colors_green = 0x00FF00 Global $colors_yellow = 0xFFFF00 Global $colors_red = 0xFF0000 Global $colors_black = 0x000000 ;GUI_1: $GUI_1= GUICreate("BEN", 400, 300, Default, Default) ;==> draws GUI GUISetBkColor(0x000000) GUISetFont(14, 400, "", "Cambria") ;GUI_1_buttons: $GUI_1_start= GUICtrlCreateButton("Ulaz", 20, 25, 360, 120) GUICtrlSetFont(-1, 40, 800) GUICtrlSetBkColor(-1, $colors_green) $GUI_1_exit= GUICtrlCreateButton("Izlaz", 20, 155, 360, 120) GUICtrlSetFont(-1, 40, 800) GUICtrlSetBkColor(-1, $colors_yellow) ;GUISetState() gui_1() Func gui_1() GUISetState() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $GUI_1 Switch $msg[0] ; Now check for the messages for $hGUI1 Case $GUI_1_start gui_2() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_1_exit ExitLoop EndSwitch Case $GUI_2 Switch $msg[0] ; Now check for the messages for $hGUI2 Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<< GUIDelete($GUI_2) GUICtrlSetState($GUI_1_start, $GUI_ENABLE) Case $no_alcohol gui_3() ;MsgBox("", "MsgBox", "Test from Gui 2") EndSwitch Case $GUI_storehouse Switch $msg[0] Case $storehouse_exit GUIDelete($GUI_storehouse) GUICtrlSetState($GUI_2, $GUI_ENABLE) EndSwitch EndSwitch WEnd EndFunc Func gui_2() $GUI_2= GUICreate("Main window", 1800, 900, Default, Default) $no_alcohol = GUICtrlCreateButton("Non-alcohol", 20, 20, 200, 200) GUISetState() EndFunc ;==>gui2 Func gui_3() $GUI_storehouse = GUICreate("Storehouse", 1400, 900, Default, Default) $storehouse_exit = GUICtrlCreateButton("Exit", 20, 20, 200, 200) GUISetState() EndFunc ;==>gui2 #cs ;GUI_2: $GUI_2= GUICreate("Main window", 1800, 900, Default, Default) GUISetBkColor($colors_black) GUISetFont(14, 400, "", "Cambria") ;GUI_2_buttons: $no_alcohol = GUICtrlCreateButton("Non-alcohol", 20, 20, 200, 200) GUICtrlSetFont(-1, 16, 800) GUICtrlSetBkColor(-1, $colors_green) $alcohol = GUICtrlCreateButton("Alcohol", 240, 20, 200, 200) GUICtrlSetFont(-1, 16, 800) GUICtrlSetBkColor(-1, $colors_green) $storehouse = GUICtrlCreateButton ("Storehouse", 1260, 20, 300, 300) GUICtrlSetFont (-1, 16, 800) GUICtrlSetBkColor (-1, $colors_green) #ce $finish = GUICtrlCreateButton("Finish", 40, 740, 1720, 80) ;GUI_7: ;$GUI_storehouse = GUICreate("Storehouse", 1400, 900, Default, Default) ;==> draws GUI ;GUISetBkColor(0x000000) ;GUISetFont(14, 400, "", "Cambria") ;GUI_7_buttons: ;$exit_storehouse = GUICtrlCreateButton("Exit", 20, 20, 200, 200) ;GUICtrlSetFont(-1, 16, 800) ;GUICtrlSetBkColor(-1, $colors_green) #cs ;GUI_2_labels: GUICtrlCreateLabel("I", 200, 10, 450, 100) GUICtrlSetFont(-1, 16, 800) GUICtrlSetColor(-1, $colors_green) GUICtrlCreateLabel("Wares", 45, 60, 450, 50) GUICtrlSetFont(-1, 12, 800) GUICtrlSetColor(-1, $colors_green) GUICtrlCreateLabel("Prices", 350, 60, 450, 50) GUICtrlSetFont(-1, 12, 800) GUICtrlSetColor(-1, $colors_green) ;GUICtrlCreateLabel("2:", 490, 20, 450, 100) ;GUICtrlSetFont(-1, 20, 800) ;GUICtrlSetColor(-1, $colors_green) ;GUI_2_combos+inputs: Global $checkbox_1 = GUICtrlCreateCheckbox("", 10, 105, 20, 20) Global $item_1 = GUICtrlCreateCombo("1", 40, 100, 300, Default) ; create first item GUICtrlSetData(-1, "2|3|4|5|6|7|8|", "1") ; add other item snd set a new default GUICtrlSetFont(-1, 12, 600) Global $quantity_1= GUICtrlCreateInput( '', 345, 100, 160, 31) GUICtrlSetLimit(-1,10) #ce GUICtrlSetFont(-1, 12, 600) ;GUI_2_buttons: Ok, so, we have $msg[0] and $msg[1] Why doesn't it work if I put $msg[2] in the 3. GUI (storehouse)? Don't I need a new array value for each new GUI? My question rocks, I know, thank you, oh boy, now I'm all blushing and shy.... YES, I know I ask facepalm questions. YES, I know you asked the God why I had to register to the forum where normal people are. YES, I know everything! Link to comment Share on other sites More sharing options...
CroatianPig Posted September 2, 2013 Author Share Posted September 2, 2013 Please, all suggests and advices are welcome ! In case it looks ugly, I KNOW, I wanted to make something work for the first time, then put decorations. YES, I know I ask facepalm questions. YES, I know you asked the God why I had to register to the forum where normal people are. YES, I know everything! Link to comment Share on other sites More sharing options...
FireFox Posted September 2, 2013 Share Posted September 2, 2013 Read the helpfile (yeah again). An index does NOT correspond to a GUI except the index 1. Link to comment Share on other sites More sharing options...
CroatianPig Posted September 2, 2013 Author Share Posted September 2, 2013 Read the helpfile (yeah again). An index does NOT correspond to a GUI except the index 1. Dude, you are like a Jesus, seriously. But not the way you think. Jesus needed to help the man who was hungry, so instead of giving him a fish and feeding him for the day, he showed him how to catch a fish, and fed him for a lifetime. So please, for once, dont be a Jesus, be a human, and answer my question YES, I know I ask facepalm questions. YES, I know you asked the God why I had to register to the forum where normal people are. YES, I know everything! Link to comment Share on other sites More sharing options...
BrewManNH Posted September 2, 2013 Share Posted September 2, 2013 When using the "advanced" parameter the information is returned in an array with extended information:$aArray[0] = 0 or Event ID or Control ID$aArray[1] = The window handle the event is from <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<$aArray[2] = The control handle the event is from (if applicable)$aArray[3] = The current X position of the mouse cursor (relative to the GUI window)$aArray[4] = The current Y position of the mouse cursor (relative to the GUI window) If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
CroatianPig Posted September 4, 2013 Author Share Posted September 4, 2013 (edited) Ok, I thought to make a table in the warehouse GUI... I've been to this link: '?do=embed' frameborder='0' data-embedContent>> , downloaded table.au3 and the script, worked, but then I saw the code of the table... OH MY GOD ! It looks like 20 pages of coding... How to start it? Any good link (youtube, page, forum thread) as to how to start table from 0, I mean for a beginner... Edited September 4, 2013 by CroatianPig YES, I know I ask facepalm questions. YES, I know you asked the God why I had to register to the forum where normal people are. YES, I know everything! Link to comment Share on other sites More sharing options...
jaberwacky Posted September 4, 2013 Share Posted September 4, 2013 I haven't been following this thread so if you'll excuse me. Have you used a ListView? It'll do a table of sorts and is much easier to figure out. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
CroatianPig Posted September 5, 2013 Author Share Posted September 5, 2013 Well, actually I would need a table in which I could put endless number of items (in rows), and so I could delete or edit any of them, which would be saved in .ini file. It should have like 10 columns (code, name, quantity, buying price, selling price, tax percentage, special mark,...). How should I start that? YES, I know I ask facepalm questions. YES, I know you asked the God why I had to register to the forum where normal people are. YES, I know everything! Link to comment Share on other sites More sharing options...
jaberwacky Posted September 5, 2013 Share Posted September 5, 2013 Start by creating the listview. GUICtrlCreateListView("Column1|Column2|ColumnN", $left, $top, $width, $height) Then use GuiCtrlCreateListViewItem(...) to add rows. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
CroatianPig Posted September 5, 2013 Author Share Posted September 5, 2013 (edited) Start by creating the listview. GUICtrlCreateListView("Column1|Column2|ColumnN", $left, $top, $width, $height) Then use GuiCtrlCreateListViewItem(...) to add rows. Is it possible to have theoretically endless number of products, which I would enter? Because using GuiCtrlCreateListViewItem(...) seems as if I would have to program each row? Let's say, I have 400 products all together, and often I must put new products in. And should I do it in my script: expandcollapse popup; ; ; ; ; This is the INI file we will write to. It will be created on the Desktop. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <Table.au3> Global Const $SS_CENTER = 1 Global Const $SS_CENTERIMAGE = 1 Global $GUI_2 = 9999 Global $storehouse = 9999 Global $GUI_new_item = 9999 Global $no_alcohol = 9999 Global $storehouse_exit = 9999 Local $sIni = @DesktopDir & "\AutoIt-Test.ini" Local $Section = "Coca Cola" Local $Code = "018719" Local $Quantity = "312"; It would be best to keep intergers from strings. Local $QuantityType = "0,25l Bottles"; It would be best to keep intergers from strings. ;Demonstrate creating a new section using a string as input. IniWrite($sIni, $Section, "Code", $Code) IniWrite($sIni, $Section, "Quantity", $Quantity) IniWrite($sIni, $Section, "QuantityType", $QuantityType) Global $colors_green = 0x00FF00 Global $colors_yellow = 0xFFFF00 Global $colors_red = 0xFF0000 Global $colors_black = 0x000000 ;GUI_1: $GUI_1= GUICreate("BEN", 400, 300, Default, Default) ;==> draws GUI GUISetBkColor(0x000000) GUISetFont(14, 400, "", "Cambria") ;GUI_1_buttons: $GUI_1_start= GUICtrlCreateButton("Ulaz", 20, 25, 360, 120) GUICtrlSetFont(-1, 40, 800) GUICtrlSetBkColor(-1, $colors_green) $GUI_1_exit= GUICtrlCreateButton("Izlaz", 20, 155, 360, 120) GUICtrlSetFont(-1, 40, 800) GUICtrlSetBkColor(-1, $colors_yellow) ;GUISetState() gui_1() Func gui_1() GUISetState() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $GUI_1 Switch $msg[0] ; Now check for the messages for $hGUI1 Case $GUI_1_start gui_2() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_1_exit ExitLoop EndSwitch Case $GUI_2 Switch $msg[0] ; Now check for the messages for $hGUI2 Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<< GUIDelete($GUI_2) GUICtrlSetState($GUI_1_start, $GUI_ENABLE) Case $storehouse gui_3() ;MsgBox("", "MsgBox", "Test from Gui 2") EndSwitch Case $GUI_new_item Switch $msg[0] Case $storehouse_exit GUIDelete($GUI_new_item) GUICtrlSetState($GUI_2, $GUI_ENABLE) EndSwitch EndSwitch WEnd EndFunc Func gui_2() $GUI_2= GUICreate("Main window", 1800, 900, Default, Default) GUISetBkColor($colors_black) GUISetFont(14, 400, "", "Cambria") $no_alcohol = GUICtrlCreateButton("Non-alcohol", 20, 20, 200, 200) GUICtrlSetFont(-1, 16, 800) GUICtrlSetBkColor(-1, $colors_green) $storehouse = GUICtrlCreateButton ("Storehouse", 1260, 20, 300, 300) GUICtrlSetFont (-1, 16, 800) GUICtrlSetBkColor (-1, $colors_green) $finish = GUICtrlCreateButton("Finish", 40, 740, 1720, 80) GUISetState() EndFunc ;GUI_insert_new_item Func gui_3() $GUI_new_item = GUICreate("Insert new item", 1400, 900, Default, Default) GUISetBkColor($colors_black) GUISetFont(14, 400, "", "Cambria") $storehouse_exit = GUICtrlCreateButton("Exit", 1180, 680, 200, 200) GUICtrlSetFont(-1, 16, 800) GUICtrlSetBkColor(-1, $colors_green) GUISetState() EndFunc #cs ;GUI_2_labels: GUICtrlCreateLabel("I", 200, 10, 450, 100) GUICtrlSetFont(-1, 16, 800) GUICtrlSetColor(-1, $colors_green) GUICtrlCreateLabel("Wares", 45, 60, 450, 50) GUICtrlSetFont(-1, 12, 800) GUICtrlSetColor(-1, $colors_green) GUICtrlCreateLabel("Prices", 350, 60, 450, 50) GUICtrlSetFont(-1, 12, 800) GUICtrlSetColor(-1, $colors_green) ;GUICtrlCreateLabel("2:", 490, 20, 450, 100) ;GUICtrlSetFont(-1, 20, 800) ;GUICtrlSetColor(-1, $colors_green) ;GUI_2_combos+inputs: Global $checkbox_1 = GUICtrlCreateCheckbox("", 10, 105, 20, 20) Global $item_1 = GUICtrlCreateCombo("1", 40, 100, 300, Default) ; create first item GUICtrlSetData(-1, "2|3|4|5|6|7|8|", "1") ; add other item snd set a new default GUICtrlSetFont(-1, 12, 600) Global $quantity_1= GUICtrlCreateInput( '', 345, 100, 160, 31) GUICtrlSetLimit(-1,10) #ce GUICtrlSetFont(-1, 12, 600) ;GUI_2_buttons: or a separate "table" file? Edited September 5, 2013 by CroatianPig YES, I know I ask facepalm questions. YES, I know you asked the God why I had to register to the forum where normal people are. YES, I know everything! Link to comment Share on other sites More sharing options...
jaberwacky Posted September 5, 2013 Share Posted September 5, 2013 You can have ...CreateListViewItem insert as many rows as is needed when ever you need. They can also be removed too by another similar function. Columns may be added and removed as is needed. You can load a text file into a loop and create this list dynamically. Or you can have an input box which adds rows when things are typed into the input box. Really, what you want to do is possible. It may not be easy for a beginner but it is possible. Get started on something and come back with questions. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
tbohon Posted September 5, 2013 Share Posted September 5, 2013 (edited) Just a thought ... as jaberwocky said why not have a plain text pipe-delimited text file containing your inventory? You could then use any text editor to maintain it and the program could read the contents of the file into the ListView when it starts up. As long as you don't complicate things with trying to maintain that text file within your cash register program this would be a fairly easy and flexible fix. Of course you'd have to do any inventory maintenance (for now, until you get inspired to code it ) via a simple text editor ... but I've used this method for thousands of records and it's a good way to do things as simply as possible. Edited September 5, 2013 by tbohon 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