Login Screen

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Login Screen

Post by mark.monroe »

Hi Phong,

There is no help documentation for that class.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

BobLivingston
Posts: 19
Joined: Tue Jan 17, 2012 8:57 am

Re: Login Screen

Post by BobLivingston »

Is it possible to make the on-screen keyboard appear with the text window so users can see what they are typing when the textbox is covered?
Bob Livingston
Sr Controls Engineer
FlexEnergy Energy Systems
30 New Hampshire Ave
Portsmouth, NH 03801
USA

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Login Screen

Post by mark.monroe »

Hi Bob,

No, there is not a way to do that. The on screen keyboard tries to position itself so it does not cover up the text box that the keyboard is entering data into.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

ajack
Posts: 44
Joined: Wed Feb 22, 2012 12:01 am

Re: Login Screen

Post by ajack »

Dear Mark,

I encounter very strange error today. I tried custom login screen and everything work fine until today, I tried to add and button and delete it right away. This button has nothing to do with the Login Script or any Tags.

But after I validate the project, and many errors appear
LoginError.PNG
LoginError.PNG (32.76 KiB) Viewed 19584 times
It made me so confused cause in Login Screen Script, the last line is 77. Is there anything related to the bug you mentioned above in this thread?

Here is my code for Custom Login Screen

Code: Select all

namespace Neo.ApplicationFramework.Generated
{
    using System.Windows.Forms;
    using System;
    using System.Drawing;
    using Neo.ApplicationFramework.Tools;
    using Neo.ApplicationFramework.Common.Graphics.Logic;
    using Neo.ApplicationFramework.Controls;
    using Neo.ApplicationFramework.Interfaces;
    
	using System.Collections.Generic;
	using Neo.ApplicationFramework.Common.Utilities;
	using Neo.ApplicationFramework.Common.Service;
    
    public partial class LoginScreen
    {
		public ISecurityServiceCF _securityService;
		public IList<ISecurityUser> Users = Globals.Security.Users;
		
		// Get all username
		void LoginScreen_Opened(System.Object sender, System.EventArgs e)
		{
			foreach(ISecurityUser _user in Users)
			{
				UsersList.Items.Add(_user.Description);
			}
			
			passwordInput.Font = new Font("Tahoma", 26, System.Drawing.FontStyle.Regular);
			passwordInput.PasswordChar = '*';
			passwordInput.GotFocus += myEventHandler;
		}
		
		// Show keyboard when password input got focus
		public void myEventHandler(Object sender, EventArgs e)
		{
			passwordInput.SelectAll();
			IKeyboardHelper kh = KeyboardHelperFactory.KeyboardHelper;
			Rectangle rt = new Rectangle(0, 0, 0, 0);
			kh.ShowFullKeyboard(rt);
		}
		
		// check whether password is correct
		// show MessageBox when login sucessfully
		void LoginBtn_Click(System.Object sender, System.EventArgs e)
		{
			_securityService = ServiceContainerCF.GetServiceSafe<ISecurityServiceCF>();
			
			if ( _securityService.LoginUser(Users[UsersList.SelectedIndex].Username, passwordInput.Text) )
			{
				_securityService.ShowMessageBoxWithTimeout("User " + UsersList.Text + " is logged in", "Login Success");
				Globals.HomeScreen.Show();
			}
			else
			{
				_securityService.ShowMessageBoxWithTimeout("Wrong password - try again", "Login Failed");
			}
		}
		
		// Carefully: Delete event handler everytime exit Login Screen
		void LoginScreen_Closed(System.Object sender, System.EventArgs e)
		{
			passwordInput.Click -= myEventHandler;
		}

    }
}
Thanks and best regards,

Phong Duong

khoff
Posts: 6
Joined: Thu Jun 07, 2012 8:38 am

Re: Login Screen

Post by khoff »

I'm just looking into creating a custom login screen, as the combo boxes are pretty small on the QTERMA7 panel. Now, I'm terrible at scripting as I don't do it very often, but adapting snippets shouldn't be too hard!

Anyway, I get the same pallette of errors that the previous poster did, even after following the instructions on the first page of this thread. Can anyone help me out?

Thanks!
Kendall
error1.PNG
error1.PNG (81.25 KiB) Viewed 19538 times

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Login Screen

Post by mark.monroe »

You need to follow the following
procedure before opening the application:

1. Create a panel application, import the System.Windows.Forms.TextBox
object
(Embedded image moved to file: pic21726.gif)

2. Close the application
3. Open the CustomRecipeDialog application and build/run.
pic21726.gif
pic21726.gif (53.4 KiB) Viewed 19537 times
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

khoff
Posts: 6
Joined: Thu Jun 07, 2012 8:38 am

Re: Login Screen

Post by khoff »

I tried that in the source project, didn't work. Tried it your way, in a new project...worked fine. Thanks!

Also added an if check to exclude specific users (in our case, we want to exclude a "Temporary" user).

Code: Select all

	void PopulateList()
		{
			ISecurityManager securityManager = Globals.Security as ISecurityManager;
			foreach (ISecurityUser user in securityManager.Users)
			{
				if (user.Username == "User1")
				{
				}
				else 
				{
					cbUsers.Items.Add(user.Username);
				}
			}
			if(cbUsers.Items.Count > 0)
			{
				cbUsers.SelectedIndex = 0;
			}
		}

antoineA
Posts: 20
Joined: Fri Dec 02, 2011 8:22 am

Re: Login Screen

Post by antoineA »

Hi everybody,

I have tried to use the custom login project for my T4A panel but there is a problem. In fact, this project is designed for a TA70 panel and when I change it to T4A, iX developer deletes the text form used for password (this form is not available for T4A). I have changed it by an AnalogNumeric form but is there a way to change alphabetic characters by '*' character in keyboard preview?

Thanks a lot.

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Login Screen

Post by mark.monroe »

This forum thread talks about how to make an AnalogNumeric box display password characters, rather than alpha numeric characters.

I believe that should solve you issue.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

Franswa
Posts: 6
Joined: Sun Feb 07, 2016 1:39 pm

Re: Login Screen

Post by Franswa »

Hello,
I used the script that you give for my logscreen but I Have a problem on this part:

void PopulateList()
{
ISecurityManager securityManager = Globals.Security as ISecurityManager;
foreach (ISecurityUser user in securityManager.Users)
{
cbUsers.Items.Add(user.Username);
}
if(cbUsers.Items.Count > 0)
{
cbUsers.SelectedIndex = 0;
}
}


And he give me for error messages (in french):
-There is no definitions for "Items" and no extension method "Items"(a directive using or an assembly reference is missing?)
-There is no definitions for "Items" and no extension method "Items"(a directive using or an assembly reference is missing?)
-There is no definitions for "SelectedIndex" and no extension method "SelectedIndex" (a directive using or an assembly reference is missing?)


This message is just for my program because when i try the "customlogindialogue) given there are no problems. The rest of my programm is the same. Have I forgot somethings?

Your help will be welcome.
Best regards

Franswa

Post Reply