How to Override edit button's method in smart templates sapui5 - sapui5

This is the object page of the list report page of the smart templates.
I want to override the method of the edit button in the controller extension of my application.
How can I do this?

It's a little difficult to answer without assuming how the application was built. I'm assuming that you utilized SAP Build to build this. If so, then from the Page Editor it is possible to click on the "Edit" button, then scroll down to the actions on the Properties sidebar to see which events are implemented.
If implemented, they will be in a Controller file with the same name (eg. S2_**.controller.js) and you can do a search for the event handler (eg. onClick in case of Edit).
In any case, no matter how the application was built - you can check each controller file for it's outline (in Web IDE) and search for the appropriate handler to override.

Related

Android - Show Back Button from XML

Before I begin, I want to mention that I've found a million answers showing how to do this from code, which involves setDisplayHomeAsUpEnabled(true) from your Activity. However, what I have not been able to find is a way how to do it from XML. (I would like to hide as much UI code in the XML files as possible).
One article I did find is this, which states
Step 3: Specifying the parent activity name in the AndroidManifest.xml adds the Back-Button arrow
and Click-action. Tapping on the back-arrow takes us to the Parent
Activity i.e Home Screen.
which doesn't work for me (the Back Button doesn't appear). I've followed all the steps in the article.
Does anyone know how to do this via xml? Is it even possible?
Yes, it's possible but still, you have to set the listener in java code. You can create a custom toolbar view and add a button to it. Then create a button in the java file and set the CilckListener.
Or You can use the default toolbar and do setDisplayHomeAsUpEnabled(true) from your Activity.
We usually make a custom toolbar, suppose you need a search bar in the toolbar then what you will do? So try to make an xml then use <include> tag in xml. You can search youtube. Follow the channel CodingInFlow, that guy explains very perfectly. If you don't understand what I am saying then understand the basics first, it will help you learn faster.

How to make a SAPUI5 Custom Control accessible (focus handling)?

I am searching for a way to make a SAPUI5 custom control accessible. I build a kind of tile (based on a VBox control) and try to get this custom control accessible over keyboard (tab) or by clicking the mouse.
My idea was to implement sap.ui.core.Control#getAccessibilityInfo in my control, but this seems never be called. Currently I am trying to debug how other stuff is doing it like https://github.com/SAP/openui5/blob/master/src/sap.m/src/sap/m/ListBase.js but I can't find a way that works.
My control is currently placed inside a table, if I click on it the focus will be set to the table column. If I press tab-key it jumps to an input control inside my control.
My assumption, I miss something so that the control would be considered as focusable somehow.
I think that you are looking for ItemNavigation. VBox wasn't design to support keyboard navigation on it's content, but you could add a hook to onAfterRendering of your custom control, collect all dom refs you need to navigate on and pass them to ItemNavigation.setItemDomRefs.
If you need an inspiration you can have a look at sap.m.List implementation.
The important thing is to add oRM.writeAttribute("tabindex", "0"); // allows selection into the renderer of my own control. That allows to use the tab handling. Full code in a different question: How to copy&paste SAPUI5 controls by pressing Ctrl+C and Ctrl.V?
With this the control can be selected.
Also notice the this._bExcludeFromTabChain = false; in init section.

How to open a popup on click of button placed in menu page in master detail page in xamarin forms?

I am working on xamarin.forms. I am using Master detail page. In menupage of MasterDetailPage I have some menu items that are listed. At the bottom of the Menu list I placed a button on menu page. Now I need to open a popup on click of that button. I am trying with PopupLayout but not able to get any success.
Please tell me how I can open a custom popup box at the click of the button that is placed in menu page?
Regards,
Anand Dubey
Without going into separate, native projects for all platforms you are targeting (such as Android, iOS, UWP...), you cannot pop out custom UI content over existing pages in Xamarin.Forms out of the box. You would need to bring in additional references or get creative with the AbsoluteLayout control.
Here are a few options you have:
Simple popup with message and or option selection
If all you need is a simple popup message or a list of buttons, you should look into the native DisplayAlert and DisplayActionSheet methods. They are built into Xamarin.Forms and work really well for these simple cases.
More complex popup dialogs
For anything more complex than that, there is the excellent UserDialogs project: ACR UserDialogs github page
It will give you support for various loading dialogs, date, time pickers, action sheet, success/info/error toasts and more.
Fully custom UI markup with AbsoluteLayout
There is a technique where by you prepare the underlying page with a root absoltue layout, which enables you to dynamically add new UI on top of all other controls on your page. This is fiddly and can ruin your performance if you are not careful. This is also the approach that the PopupLayout control that you mentioned uses. If done properly, this can be a good solution, but I don't recommend it as it involves additional complexity on each page that hosts the popup content.
Fully custom UI popup on native projects
Your most flexible option, as always, is to fall back to the native projects. This would involve coding up the popup logic on each separate platform that you are targeting, then using DependencyService (or one of the other techniques) to call into it from the shared project. For this you should look at samples and tutorials for popups on separate native platforms as it gets pretty broad and goes way outside the topic of this question.

Web-site with two Composite per page. Due to bad design?

I'm creating a web-site using GWT for the first time. The aplication has two Composite class, one of them is a menu and the other one is where I show de info about the specific menu that has been clicked. I'm using MVP, the class History and the interface ChangeValueHandler to switch among different pages.
I have one pair presenter-view for each Composite. The app begins well creating the menu and the section info. When you click in the menu it works fine showing the information and the token browser is changed. The thing is that if you load a page(eg: myapp.com#register) without loading the home page, it doesn't show you the menu. It loads the Composite section info, but not the Composite menu (the Composite menu is load with myapp.com#home).
I think it's because of a bad design of the application, but I don't know how to do that in other way. If the app only had one Composite it wouldn't be a problem, but when there are 2 or more Composite per page I don't know how to manage the whole thing to work properly.
It's difficult to tell what exactly is wrong, because of the lack of code. So I'm guessing. You should design to act on the PlaceChangeEvent instead of the ValueChangeEvent. That means a menu click should fire the place change and then the application will handle this event. That way you unbind the menu actions from your content pages. And think more of each page as a separate entity. Also take a look at the GWT Activity mechanism and how it helps having a main page that is always the same and on that main page a content area that changes depending on the page actually shown.
You should include your menu in each page instead of creating it once in the home page and then keeping it on screen. I assume you create the menu and add it to the DOM via
RootPanel.get().add(myMenuWidget);
If you are using UIBinder it should be pretty straightforward to include the menu in each page, just a matter of adding the corresponding tag in each .ui.xml file of your pages.

Windows Forms Error Provider does not display in custom tab control

I'm trying to build a Wizard framework in Windows Forms. I've managed to glean a lot of useful tips from this and other sites which have gotten me very close to success. However, I'm having a problem with displaying an ErrorProvider on any tab page other than the first page of the wizard.
My Wizard control is a UserControl. It contains a custom tab control that I've derived from TabControl so that I can hide tabs and ignore attempts to navigate between tabs using keypresses, along with the usual collection of Back/Next/Finish/Cancel buttons at the bottom of the control.
I've used reflection to allow me to raise the validation events on a particular TabPage that belongs to the Wizard Control when I hit the Next button. (I don't want to validate the whole TabControl, only the currently active page.) When I do this, I see in the debugger that my Validating routine for the controls on the current tab page is correctly called and I see that I've called the ErrorProvider that I've attached to the particular control (a TextBox in this case) with a valid error message. I set Cancel to true for the CancelEventArgs in the validating routine and that's picked up by the code that uses the reflection mechanism so that I see that I've failed and don't change tabs. And I set the focus successfully to the control that failed validation.
So all that appears to be working just fine.
Unfortunately, I don't see the ErrorProvider's cheery blinking icon unless I'm on the first tab page. For all of the other tab pages, there's no message visible at all.
I'm baffled. Any thoughts? I can provide code snippets, if helpful.
Thanks!
I assume that in your case the button that moves to the next step of the wizard is placed outside (below) the TabControl
I noticed that the icon is displayed correctly if I pressed the button without releasing the mouse button. It seems that the button outside the container gets focused event though a validation error has occurred (normally you would not be able to leave the active control).
I worked around this issue by registering an event handler for the buttons MouseUp event to "refocus" the TabControl:
private void cmdOK_MouseUp(object sender, MouseEventArgs e)
{
tabControl1.Focus();
}
Note: you also need to set your forms ActiveControl property the one of the controls that failed validation.