ericbartha Posted March 24, 2016 Posted March 24, 2016 (edited) Hey everyone, I am trying to get a child GUI "log in" box to drag with the main window of the application, yet it is not. I've read through a bunch of other threads with similar issues, but cannot seem to find a resolution. I've only started learning to make GUI's 3 days ago, so I am hoping someone a little more experienced can identify my flaw. Here's my code: expandcollapse popup#include <Inet.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> #include <ButtonConstants.au3> #include <AutoItConstants.au3> Global $sMainDir = "G:\Eric\LoginGUITesting\" formLogIn() Func formLogIn() Local $iFormBGState = WinGetState("BT Dashboard") If BitAND($iFormBGState, 1) Then ; Do Nothing Else Local $f_programBG = GUICreate("BT Dashboard", @DesktopWidth, @DesktopHeight - 40, 0, 0, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) GUISetBkColor(0x333333, $f_programBG) GUISetIcon($sMainDir & "Images\hacuIcon.ico") GUISetState(@SW_SHOW, $f_programBG) WinSetState($f_programBG,"",@SW_MAXIMIZE) EndIf Local $f_logIn = GUICreate("f_logIn", 350, 400, -1, -1,$WS_POPUP, $WS_EX_TOPMOST, $f_programBG) GUISetBkColor(0xFFFFFFF) GUISetState(@SW_SHOW, $f_logIn) Local $shape_headerLine = GUICtrlCreateGraphic(30, 70, 290, 2) GUICtrlSetBkColor($shape_headerLine, 0xEAEAEA) Local $l_header = GUICtrlCreateLabel("Login Form", 30, 20, 200, 50) GUICtrlSetFont($l_header, 22, 400, "", "Segoe UI", $CLEARTYPE_QUALITY) GUICtrlSetBkColor($l_header, 0xFFFFFF) GUICtrlSetColor($l_header, 0x009BAA) $tabHolder = GUICtrlCreateTab(0, 0, 1, 1) GUICtrlSetBkColor($tabHolder, 0xFFFFFF) Local $sUserNameFocus = "Email Address" Local $i_userName = GUICtrlCreateInput("", 60, 128, 250, 29) GUICtrlSendMsg($i_userName, $EM_SETCUEBANNER, False, $sUserNameFocus) GUICtrlSetBkColor($i_userName, 0xF0EEF0) GUICtrlSetColor($i_userName, 0x333333) GUICtrlSetFont($i_userName, 12, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) GUICtrlSetTip($i_userName, "Enter a valid email address", "Username", $TIP_INFOICON, $TIP_CENTER) GUICtrlCreatePic($sMainDir & "Images\userIcon.bmp", 36, 136, 12, 12, $BS_BITMAP) Local $sPasswordFocus = "Password" Local $i_password = GUICtrlCreateInput("", 60, 176, 250, 29) GUICtrlSendMsg($i_password, $EM_SETCUEBANNER, False, $sPasswordFocus) GUICtrlSetBkColor($i_password, 0xF0EEF0) GUICtrlSetColor($i_password, 0x333333) GUICtrlSetFont($i_password, 12, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) GUICtrlSetTip($i_password, "Enter your matching password", "Password", $TIP_INFOICON, $TIP_CENTER) GUICtrlCreatePic($sMainDir & "Images\passIcon.bmp", 35, 183, 15, 15, $BS_BITMAP) Local $l_forgotPass = GUICtrlCreateLabel("Forgot your password?", 60, 230, 120, 17) GUICtrlSetFont(-1, 8, 400, 0, "Segoe UI") GUICtrlSetColor($l_forgotPass, 0x009BAA) GUICtrlSetFont($l_forgotPass, 9, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) Local $l_requestLogin = GUICtrlCreateLabel("Request credentials", 60, 260, 103, 17) GUICtrlSetFont(-1, 8, 400, 0, "Segoe UI") GUICtrlSetColor($l_requestLogin, 0x009BAA) GUICtrlSetFont($l_requestLogin, 9, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) Local $b_logIn = GUICtrlCreateButton("", 0, 325, 350, 75, $BS_BITMAP) GUICtrlSetImage($b_logIn, $sMainDir & "Images\loginButton.bmp") While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $l_forgotPass GUIDelete("f_logIn") formResetPass() Case $l_requestLogin MsgBox(0,"","Login Requested") Case $b_logIn Local $inputReturn = GUICtrlRead($i_userName) MsgBox(0,"", $inputReturn) EndSwitch WEnd EndFunc Func formResetPass() Local $f_passReset = GUICreate("f_passReset", 350, 300, -1, -1, $WS_POPUP + $WS_TABSTOP) GUISetBkColor(0xFFFFFF) Local $l_header = GUICtrlCreateLabel("Password Reset", 30, 20, 200, 50) GUICtrlSetFont($l_header, 22, 400, "", "Segoe UI", $CLEARTYPE_QUALITY) GUICtrlSetBkColor($l_header, 0xFFFFFF) GUICtrlSetColor($l_header, 0x009BAA) Local $shape_headerLine = GUICtrlCreateGraphic(30, 70, 290, 2) GUICtrlSetBkColor($shape_headerLine, 0xEAEAEA) $tabHolder = GUICtrlCreateTab(0, 0, 1, 1) GUICtrlSetBkColor($tabHolder, 0xFFFFFF) Local $sUserNameFocus = "Email Address" Local $i_userName = GUICtrlCreateInput("", 60, 128, 250, 29) GUICtrlSendMsg($i_userName, $EM_SETCUEBANNER, False, $sUserNameFocus) GUICtrlSetBkColor($i_userName, 0xF0EEF0) GUICtrlSetColor($i_userName, 0x333333) GUICtrlSetFont($i_userName, 12, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) GUICtrlSetTip($i_userName, "Enter a valid email address", "Username", $TIP_INFOICON, $TIP_CENTER) GUICtrlCreatePic($sMainDir & "Images\userIcon.bmp", 36, 136, 12, 12, $BS_BITMAP) Local $l_ReturnLogIn = GUICtrlCreateLabel("Return to the Login Screen", 60, 175, 140, 17) GUICtrlSetFont(-1, 8, 400, 0, "Segoe UI") GUICtrlSetColor($l_ReturnLogIn, 0x009BAA) GUICtrlSetFont($l_ReturnLogIn, 9, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) Local $b_passReset = GUICtrlCreateButton("", 0, 225, 350, 75, $BS_BITMAP) GUICtrlSetImage($b_passReset, $sMainDir & "Images\passResetButton.bmp") GUISetState(@SW_SHOW) While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $l_ReturnLogIn formLogIn() GUIDelete("f_passReset") Case $b_passReset Local $inputReturn = GUICtrlRead($i_userName) If $inputReturn = "" Then MsgBox(0,"Error","Please enter a valid e-mail Address") Else ; email variables removed ProgressOn("Password Reset", "Sending Reset Email" , "Initiating...") ProgressSet(0) ProgressSet(20, "Sending email to " & $sToAddress & "...") ; disabled and removed Local $emailCheck = _INetSmtpMail() If Not $emailCheck Then MsgBox(0,"","Email could not be sent. Please try again later or contact your system admin.") ProgressOff Else ProgressSet(60, "Checking for successfully sent email...") ProgressSet(100, "Successfully sent password reset email...") Sleep(200) ProgressOff() MsgBox(0,"","Thank you. You should receieve an email shortly with instructions on how to reset your password.") formLogIn() GUIDelete("f_passReset") EndIf EndIf EndSwitch WEnd EndFunc I am really lost on this one, so any help would be appreciated! Oh - and since the GUI does contain custom images, here is a screenshot to help you visualize. Thanks, everyone! Eric Edited March 24, 2016 by ericbartha
mikell Posted March 24, 2016 Posted March 24, 2016 $WS_CHILD Local $f_logIn = GUICreate("f_logIn", 350, 400, -1, -1,$WS_CHILD, $WS_EX_TOPMOST, $f_programBG) ericbartha 1
ericbartha Posted March 24, 2016 Author Posted March 24, 2016 ... I ... no words. I completely missed that one. It works perfectly now. Thanks, Mikell.
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