Sign in to follow this  
Followers 0
faustf

exchange info whit 2 form

9 posts in this topic

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 :D

thanks :oops:

Share this post


Link to post
Share on other sites



In the Wiki you can find a tutorial that describes how to handle multiple GUIs.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

faustf,

You do it like this:

#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? :D

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? :oops:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

ok thanks you have understund what i want do :D

Share this post


Link to post
Share on other sites

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

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: :oops:

#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)
EndFunc

Please ask if there is anything you do not understand. :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

why you set this? ?

Global $hGUI2 = 9999,

Share this post


Link to post
Share on other sites

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. :oops:

And why 9999? Well, why not? :rip:

The Variables - using Global, Local and ByRef tutorial in the Wiki will explain aboit variable scope in more detail. :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0