chrisser Posted May 26, 2015 Share Posted May 26, 2015 (edited) Hi everybody,hope you can help me. I want to know, how it is possible to get the result of a control, which is build in a function. The problem is, that i want to this function several times?Chrisserexpandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiIPAddress.au3> #include <GuiConstants.au3> Global $FONT = "Segoe UI" Local $hGUI = GUICreate("Example") GUISetBkColor(0xFFFFFF,$hGUI) _GUICtrlTC_Station_Create(5, 5, "Station 01",$hGUI,$FONT) _GUICtrlTC_Station_Create(5, 205, "Station 02",$hGUI,$FONT) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _GUICtrlTC_Station_Create($iX, $iY,$StationName,$hWnd,$Fontname) $GRREF = GUICtrlCreateGroup("", $iX, $iY, 306, 110) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GRREF), "wstr", 0, "wstr", 0) $REF = GUICtrlCreateCheckbox($StationName, $iX+5, $iY+82, 85, 20) GUICheckBoxSetColor($REF, 0x3C3C3C, 0xFFFFFF, 9) $IPADDREF = _GUICtrlIpAddress_Create($hWnd, $iX+90, $iY+15, 160, 25) _GUICtrlIpAddress_SetFont($IPADDREF, $Fontname, 12, 400) $INPUTUSERNAMEREF = GUICtrlCreateInput("", $iX+90, $iY+45, 160, 25) GUICtrlSetFont(-1, 10, 400, 0, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) $INPUTPASSWORDREF = GUICtrlCreateInput("", $iX+90, $iY+75, 160, 25, $ES_PASSWORD) GUICtrlSetFont(-1, 9, 400, 0, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) EndFunc Func GUICheckBoxSetColor(ByRef $CtrlID, $iColor, $iBkColor = "0xF1EDED", $iSize = "10") ; SEuBo $CtrlHWnd = $CtrlID If Not IsHWnd($CtrlHWnd) Then $CtrlHWnd = GUICtrlGetHandle($CtrlID) $aParent = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $CtrlHWnd) $hOldG = GUISwitch($aParent[0]) $aCPos = ControlGetPos($aParent[0], "", $CtrlID) $sOldT = GUICtrlRead($CtrlID, 1) GUICtrlDelete($CtrlID) DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0) $CtrlID = GUICtrlCreateCheckbox($sOldT, $aCPos[0], $aCPos[1], $aCPos[2], $aCPos[3]) GUICtrlSetColor(-1, $iColor) GUICtrlSetBkColor(-1, $iBkColor) GUICtrlSetFont(-1, $iSize, 400, 0, $FONT) DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7) GUISwitch($hOldG) EndFunc ;==>GUICheckBoxSetColor Edited May 26, 2015 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Starstar Posted May 26, 2015 Share Posted May 26, 2015 (edited) Just set the control variable to global.Global $cntrlid[Edit::]And you will be able to read the value of that variable in hole script. Edited May 26, 2015 by Starstar Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
chrisser Posted May 26, 2015 Author Share Posted May 26, 2015 (edited) Just set the control variable to global. Global $cntrlid mhh.. yeah ..but my problem is, that I didn´t get the exact result of the control. I have one function and "two" controls. I added some "result"-buttons to test it.expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiIPAddress.au3> #include <GuiConstants.au3> Global $INPUTUSERNAMEREF Global $FONT = "Segoe UI" Local $hGUI = GUICreate("Example") GUISetBkColor(0xFFFFFF,$hGUI) _GUICtrlTC_Station_Create(5, 5, "Station 01",$hGUI,$FONT) _GUICtrlTC_Station_Create(5, 205, "Station 02",$hGUI,$FONT) $return1 = GUICtrlCreateButton("return 1",5,370) $return2 = GUICtrlCreateButton("return 2",105,370) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $return1 MsgBox(0,"",GUICtrlRead($INPUTUSERNAMEREF)) Case $return2 MsgBox(0,"",GUICtrlRead($INPUTUSERNAMEREF)) EndSwitch WEnd Func _GUICtrlTC_Station_Create($iX, $iY,$StationName,$hWnd,$Fontname) $GRREF = GUICtrlCreateGroup("", $iX, $iY, 306, 110) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GRREF), "wstr", 0, "wstr", 0) $REF = GUICtrlCreateCheckbox($StationName, $iX+5, $iY+82, 85, 20) GUICheckBoxSetColor($REF, 0x3C3C3C, 0xFFFFFF, 9) $IPADDREF = _GUICtrlIpAddress_Create($hWnd, $iX+90, $iY+15, 160, 25) _GUICtrlIpAddress_SetFont($IPADDREF, $Fontname, 12, 400) $INPUTUSERNAMEREF = GUICtrlCreateInput("", $iX+90, $iY+45, 160, 25) GUICtrlSetFont(-1, 10, 400, 0, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) $INPUTPASSWORDREF = GUICtrlCreateInput("", $iX+90, $iY+75, 160, 25, $ES_PASSWORD) GUICtrlSetFont(-1, 9, 400, 0, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) EndFunc Func GUICheckBoxSetColor(ByRef $CtrlID, $iColor, $iBkColor = "0xF1EDED", $iSize = "10") ; SEuBo $CtrlHWnd = $CtrlID If Not IsHWnd($CtrlHWnd) Then $CtrlHWnd = GUICtrlGetHandle($CtrlID) $aParent = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $CtrlHWnd) $hOldG = GUISwitch($aParent[0]) $aCPos = ControlGetPos($aParent[0], "", $CtrlID) $sOldT = GUICtrlRead($CtrlID, 1) GUICtrlDelete($CtrlID) DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0) $CtrlID = GUICtrlCreateCheckbox($sOldT, $aCPos[0], $aCPos[1], $aCPos[2], $aCPos[3]) GUICtrlSetColor(-1, $iColor) GUICtrlSetBkColor(-1, $iBkColor) GUICtrlSetFont(-1, $iSize, 400, 0, $FONT) DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7) GUISwitch($hOldG) EndFunc ;==>GUICheckBoxSetColor Edited May 26, 2015 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Starstar Posted May 26, 2015 Share Posted May 26, 2015 Please Wait i am examining your script........... Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 26, 2015 Moderators Share Posted May 26, 2015 chrisser,When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags.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 Link to comment Share on other sites More sharing options...
chrisser Posted May 26, 2015 Author Share Posted May 26, 2015 Okay, thanks :-) I´ll do that..Btw. Here is my solution:expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiIPAddress.au3> #include <GuiConstants.au3> #include <Array.au3> Global $INPUTUSERNAMEREF Global $FONT = "Segoe UI" Local $hGUI = GUICreate("Example") GUISetBkColor(0xFFFFFF,$hGUI) $1 = _GUICtrlTC_Station_Create(5, 5, "Rechner 01",$hGUI,$FONT) $2 = _GUICtrlTC_Station_Create(5, 205, "Rechner 02",$hGUI,$FONT) $return1 = GUICtrlCreateButton("return 1",5,370) $return2 = GUICtrlCreateButton("return 2",105,370) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $return1 _ArrayDisplay($1) MsgBox(0,"",_GUICtrlIpAddress_Get($1[0])) MsgBox(0,"",GUICtrlRead($1[1])) Case $return2 _ArrayDisplay($2) EndSwitch WEnd Func _GUICtrlTC_Station_Create($iX, $iY,$StationName,$hWnd,$Fontname) Dim $array[5] $STATIONGROUP= GUICtrlCreateGroup("", $iX, $iY, 356, 120, $BS_FLAT) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($STATIONGROUP), "wstr", 0, "wstr", 0) $STATIONCHK = GUICtrlCreateCheckbox($StationName, $iX+5, $iY+92, 90, 20) GUICheckBoxSetColor($STATIONCHK, 0x3C3C3C, 0xFFFFFF, 11) $array[0] =GUICtrlCreateLabel("(Name)",$iX+158,$iY+10,190,20) GUICtrlSetFont(-1, 9, 400, 2, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) $array[1] =GUICtrlCreateLabel("(Firma)",$iX+158,$iY+25,190,20) GUICtrlSetFont(-1, 9, 400, 2, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) GUICtrlCreateLabel("IP-Adresse:",$iX+115,$iY+45,70,20) GUICtrlSetFont(-1, 9, 400, 0, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) $array[2] = _GUICtrlIpAddress_Create($hWnd, $iX+185, $iY+43, 160, 20) _GUICtrlIpAddress_SetFont($array[0], $Fontname, 12, 400) GUICtrlCreateLabel("Benutzer:",$iX+115,$iY+70,90,20) GUICtrlSetFont(-1, 9, 400, 0, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) $array[3] = GUICtrlCreateInput("", $iX+185, $iY+68, 160, 20) GUICtrlSetFont(-1, 10, 400, 0, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) GUICtrlCreateLabel("Passwort:",$iX+115,$iY+95,70,20) GUICtrlSetFont(-1, 9, 400, 0, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) $array[4] = GUICtrlCreateInput("", $iX+185, $iY+92, 160, 20, $ES_PASSWORD) GUICtrlSetFont(-1, 9, 400, 0, $FONT) GUICtrlSetColor(-1, 0x3C3C3C) Return($array) EndFunc Func GUICheckBoxSetColor(ByRef $CtrlID, $iColor, $iBkColor = "0xF1EDED", $iSize = "10") ; SEuBo $CtrlHWnd = $CtrlID If Not IsHWnd($CtrlHWnd) Then $CtrlHWnd = GUICtrlGetHandle($CtrlID) $aParent = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $CtrlHWnd) $hOldG = GUISwitch($aParent[0]) $aCPos = ControlGetPos($aParent[0], "", $CtrlID) $sOldT = GUICtrlRead($CtrlID, 1) GUICtrlDelete($CtrlID) DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0) $CtrlID = GUICtrlCreateCheckbox($sOldT, $aCPos[0], $aCPos[1], $aCPos[2], $aCPos[3]) GUICtrlSetColor(-1, $iColor) GUICtrlSetBkColor(-1, $iBkColor) GUICtrlSetFont(-1, $iSize, 400, 0, $FONT) DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7) GUISwitch($hOldG) EndFunc ;==>GUICheckBoxSetColor 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