How do I prevent clicking background when I click the IMGUI button - webgl

How do I prevent clicking background when I click the IMGUI button
(e.g. I click the translate button and also click the background)

Check whether ImGui wants to capture the mouse click using ImGui::GetIO().WantCaptureMouse. If it does then don't let the event propagate further.
void Application::handleInput(InputEvent event) {
// don't pass mouse and keyboard presses further if an ImGui widget is active
auto& io = ImGui::GetIO();
if (io.WantCaptureMouse || io.WantCaptureKeyboard) {
return;
}
// ... event processing
}
}
ImGui FAQ: Q: How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?

Related

How to dismiss keyboard on change app lifecycle state

How to dismiss keyboard in flutter when I change the app using task list or if I pressed home button on iOS and double click home button and got back to app
You can reproducer the problem by doing the follow:
focus Textfield so keyboard will appear and double press home button on iPhone to switch to another app using task list then again double press home button and switch back to your app!
The keyboard stays and not responding
I tried the following :
#override
void didChangeAppLifecycleState(AppLifecycleState state) {
print('state = $state');
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
currentFocus.focusedChild!.unfocus();
}
SystemChannels.textInput.invokeMethod('TextInput.hide');
}

Xamarin iOS - Dismiss dialog notification

I use UIImagePickerController to open image from photo library.
I can register handlers for both accept and cancel events
imagePicker.Canceled += (sender, eventArgs) =>
{
//handle cancelling...
}
imagePicker.FinishedPickingMedia += (sender, args) =>
{
//handle loading...
}
These two handlers get called when user picks a photo, or clicks the Cancel button.
But, when user closes the dialog by swipe down gesture, I do not get my Cancel event handler called, what I believe should happen (as the user indeed has canceled the load operation).
So, what am I missing ?
Is there any other event that I can subscribe to, to get notified when user closes dialog by swiping it down the screen?

iOS 10 - Local Notification actions not visible after swiping right to left and selecting the 'View' button

I understand that with the new iOS 10, for Non-Force Touch devices, when the application is in the background, after swiping from right to left, you only see two options : View and Clear.
When I open the notification center however, and select the View option, I only see the alert, minus the action buttons beneath it. If I select view for other apps on my phone, I'm able to see the alert, along with the action buttons below it, if any.
The action buttons are visible when the app is in the foreground. Is there a setting that needs to be enabled in code?
Below is how I implemented the WillPresentNotification function.
public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)
{
try
{
// Do something with the notification
Console.WriteLine("Active Notification: {0}", notification);
completionHandler(UNNotificationPresentationOptions.Alert|UNNotificationPresentationOptions.Sound);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + ex.StackTrace);
}
}

confirm alert box is displayed for 2 times in phone gap

I am using notification.confirm in my iPhone application using phonegap.
$("#buttonId").click(function(e){
buyDialogBox();
});
function buyDialogBox(){
navigator.notification.confirm(
getIndRestrictionText(), // message
onConfirm, // callback to invoke with index of button pressed
'confirm alert Box', // title
'ok,Cancle' // buttonLabels
);
}
function onConfirm( button ){
if( button == 1 ){
alert("Ok button is clicked");
}else{
alert("cancel button is clicked");
}
}
while button is clicked and we press the ok or cancel button then immediately confirm alert box is displayed for second time for very small amount of period.
I am wondering that why the confirm alert box is displayed for second time.
Please give me solution for that.

Handle iOS home button press in as3

I need help detecting and dealing with the home button being pressed on a iPhone/iPod Touch running an AIR app. I tried
NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys, false, 0, true);
function handleKeys(event:KeyboardEvent):void
{
if(event.keyCode == Keyboard.HOME) {
//do something
}
}
without luck. Any ideas? Specifically, I want to prevent the app from closing when the home button is pressed.
import flash.events.Event;
addEventListener(Event.ACTIVATE, activateListener);
addEventListener(Event.DEACTIVATE, deactivateListener);
private function activateListener(e:Event):void{
//do something when awakened
}
private function deactivateListener(e:Event):void{
//do something when home button is pressed.
}

Resources