InteractionRequest<Confirmation>: the focus stays on the clicked button - wpf

Would anybody know how do I give the focus to the Cancel button of a Prism InteractionRequest?
What happens at the moment, is that given you've pressed enter on a button in a main window and the InteractionRequestTrigger fired, if you press enter again, you are in trouble as the focus stayed on the parent window and InteractionRequestTrigger fires a second time...
Thanks for your help

Focus on Confirmation dialog should be set automatically after firing the InteractionRequestTrigger.
You may find helpful the following State-Based Navigation Prism Quickstart:
State-Based Navigation
A Raise() method is invoked in the QuickStart for showing the InteractionRequest's dialog at ChatViewModel's SendMessage() method by setting the proper ViewModel context and its callback:
public IInteractionRequest SendMessageRequest
{
get { return this.sendMessageRequest; }
}
public void SendMessage()
{
var contact = this.CurrentContact;
this.sendMessageRequest.Raise(
new SendMessageViewModel(contact, this),
sendMessage =>
{
if (sendMessage.Result.HasValue && sendMessage.Result.Value)
{
this.SendingMessage = true;
this.chatService.SendMessage(
contact,
sendMessage.Message,
result =>
{
this.SendingMessage = false;
});
}
});
}
In addition, the ChatView detects the interaction request and the PopupChildWindowAction displays the SendMessageChildWindow pop-up window:
<prism:InteractionRequestTrigger SourceObject="{Binding SendMessageRequest}">
<prism:PopupChildWindowAction>
<prism:PopupChildWindowAction.ChildWindow>
<vs:SendMessageChildWindow/>
</prism:PopupChildWindowAction.ChildWindow>
</prism:PopupChildWindowAction>
</prism:InteractionRequestTrigger>
I hope this helps.

Ah! I should have marked my Popup as Focusable!

Related

CEFSharp options for a new popup window

I have a WPF application using CEFSharp and it is working perfectly well except for one small thing. If I have a link with the target=new so the link should open in a new browser window it opens fine but the window has no icon on the top left just that default "I couldn't find an icon, icon"
Also is there a way to control the state of the new window i.e. maximized.
Or is there a way to catch the click and perhaps force the new browser to be the users default on their system.
Any suggestions appreciated
Or is there a way to catch the click and perhaps force the new browser to be the users default on their system. Any suggestions appreciated
Yes, you can catch it and prevent the new window.
Have a look at the IRequestHandler and ILifeSpanHandler interfaces.
internal class RequestHandler : IRequestHandler
{
public bool OnOpenUrlFromTab(...)
{
Process.Start(targetUrl);
return true; //Handled
}
...
}
internal class LifeSpanHandler : ILifeSpanHandler
{
public bool OnBeforePopup(...)
{
newBrowser = null;
if (!String.IsNullOrWhiteSpace(targetUrl))
{
Process.Start(targetUrl);
return true;
}
return false;
}
...
}

Unblock widget without lose focus

I have a focused widget and a blocked widget, when I unblock the blocked widget, the focus is stolen
Look this example (click once on the run button) : http://www.qooxdoo.org/current/playground/#%7B%22code%22%3A%22var%2520field%2520%253D%2520new%2520qx.ui.form.TextField()%253B%250A%250Avar%2520button%2520%253D%2520new%2520qx.ui.form.Button(%2522A%2520button%2522)%253B%250A%250Avar%2520blocker%2520%253D%2520new%2520qx.ui.core.Blocker(button)%253B%250A%250Athis.getRoot().add(field%252C%2520%257Btop%253A%252010%252C%2520left%253A%252010%257D)%253B%250Athis.getRoot().add(button%252C%2520%257Btop%253A100%252C%2520left%253A10%257D)%253B%250A%250Ablocker.block()%253B%250Afield.focus()%253B%250Ablocker.unblock()%253B%22%2C%20%22mode%22%3A%22ria%22%7D
I'm not quite sure that what you try to achieve is what the qx.ui.core.Blocker was intended for. The implementation does not take in account that the focus is moved during the block.
If you call the method block the code tries to determine the widget which was focused before the block is done and saves that widget, then sets the focus to the widget to be blocked and restores the focus to the saved widget when unblocking.
With a small addition in a subclass, you could avoid that focus save/restore:
qx.Class.define("qx.ui.core.MyBlocker",
{
extend : qx.ui.core.Blocker,
properties : {
backupActiveWidget :
{
check : "Boolean",
init : true
}
},
members : {
// overridden
_backupActiveWidget : function() {
if(this.getBackupActiveWidget() === false) {
return
}
this.base(arguments);
}
}
});
and use the blocker this way:
var blocker = new qx.ui.core.MyBlocker(widgetToBeBlocked);
blocker.setBackupActiveWidget(false);
This should prevent the blocker from stealing the focus which may be set during the block.

Extjs mouseover and click event not working together for an element id

I have a button and in my controller i created one mouse over event and a click event for that button's id. But everytime when i click button it goes to the mouseover event function only, but when I comment the mouseover it goes to the click event function nicely. Why this is so? I am using ext4.1
thanks in advance.
me.control({
'#notificationIconId':{
click:me.notificationClick
},
'#notificationIconId':{
mouseover:me.notificationMouseOver
}
});
},
notificationMouseOver : function (){
alert('1')
},
notificationClick :function(menuitem)
{
alert('2')
}
You're using two times the same key '#notificationIconId' in a Javascript object... So, the last one is overriding previous ones.
You can add multiple listeners for the same selector:
'#notificationIconId': {
click: me.notificationClick
,mouseover: me.notificationMouseOver
}

Wijdropdown not working after being hidden

Using Wijmo Open ComponentOne's Dropdown, I tried to place it in a registration form that displays when a button is clicked. This form is inside a jquery modal window.
The problem is that it is not displayed like a wijdropdown inside the form.
I supposed that since is was hidden, then it wasn't part of the DOM and so I added a method in the callback of the function that displayed the modal window; when the modal window finishes displaying, then call the .wijdropdown() on the element. However, it didn't work.
In conclusion: the select tag is not being wijdropdowned...
¿Any recommendations?
Script
$(function() {
// show overlay
$('#product-slideshow-overlay-trigger').live('click', function() {
var $registerOverlay = $('#product-slideshow-overlay');
//left position
var positionLeft = ($(window).width() - $registerOverlay.width())/2;
$registerOverlay.css({'left':positionLeft});
//show mask
$('#mask').fadeIn();
$registerOverlay.slideDown(function()
{
console.log("Started");
/**Add WijmoDropdown***/
$('#estado').wijdropdown(function()
{
console.log("Did the wijdropdown");
});
console.log("Ended");
});
return false
});
}); // end document ready function
Refresh the wijdropdown when the dropdown is not hidden:
$('.wijmo_drp').wijdropdown("refresh");
or
Find the wijmo component and check if it's visible or not (styled or not).
And trigger the visiblity changed event when you display the modal window.
if($('.wijmo-wijobserver-visibility').is(':visible'))
{
$('.wijmo-wijobserver-visibility').trigger("wijmovisibilitychanged");
}

getting record from rowEdit in mvc extjs

I'm using the rowEditing on my grid in my mvc application. I'm able to handle the event when the user clicks update. However i'm having issues get the selected record. The below behaves strangely. I do not get the record.data.Name value the first time i click update. Tho i can see the value in fire bug.
init: function () {
this.control({
'button[text=Update]': {
click: this.onMaterialUpdate
}
});
},
onLaunch: function () {
},
onMaterialUpdate: function (button) {
var grid = Ext.getCmp('materialsContainer');
var record= grid.getSelectionModel().getSelection()[0];
if (record != null) {
console.log(record.data.Name);
}
}
Not sure about it... but I think the click event happens before completeEdit, thus the record is neither committed, nor updated in the grid (or its selection).
Perhaps try to capture the edit event of the row editor instead of click? You should get the correct record there?
I'd suggested handle edit event of the RowEditor plugin. You could subscribe to this event on grid render event for example. By getting the plugin by pluginId.

Resources