hi everyone,
I am try to make Password Program using LCD touch.in GUIX i make password screen and i enter the password using screen but my program is not working properly.here i am not able to compare my default password and my input password.i make if and else loop for right and wrong password but when i enter right password then also it was go to the else loop.pleas give me advice where i do mistake and how i correct this mistake.
UINT PasswordPanelEventHandler (GX_WINDOW * widget, GX_EVENT * event_ptr)
{
int num1;
int num2;
int index=0;
char pwd[5]="1234";
char pass[index];
//UINT x;
UINT result = gx_window_event_process(widget, event_ptr);
UINT log;
switch (event_ptr->gx_event_type)
{
case GX_SIGNAL(ID_BUTTON_ONE1, GX_EVENT_CLICKED):
{
if(button_enabled)
{
pass[index]='1';
++index;
}
}
break;
case GX_SIGNAL(ID_BUTTON_TWO, GX_EVENT_CLICKED):
{
if( string_134)
{
pass[index]='2';
++index;
}
}
break;
case GX_SIGNAL(ID_BUTTON_THREE, GX_EVENT_CLICKED):
{
if( string_135)
{
pass[index]='3';
++index;
}
}
break;
case GX_SIGNAL(ID_BUTTON_FOUR, GX_EVENT_CLICKED):
{
if( string_136)
{
pass[index]='4';
++index;
}
}
break;
case GX_SIGNAL(ID_BUTTON_FIVE, GX_EVENT_CLICKED):
{
if( string_137)
{
pass[index]=5;
++index;
}
}
break;
case GX_SIGNAL(ID_BUTTON_SIX, GX_EVENT_CLICKED):
{
if( string_138)
{
pass[index]=6;
++index;
}
}
break;
case GX_SIGNAL(ID_BUTTON_SEVEN, GX_EVENT_CLICKED):
{
if( string_139)
{
pass[index]=7;
++index;
}
}
break;
case GX_SIGNAL(ID_BUTTON_EIGHT, GX_EVENT_CLICKED):
{
if( string_140)
{ pass[index]=8;
++index;
}
}
break;
case GX_SIGNAL(ID_BUTTON_NINE, GX_EVENT_CLICKED):
{
if(string_141)
{
pass[index]=9;
++index;
}
}
break;
case GX_SIGNAL(ID_BUTTON_ENTER, GX_EVENT_CLICKED):
{
num1=atoi(pwd);
num2=atoi(pass);
if(num1==num2)
{
show_window((GX_WINDOW*)&main_screen_1, (GX_WIDGET*)widget, true);
}
else
{
show_window((GX_WINDOW*)&splash_screen, (GX_WIDGET*)widget, true);
}
break;
}
default:
gx_window_event_process(widget, event_ptr);
break;
}
return result;
}