Skip to content
Snippets Groups Projects
Commit 79958088 authored by Maxime Graulich's avatar Maxime Graulich
Browse files

allow user to manually edit number value

parent 8c2ccb57
No related branches found
No related tags found
No related merge requests found
...@@ -72,22 +72,28 @@ ...@@ -72,22 +72,28 @@
NSLog(@"Long press on %@", name); NSLog(@"Long press on %@", name);
std::vector<onelab::number> number; std::vector<onelab::number> number;
onelab::server::instance()->get(number,[name UTF8String]); onelab::server::instance()->get(number,[name UTF8String]);
if(number.size()){ if(number.size() && !number[0].getReadOnly()){
NSLog(@" -- number param with value %g", number[0].getValue()); NSLog(@" -- number param with value %g", number[0].getValue());
/* UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Manually edit %s", number[0].getShortName().c_str()] message:name delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
UIActionSheet *actionSheet = alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
[[UIActionSheet alloc] initWithTitle:[[models objectAtIndex:indexPath.row] getName] delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles: @"Open this model", @"More information", nil]; [alertView textFieldAtIndex:0].text = [NSString stringWithFormat:@"%g", number[0].getValue()];
actionSheet.tag = indexPath.row; [alertView show];
[actionSheet showInView:self.view];
*/
//double selected = number[0].getChoices()[buttonIndex];
//number[0].setValue(selected);
//onelab::server::instance()->set(number[0]);
[parameter refresh]; [parameter refresh];
} }
} }
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"%@ -> %@", [alertView message], [alertView textFieldAtIndex:0].text);
std::vector<onelab::number> number;
onelab::server::instance()->get(number,[[alertView message] UTF8String]);
if(number.size()){
double value = [[alertView textFieldAtIndex:0].text doubleValue];
number[0].setValue(value);
onelab::server::instance()->set(number[0]);
[self refreshTableView];
}
}
- (void)indexDidChangeForSegmentedControl:(id)sender - (void)indexDidChangeForSegmentedControl:(id)sender
{ {
OptionsViewController *optionsViewController = [[OptionsViewController alloc] init]; OptionsViewController *optionsViewController = [[OptionsViewController alloc] init];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment