IOS Eureka - Select SegmentedRow programatically - eureka-forms

I need a method to select/deselect one of the tabs in SegementedRow programmatically. So when I open a form a pre-selected tab is shown.
Similar to UISegmentedControl method: yourSegmentname.selectedSegmentIndex = 1;
Thanks
Greg

Related

Xamarin Forms - Slide out menu to select items

I have a xamarin forms application search screen that allows a user to select an item from a list. Currently I am using a picklist and the user has to scroll and select and click done. This is using the native controls. Howerver I have noticed in iOS in settings menu etc where the have designed it so that when a user want to select from a list a arrow is shown on the right hand side which takes them to another page to select an item (s) from a list. To me this seems like a better UX. Here is an ex:
My question is there something built into this withing xamarin forms? I guess I could create a listview and then on click pass to another page. Any examples are appreciated.
There is no built-in for that, but it's not too hard to achieve this.
To set the disclosure indicator (the arrow), implement a custom renderer derived from ImageCellRenderer and override GetCell
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var viewCell = base.GetCell(item, reusableCell, tv);
viewCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
return viewCell;
}
When the user taps that cell you should navigate modally to the view showing the list of languages.
Adding that Cancel-Button is not really hard either, but needs another step. You'll need to wrap the new language selection page in a NavigationPage and push that NavigationPage modally. Furthermore you'll have to add a toolbar item to the wrapped page (see here).
Within the page there is a SearchBar view and a ListView below it. To add the checkmarks, you'll have to implement a custom cell with a custom renderer (derived from ImageCellRenderer like the one shown above), setting the UITableViewCell.Accessory to Checkmark if the custom cell is selected
if(item is SelectableCell selectableCell)
{
var selected = selectableCell.IsSelected;
viewCell.Accessory = selected ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.Checkmark;
}
Please note: Selectable cell is no Xamarin.Forms stock cell, but one that you have to implement by yourself, including the bindable property IsSelected.
This should be basically the steps you need to achieve what you want. I've assumed basic Xamarin.Forms knowledge that is needed to fill the gaps.

iPad Popup Form

I have iPad application with main view controller with a navigation bar at the top. I want to create a signIn button on navigation bar, which should open a popupview with username, password, one additional field and a login button. Clicking login button will close the popover and pass the information from text field back to main view controller.
I have been trying to find something like this on web , but no luck.
Does anyone knows a way to do this ?
You should take a look at UIPopoverController
This is how you initialize and show it:
UIPopoverController *myPopover = [[UIPopoverController alloc] initWithContentViewController:myForm];
[myPopover presentPopoverFromRect:button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionsAny animated:YES];
To get data back from myForm you probably want to use delegation.
myForm.delegate = self; //before presenting de popover

Edit button for tableview

Can anyone offer assistance with adding a delete button to a tableview in xcode? I can create the button but cannot get it to delete anything in the table. I'm using the default code that comes with the Master Detail Application but have changed the content of the table using an NSObject.
This should be the default behaviour of the edit button.
self.navigationItem.leftBarButtonItem = self.editButtonItem;
This will allow you to click and delete any item in the list after it is pressed.
Unless I am misunderstanding how you are using the table item list.

Adding a delete button to a CPTableView column in Cappuccino

This seems like it would be an easy thing to do but I am having a lot of trouble getting a button to respond to events while in a CPTableView. Here is the initialization code:
//deleteColumn is hooked up to CIB table column.
[deleteColumn setEditable:YES];
[deleteColumn setWidth:24];
var deleteButton = [[CPButton alloc] initWithFrame:CGRectMakeZero()];
[deleteButton setTarget:self];
[deleteButton setAction:#selector(deleteClicked:)];
[deleteColumn setDataView:deleteButton];
I then have this selector code in the same view controller:
- (void)deleteClicked:(id)sender
{
console.log(sender);
}
It seems the table view is squashing any mouse clicks inside it because I don't get the console log when I click the button.
Is there an easy way to do this? All I want is a button that deletes corresponding row in the table.
The CPTableView takes over the action of the button for its own purposes. Try listening for the regular edit delegate message CPTableViewDataSource:tableView:setObjectValue:forTableColumn:row: in your table delegate.

Programmatically select an MFC radio button

When I'm initializing a dialog, I'd like to select one of the radio buttons on the form. I don't see a way to associate a Control variable using the Class Wizard, like you would typically do with CButtons, CComboBoxes, etc...
Further, it doesn't like a CRadioButton class even exists.
How can I select one of the several radio buttons?
Use CWnd::CheckRadioButton to set select one button in a group and CWnd::GetCheckedRadioButton to retrieve the ID of the selected button. Be sure to call these methods on your dialog object, and not any of the radio button objects.
Radio buttons and check buttons are just buttons. Use a CButton control and use GetCheck/SetCheck.
Going on what mos said, the following worked did the trick:
CButton* pButton = (CButton*)GetDlgItem(IDC_RADIOBUTTON);
pButton->SetCheck(true);
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
...
DDX_Radio(pDX, IDC_RADIO1, m_Radio);
...
}
but it is the same thing Wizard generates
You can use this one-liner:
::SendMessage(GetDlgItem(IDC_RADIO1)->m_hWnd, BM_SETCHECK, BST_CHECKED, NULL);

Resources