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

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.

Related

How to change visibility of views in the sidebar via the VSCode-Extensions API

You can change the visibility by clicking the caret seen in the screenshot above. Is there a way to trigger this visibility change via the API? I can't find any setter for the visibility inside the VSCode Extension API-documentation
In this case this is a TreeView and this means the needed method would trigger the views onDidChangeVisibility-Event.
If you want to collapse the view (and not just its contents), I think the answer is that it cannot be done programmatically from an extension at this point.
See API to programatically expand/collapse tree view: which is "On Deck" (and I think could be easily implemented - so upvote it).
If you were happy to just collapse the contents of the view but not the entire view, see I want to Collapse a VSCode tree view programatically.
Finally, it is relatively easy to remove the view altogether, see how to use vscode extension to hide timeline and outline in the side bar and
await vscode.commands.executeCommand('timeline.removeView');
but I can't find a good way to programmatically add a view back except
await vscode.commands.executeCommand('workbench.action.quickOpen', 'view NPM Scripts');
await vscode.commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem');
which is less than optimal. If, however, it is your treeView you could use the TreeView.reveal() command which will open the view if it is closed. You do have to pass some element to the reveal(), perhaps the root of the tree.

Keep window in focus always in swift Cocoa [duplicate]

I have noticed in the Interface Builder if I want to click on or drag from the Library panel, I only have to click on it once, even if the Library panel does not have the current focus.
I am trying to build a panel that behaves similarly.
Is there any simple way to let the NSTableView accept the click, even if the window does not have the focus?
Thanks.
Ok, I found the answer. Inside from awakeFromNib I call this:
[self setBecomesKeyOnlyIfNeeded:YES];
It seems to do the trick. It's a little bit different from Interface Builder where the Panel actually gets the focus simultaneously with a single click, but doing it this way is just what I was looking for.
Your view should override -acceptsFirstMouse: to return YES (or evaluate the event passed to you to determine what to return). You'll have to subclass NSTableView to do that of course.

How to edit the objects in FileMakerPro

I have one doubt in filemaker pro. In my project I have one layout with a button(Lets say layout1). If I click on the button, it is navigating to next page(Lets say layout2). If I go to layout mode in this page(layout2), it is showing the layout mode of previous page(layout1). I checked the button setup in this page(layout1). It is calling some script(Lets say script1). In the script(script1) it is calling some object using "go to object[object name:nameoftheobject]". I want to make some changes in layout2. Is there any way to find this layout or suggest some ideas to edit the object 'nameoftheobject'?
Your script does not change the layout, instead the interface is re-drawn by going to an object covering a whole layout. It could be a hidden tab control, popover or slide control. Duplicate layout and try to select all and apply a visible border.

Programmatically select menu item for mvvm prism application using Telerik RadMenu

Hello I have a prism/mvvm style application and am using the RadMenu control. I also have a view/view model pair in one project and another view/view model pair for my RadMenu control in another project. Basically I would like to use the event aggregator to send an event to the view model for the RadMenu (the view model that is paired with the view that the RadMenu sits inside of). So that the RadMenu's view model can notify the RadMenu to switch to a different RadMenuItem programmatically. I think I can use a blend behavior to contain the behavior I'm looking to reproduce, but I cannot find a method in the RadMenu that will allow me to programmatically select a specific menu item.
If the control does not support this now, is there a work around? Thanks.
I believe this is a missunderstanding. As far as I know there is no selection on the RadMenu. You can only Check or Uncheck Items in your Menus. Are you trying to emulate a user clicking on a specific item just to trigger the functionality behind the menu-item? If that's the case I would propose another way and directly handle the EA-Message in the ViewModel. You can trigger the code from there then. If you're doing MVVM the logic behind the menu-items is implented in your VM anyways. :)

GWT Customize CellList Multi-Selection Model for Mobile Devices

I have an application, that uses the MultiSelectionModel, and it works great, but I need the site I'm developing to work on mobile devices, and so I can't use the keyboard to assist in selecting the elements (since it doesn't exist). EX: On the desktop I just hold ctrl and click on all the element that I want to select.
So on the mobile device, I would like to modify the default behavior of the MultiSelectionModel so that when you click on a CellList item, it toggles the selection state of that item.
I have looked through the source for it and cannot see anyway to implement the behavior that I need. (Mobile MultiSelection).
Whether you add a checkbox column or not, you'll have to add a cell preview handler. The easiest way to define one is to use DefaultSelectionEventManager, either using a checkbox manager in combination with a checkbox column, or creating a custom one (you'd map a click event into a toggle action).
You can see it used, the checkbox variant, in the GWT Showcase; it uses the setSelectionModel overload with two arguments to add the CellPreviewEvent.Handler at the same time.
Just adding an extra checkbox column would be a more user friendly solution.