01-19-2013 01:58 AM
i have two screens , first_one contains 17 fields & by a button_presnt in first screen i am reaching at second screen , at second screen after pop_screen(first) & push_screen(first) i am getting my first screen , now i want to delete 15 fields from this , but i am facing the error , that illegal arguement exception or "Attempt to delete a field that does not belong to the manager" ..... & Note this point , i have got the get_field_count from first screen .
try
{
UiApplication.getUiApplication().popScreen(object_
UiApplication.getUiApplication().pushScreen(object
}
catch ( Exception err )
{
Dialog.inform("Error in loading page : "+err);
}
try
{
Dialog.inform("field count in home page : "+object_to_supprot.getFieldCount() );
int k = object_to_supprot.getFieldCount() - 1 ;
while ( k > 1 )
{
delete( object_to_supprot.getField(k) );
k-- ;
}
}
catch ( Exception err )
{
Dialog.inform("Error in work setting button pressed : "+err );
}
Solved! Go to Solution.
01-19-2013 05:29 AM
Like you I guess, I really can't see how this code is causing the problem that you see.
Can you tell us what index (k value) you are at when you see this exception?
Note that I'm not sure about your pop and then push. I take it when you go to screen 2, you just push screen 1. Then when you go back to screen 1, you leave screen two there, and pop screen 1 (which takes it off the display stack,) and then push it again. This means you have screen 2 still on the display stack, but hidden by screen 1. Is this what you wanted?
01-21-2013 03:00 AM
01-21-2013 04:48 AM
actually , i can not delete anything { k = 0 ...... end }
01-21-2013 05:04 AM
01-21-2013 05:23 AM - edited 01-21-2013 05:27 AM
I'm going to disagree with Simon here. I think deleting Fields from a Screen is a valid thing to do. I can see cases for doing it when you use the same screen, but have two different sets of data which require slightly different Fields on display. This is what seems to be happening here.
I have just realized what the problem is.
your code:
delete( object_to_supprot.getField(k) );
should be:
object_to_supprot.delete( object_to_supprot.getField(k) );
Your current code is effectively:
this.delete( object_to_supprot.getField(k) );
and 'this' is presumably your second screen. You want to delete Fields from your first screen.
Can I ask you to review my first post and Simon's post again. Please investigate how you use the display stack and make sure you are using it correctly.
01-22-2013 04:55 AM
thanks .