migueldeicaza/MonoTouch.Dialog — Issue #69: EntryElement/Section issue with sections appearing?
Author: jasonf01
Created: 2011-11-11 10:45:39+00:00
State: open

Hi,

Im a new developer to the iphone and to github so please be patient with me. Ive been using Monotouch and MT.D (an awesome combination btw) for a couple of months on a project and think I might have found a bug. Or an Error between Keyboard and Chair (EBKC) :-)

I have a data entry form consisting of three sections, each with their own collection of entry elements. The last section is off the screen when the view is shown and when it scrolls into view, the EntryElements are drawn incorrectly; the UITextField appears to have its dimensions calculated incorrectly.

This is a pretty obscure bug and ive had trouble tracking it down or even producing a workable demo but here is demo code below. Comment out the line indicated (to prevent section 2 from displaying) and section 3 works fine. Leave the line in and section 3 doesnt work properly.

Any ideas? is this EBKC or a genuine bug? Ive looked through Elements.cs and theres a function to calculate the width that gets fired when the section is appearing but to me the data and results from that calculation seem OK, maybe this correct calculation is being ignored?

Jas.
(code follows)

root=new RootElement("Edit Job");
Section customerSection=new Section("Customer Details");
EntryElement CustomerTitle=new EntryElement("Title","Mr/Miss/Mrs/Dr/Etc","Mr");
customerSection.Add (CustomerTitle);
EntryElement CustomerForename=new EntryElement("Forename","","Fred");
customerSection.Add (CustomerForename);
EntryElement CustomerSurname=new EntryElement("Surname","","Flintstone");
customerSection.Add (CustomerSurname);
EntryElement CustomerAddress1=new EntryElement("Address","","1 Rock Way");
customerSection.Add (CustomerAddress1);
EntryElement CustomerAddress2=new EntryElement("","","Bedrock");
customerSection.Add (CustomerAddress2);
EntryElement CustomerAddress3=new EntryElement("","","");
customerSection.Add (CustomerAddress3);
EntryElement CustomerAddress4=new EntryElement("","","");
customerSection.Add (CustomerAddress4);
EntryElement CustomerPostCode=new EntryElement("Post Code","","D1N0");
customerSection.Add (CustomerPostCode);
root.Add (customerSection);

Section contactInformation=new Section("Contact Information");
EntryElement CustomerPhoneHome=new EntryElement("Home","","01234567890");
contactInformation.Add (CustomerPhoneHome);
EntryElement CustomerPhoneWork=new EntryElement("Work","","");
contactInformation.Add (CustomerPhoneWork);
EntryElement CustomerPhoneMobile=new EntryElement("Mobile","","");
contactInformation.Add (CustomerPhoneMobile);
EntryElement CustomerFax=new EntryElement("Fax","","");
contactInformation.Add (CustomerFax);
EntryElement CustomerEmail=new EntryElement("Email","","");
contactInformation.Add (CustomerEmail);
root.Add (contactInformation); // <---Comment out this line and the vehicle information section works.

Section vehicleInformation=new Section("Vehicle Information");
EntryElement VehicleTagNo=new EntryElement("Key Tag No","","0");
vehicleInformation.Add (VehicleTagNo);
EntryElement VehicleModel=new EntryElement("Model","","Boxster Sleeper model 1");
vehicleInformation.Add (VehicleModel);
EntryElement VehicleRegNo=new EntryElement("Reg No","","AB12CDE");
vehicleInformation.Add (VehicleRegNo);
EntryElement VehicleVINNo=new EntryElement("VIN No","","SALLMA4DW23AB123456");
vehicleInformation.Add (VehicleVINNo);
root.Add (vehicleInformation);

DialogViewController dvc=new DialogViewController(root);
dvc.Autorotate=true;
dvc.Style=UITableViewStyle.Plain;

Navigation.PushViewController (dvc,true);