I would like to do the following to an Xdialog and could use some assistance.
1. Add a graphic (See attachment)
2. Gray out the Login/OK button until a value exists in the password field
My current dialog code is shown below:
' ---------------- Now get user info and verify ------------------
'Pasted this code from Xdialog Genie which created the code
'Xdialog that asks for user name and password for system logon
DIM GLOBAL gvuser as C
DIM SHARED vuserpass as C
DIM SHARED varC_result as C
DIM vuserfound as C
'---------------
Retry_here:
'---------------
heading_string = "Enter Your Username and Password."
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
varC_result = ui_dlg_box("EIM Track",<<%dlg%
{font=Arial,10}
{region}
{text=55,1:heading_string};
{endregion};
{region}
Username:| [.40gvuser];
Password:| [%p%.40vuserpass];
{endregion};
{line=1,0};
{region}
<*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
{endregion};
%dlg%)
IF varC_result = "OK"
'Let Admin user in if they enter the appropriate info
IF gvuser = "Admin" .and. vuserpass = "Admin"
ui_msg_box("Admin Login","Administrator Login Successful")
END'
END IF
' Get data from Employee Master file to verify password - make one text string that has both values and then parse it out below
' Lookup the records for the matching username and password
lres = lookupc("F",alltrim(gvuser),"alltrim(emplognid)+' -- '+alltrim(emppass)",a5.Get_Path()+"\emp.dbf","_emplognid")
vuserfound = word(lres,1," -- ")
vpassfound = word(lres,2," -- ")
'Compare user name entered to that in the Employee Master file (found with lookupc above)
IF alltrim(lower(gvuser)) = alltrim(lower(vuserfound))
'Name matches - now look at the password for a match
IF alltrim(lower(vuserpass)) = alltrim(lower(vpassfound)) ' Password matches too
gvuser = alltrim(lower(gvuser))
'Clear vuserpass variable
vuserpass = ""
'Set a Global Variable that contains the employees full name
DIM GLOBAL gvEmpName as C
gvEmpName = lookupc("F", gvuser, "alltrim(Empfname)+' '+ alltrim(Emplname)", "emp","_Emplognid")
'Opens the Main Menu Form
form.view("Main_Menu")
END'
ELSE
'Password does not match - try again
ui_msg_box("Password Error!","Password entered is incorrect.",UI_STOP_SYMBOL)
'Clear vuserpass variable
vuserpass = ""
GOTO retry_here
END IF
ELSE 'User Name is wrong - this is from first IF statement
ui_msg_box("User Name Not Found","The User Name you entered could not be found",UI_STOP_SYMBOL)
gvuser = ""
vuserpass = ""
GOTO Retry_here
END IF
END IF 'End if for varC_result - user pushed the ok button
' If user presses the Cancel button - just terminate the whole program
IF varC_result = "Cancel"
' Implement this on live program to exit program completely if user hits cancel and decides not to login
a5.close()
END IF
1. Add a graphic (See attachment)
2. Gray out the Login/OK button until a value exists in the password field
My current dialog code is shown below:
' ---------------- Now get user info and verify ------------------
'Pasted this code from Xdialog Genie which created the code
'Xdialog that asks for user name and password for system logon
DIM GLOBAL gvuser as C
DIM SHARED vuserpass as C
DIM SHARED varC_result as C
DIM vuserfound as C
'---------------
Retry_here:
'---------------
heading_string = "Enter Your Username and Password."
ok_button_label = "&OK"
cancel_button_label = "&Cancel"
varC_result = ui_dlg_box("EIM Track",<<%dlg%
{font=Arial,10}
{region}
{text=55,1:heading_string};
{endregion};
{region}
Username:| [.40gvuser];
Password:| [%p%.40vuserpass];
{endregion};
{line=1,0};
{region}
<*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
{endregion};
%dlg%)
IF varC_result = "OK"
'Let Admin user in if they enter the appropriate info
IF gvuser = "Admin" .and. vuserpass = "Admin"
ui_msg_box("Admin Login","Administrator Login Successful")
END'
END IF
' Get data from Employee Master file to verify password - make one text string that has both values and then parse it out below
' Lookup the records for the matching username and password
lres = lookupc("F",alltrim(gvuser),"alltrim(emplognid)+' -- '+alltrim(emppass)",a5.Get_Path()+"\emp.dbf","_emplognid")
vuserfound = word(lres,1," -- ")
vpassfound = word(lres,2," -- ")
'Compare user name entered to that in the Employee Master file (found with lookupc above)
IF alltrim(lower(gvuser)) = alltrim(lower(vuserfound))
'Name matches - now look at the password for a match
IF alltrim(lower(vuserpass)) = alltrim(lower(vpassfound)) ' Password matches too
gvuser = alltrim(lower(gvuser))
'Clear vuserpass variable
vuserpass = ""
'Set a Global Variable that contains the employees full name
DIM GLOBAL gvEmpName as C
gvEmpName = lookupc("F", gvuser, "alltrim(Empfname)+' '+ alltrim(Emplname)", "emp","_Emplognid")
'Opens the Main Menu Form
form.view("Main_Menu")
END'
ELSE
'Password does not match - try again
ui_msg_box("Password Error!","Password entered is incorrect.",UI_STOP_SYMBOL)
'Clear vuserpass variable
vuserpass = ""
GOTO retry_here
END IF
ELSE 'User Name is wrong - this is from first IF statement
ui_msg_box("User Name Not Found","The User Name you entered could not be found",UI_STOP_SYMBOL)
gvuser = ""
vuserpass = ""
GOTO Retry_here
END IF
END IF 'End if for varC_result - user pushed the ok button
' If user presses the Cancel button - just terminate the whole program
IF varC_result = "Cancel"
' Implement this on live program to exit program completely if user hits cancel and decides not to login
a5.close()
END IF
Comment