RemObjects
                        Software Gears code

Plateau

Sign in or create your account | Project List | Help

Plateau Commit Details

Date:2009-11-13 23:55:59 (8 months 17 days ago)
Author:R. Brian Lindahl
Commit:12
Message:Minor updates; added CloseOnSelect to picker
Files: trunk/Plateau/Source/Plateau/PTPickerModel.pas (1 diff)
trunk/Plateau/Source/Plateau/PTComboCell.pas (2 diffs)
trunk/Plateau/Source/Plateau/PTPicker.pas (6 diffs)

Change Details

trunk/Plateau/Source/Plateau/PTPickerModel.pas
5151
5252method PTPickerModel.GetRowsInComponent(pickerView: UIPickerView; componentIndex: Integer): Integer;
5353begin
54  exit self.fModelData[componentIndex].Rows.Count
54  Console.WriteLine('rows='+self.fModelData[componentIndex].Rows.Count.ToString);
55  exit self.fModelData[componentIndex].Rows.Count;
5556end;
5657
5758method PTPickerModel.GetTitle(picker: UIPickerView; rowIndex: Integer; componentIndex: Integer): String;
trunk/Plateau/Source/Plateau/PTComboCell.pas
2828    method EditOnSelect(); override;
2929    //property CanEditOnSelect: Boolean read true; override;
3030    property Values: List<String> := new List<String>();
31    
32    property CloseOnSelect : boolean;
3133  end;
3234
3335implementation
...... 
7476      self.Layout()
7577    end;
7678  end;
79  fPicker.CloseOnSelect := self.CloseOnSelect;
80  Console.WriteLine("i="+values.IndexOf(Control.Text).ToString);
7781  fPicker.DataSource.SelectItem(0, values.IndexOf(Control.Text));
7882  fPicker.ShowPicker();
7983end;
trunk/Plateau/Source/Plateau/PTPicker.pas
1111  PTPicker = public class
1212  protected
1313    picker: UIPickerView;
14      actionSheet: UIActionSheet;
1415    fDataSource: PTPickerModel;
1516    ownerView: UIView;
1617    
...... 
1920  public
2021  protected
2122    method ShowActionSheetPicker();
23    method HidePicker;
2224  public
2325    constructor (view: UIView);
2426    property DataSource: PTPickerModel read fDataSource write set_DataSource;
2527    property Title: String;
28    property CloseOnSelect : boolean;
2629    
2730    event ItemSelected: EventHandler<PTPickerItemSelectedEventArgs>;
2831    
...... 
3538begin
3639  if self.ItemSelected <> nil then
3740  begin
38    self.ItemSelected(sender, e)
41    self.ItemSelected(sender, e);
42    if self.CloseOnSelect then
43      HidePicker;
3944  end
4045end;
4146
...... 
4752method PTPicker.ShowActionSheetPicker();
4853begin
4954  //---- declare vars
50  var actionSheet: UIActionSheet;
55  
5156  var btnDone: UIButton := UIButton.FromType(UIButtonType.RoundedRect);
5257  var lblActionSheetTitle: UILabel := new UILabel();
5358  var titleFont: UIFont := UIFont.BoldSystemFontOfSize(18);
...... 
8590  
8691  //---- add the delegate to dismiss the action sheet
8792  btnDone.TouchDown += method (sender: Object; e: EventArgs) begin
88    //this._dataSource.Selected (this._lstPicker, 0, 0);
89    actionSheet.DismissWithClickedButtonIndex(0, true)
93    HidePicker;
9094  end;
9195    
9296  //---- show the action sheet and add the controls to it
9397  actionSheet.ShowInView(self.ownerView);
9498  actionSheet.AddSubview(self.picker);
9599  actionSheet.AddSubview(lblActionSheetTitle);
96  actionSheet.AddSubview(btnDone);
100  if not self.CloseOnSelect then
101    actionSheet.AddSubview(btnDone);
97102  
98103  //---- if something is already selected
99104  if self.dataSource.SelectedItem <> '' then
100105  begin
101106    Console.WriteLine('this._dataSource.SelectedItem = ' + self.dataSource.SelectedItem);
102    Console.WriteLine('this._dataSource.SelectedComponentIndex, this._dataSource.SelectedRowIndex,' + self.dataSource.SelectedComponentIndex.ToString() + ',' + self.dataSource.SelectedRowIndex.ToString())
103    //this._lstPicker.Select (this._dataSource.SelectedComponentIndex, this._dataSource.SelectedRowIndex, true);
107    Console.WriteLine('this._dataSource.SelectedComponentIndex, this._dataSource.SelectedRowIndex,' + self.dataSource.SelectedComponentIndex.ToString() + ',' + self.dataSource.SelectedRowIndex.ToString());
108    self.picker.Select(self.dataSource.SelectedRowIndex, self.dataSource.SelectedComponentIndex, true);
104109  end;
105110  
106111  //---- resize the action sheet to fit our other stuff
...... 
117122  btnDone.Frame := new RectangleF(actionSheetWidth - btnDoneWidth - 10, 7, btnDoneWidth, btnDoneHeight)
118123end;
119124
125method PTPicker.HidePicker;
126begin
127  //this._dataSource.Selected (this._lstPicker, 0, 0);
128  actionSheet.DismissWithClickedButtonIndex(0, true)
129end;
130
120131constructor PTPicker(view: UIView);
121132begin
122133  self.ownerView := view;
123134

Archive Download the corresponding diff file

Revision: 12