faustf 32 Posted November 12, 2011 hi guy i have i little questions. example: i have one form1 whit input box and button (name is address ). when i click over button appear in pupup style a new form2 . in form 2 have listview i want select one of item and clik over button (ok ), and insert a item in input box in form1. how is possible do this ?? ? i dont have idea thanks Share this post Link to post Share on other sites
water 2,409 Posted November 12, 2011 In the Wiki you can find a tutorial that describes how to handle multiple GUIs. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
faustf 32 Posted November 12, 2011 but in wiki dont explain how to send information cross gui only for push button Share this post Link to post Share on other sites
Melba23 3,491 Posted November 12, 2011 faustf, You do it like this: expandcollapse popup#include <GUIConstantsEx.au3> Global $hGUI2 = 9999, $hButton2 = 9999, $hListView = 9999 Global $aListViewItem[10] gui1() Func gui1() $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100) $hInput = GUICtrlCreateInput("", 10, 10, 180, 20) $hButton1 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hGUI1 Switch $aMsg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $hButton1 GUICtrlSetState($hButton1, $GUI_DISABLE) gui2() EndSwitch Case $hGUI2 Switch $aMsg[0] Case $hButton2 $sSelected_Data = StringTrimRight(GUICtrlRead(GUICtrlRead($hListView)), 1) If $sSelected_Data <> "" Then GUICtrlSetData($hInput, $sSelected_Data) EndIf ContinueCase Case $GUI_EVENT_CLOSE GUIDelete($hGUI2) GUICtrlSetState($hButton1, $GUI_ENABLE) EndSwitch EndSwitch WEnd EndFunc ;==>gui1 Func gui2() $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350) $hListView = GUICtrlCreateListView("Data ", 10, 10, 180, 100) For $i = 0 To 9 $aListViewItem[$i] = GUICtrlCreateListViewItem("Item " & $i, $hListView) Next $hButton2 = GUICtrlCreateButton("Send Data", 10, 130, 80, 30) GUISetState() EndFunc ;==>gui2 All clear? Now you have used up your free code allowance for a while. In future please post a working script so that we can work on it - we do not really like having to script something from scratch. OK? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites
faustf 32 Posted November 12, 2011 ok thanks you have understund what i want do Share this post Link to post Share on other sites
faustf 32 Posted November 12, 2011 but i have a questions suppose i create a form whit out sitax of case but in this mode _form1() func _form1() . . .input box GUICtrlSetOnEvent($Button3, "_form2") endfunc func _form2() list view ? ? ? endfunc ;=============================================================== ;Keep the GUI alive ;=============================================================== While 1 Sleep(1000) WEnd Share this post Link to post Share on other sites
Melba23 3,491 Posted November 13, 2011 faustf,I take it that you want to know how to code that script in OnEvent mode. If so, then this is one way how it might be done: expandcollapse popup#include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Global $hGUI2 = 9999, $hButton1 = 9999, $hInput = 9999, $hButton2 = 9999, $hListView = 9999 Global $aListViewItem[10] gui1() Func gui1() $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "GUI1_Exit") $hInput = GUICtrlCreateInput("", 10, 10, 180, 20) $hButton1 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30) GUICtrlSetOnEvent(-1, "On_Button1") GUISetState() While 1 Sleep(10) WEnd EndFunc ;==>gui1 Func On_Button1() GUICtrlSetState($hButton1, $GUI_DISABLE) gui2() EndFunc Func On_Button2() $sSelected_Data = StringTrimRight(GUICtrlRead(GUICtrlRead($hListView)), 1) If $sSelected_Data <> "" Then GUICtrlSetData($hInput, $sSelected_Data) EndIf GUI2_Exit() EndFunc Func gui2() $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350) GUISetOnEvent($GUI_EVENT_CLOSE, "GUI2_Exit") $hListView = GUICtrlCreateListView("Data ", 10, 10, 180, 100) For $i = 0 To 9 $aListViewItem[$i] = GUICtrlCreateListViewItem("Item " & $i, $hListView) Next $hButton2 = GUICtrlCreateButton("Send Data", 10, 130, 80, 30) GUICtrlSetOnEvent(-1, "On_Button2") GUISetState() EndFunc ;==>gui2 Func GUI1_Exit() Exit EndFunc Func GUI2_Exit() GUIDelete($hGUI2) GUICtrlSetState($hButton1, $GUI_ENABLE) EndFuncPlease ask if there is anything you do not understand. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites
faustf 32 Posted November 13, 2011 why you set this? ? Global $hGUI2 = 9999, Share this post Link to post Share on other sites
Melba23 3,491 Posted November 13, 2011 faustf,Certain variables have to be declared at the top of the script or you get errors when you run Au3Check warning you of "undeclared variables". The variables you need to declare are all created within functions and so are automatically Local in scope - declaring them as Global allows them to be used within all functions. The inability to pass parameters in OnEvent mode (unless you use martin's UDF) is one reason I tend not to use it much. And why 9999? Well, why not? The Variables - using Global, Local and ByRef tutorial in the Wiki will explain aboit variable scope in more detail. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites