Detect different taps with jgesture and play soundfiles - jgestures

I'm trying to create some touch events for a cordova application/game, but the documentation on the jgestures site is not helping much.
For example: I have three different audio files and when I tap with one finger on the screen I want to play the first audio file and when I tap with two fingers I want to play the second audio file... and so on.
Help would be appreciated!
Cheers

On touchend event of element, check for event.touches count and do the required operations.
element.on('touchend', function(e){
if(event.touches.length == 1){
//Handle one finger tap
}
});
Otherwise, jGestures has "tapone", "taptwo", "tapthree" events to handle the taps.
element.on('tapone', function(e){
//Handle one finger tap
});
More events are documented here

Related

How do you intercept WM_GESTURE or WM_TOUCH Windows Messages when writing an ObjectARX / C++ / MFC stack AutoCAD plugin?

I am writing an AutoCAD plugin that uses C++ with the Microsoft Foundation Classes framework (MFC), and linking the ObjectARX source library tied to AutoCAD that helps me integrate my plugin with AutoCAD's native code.
I am currently experiencing an issue where I cannot intercept Windows Messages that are created when using touchscreen gestures like pinch, zoom, or pan.
This is an example of the hook method I have implemented below. I am able to receive basically all mouse events (left click down, left click up, mouse wheel, right click, double click, etc.). The problem is, when I use my fingers on my touchscreen to perform gestures like pinching and zooming, or two finger panning, no Windows Messages are forwarded to this hook. I would have assumed that WM_GESTURE or WM_TOUCH messages would have also been intercepted by this hook as well.
However, AutoCAD's main frame window with the drawing in it is still responsive to these gesture actions I am making. I.e. I am able to use AutoCAD's native zoom and pan functionality while I pinch, zoom, and pan with my fingers. The problem I now have is I have no way to intercept or modify these gesture events in the case that I need to either block or modify this default functionality.
BOOL WindowsMessageHook(MSG *pMsg)
{
if (pMsg->message == WM_LBUTTONDOWN)
{
//Got Left Click (This works!)
}
else if (pMsg->message == WM_TOUCH)
{
//Try to intercept WM_TOUCH (Doesn't work)
return TRUE;
}
else if (pMsg->message == WM_GESTURE)
{
//Try to intercept WM_GESTURE (Doesn't work)
return TRUE;
}
return FALSE;
}
In a separate method that is being called, I have this line of code, which will register the hook with ObjectARX.
acedRegisterFilterWinMsg(WindowsMessageHook);
I have tried writing some code that simulates a transparent window to intercept Windows Messages (as I have seen suggested to others asking similar questions). Unfortunately, at least from the code that I tried, I was still not able to intercept these types of Windows Messages (WM_GESTURE / WM_TOUCH).
I am now wondering if there is something special or particular I need to do in order to retrieve these messages. Or it could be I am just fundamentally not understanding something and going the complete wrong way about addressing this problem.
Another potential solution idea that occurred to me was to find a way to override the AutoCAD's main frame "Wnd" (window) class and override the "WndProc" method in particular as I have seen other similar suggestions online. The problem is I'm not exactly sure how to go about doing that properly with ObjectARX. I believe to get the main frame window you use the following line of code below.
CMDIFrameWnd* acadWindowFrame = acedGetAcadFrame();
Note: I am targeting Windows 10 machines only.
Any insight or help is extremely appreciated as I've been pretty stressed out in trying to get my head around this problem and it this point it just feels like I'm wasting my time.
Thank you so much for your time and efforts.

Wait cursor not getting dislpalyed in mfc?

I need a wait cursor to be loaded when the second page OnWizardNext of a property sheet is clicked .This is how I had done.Actually I designed a property sheet and now when I Click on the Next button I had activated the hourglass ,till this point everything works fine ,here arises the actual problem i.e,during that wait cursor period if I click again on Next button the dialog is getting dismissed .So,my intention is even if I click Next during the wait cursor it should not react to the click event.
LResult OnWizardNext()
{
CWaitCursor wait_cursor();
Sleep(10000);
return CPropertyPage::OnWizardNext()
}
if I remove Sleep then no wait cursor is getting loaded.What I need is even though if click on any button anything the event for that button should not get triggered until unless i am out of sleep time.
Can anyone please let me know how to achieve this.
I think you have a problem with the design of your wizard. You should not be using "Sleep" as it will suspend the thread. Moreover, the wait cursor is nothing more than a UI mechanism to indicate to the user that the code is still active. You seem to want to use that as a determinant for when your code can continue. Take a look at using OnSetCursor to provide visual feedback. Depending on what it is you're waiting on, you may want to look at using a timer, or, perhaps a series of "flags" to indicate a "continue" condition.

how to represent "cardID" in glass

I'm as Google glass development program,now i have two cards in an activity, And i want to tap the two cards respond to different events . I tried to use cardID==card1 or cardID==card2 in keyDown method but failed, because not have the variable cardID ,who can tell me how to represent the variable "cardID".
I think my own question here would help you. In the code i posted just call the getSelectedItemPosition() inside the long press gesture detector.

How to turn off the notification center in cocos2d-x ios game using c++

Is there a way to turn off the notificationCenter in iOS game using cocos2d-x? Suppose in my game, there are objects which have to be dragged from the top. The notificationCenter interrupts in between. Please anyone here tell me how to turn off the notification center when the game runs.
No, the Notification Center is a system level feature. And iOS is not exposed any API to turn it off in some applications.
If by notificationCenter your mean CCNotificationCenter then you can call CCNotificationCenter::purgeNotificationCenter to remove all the observers or CCNotificationCenter::removeAllObservers(target) to stop notifications for a specific observer.
Notification center could not be disabled in the app.
According to How to disable the "drag down to view Notifications" feature?, the only way to stop the Notification Center from immediately appearing is to hide your app's status bar, and even then the 'tab' of the NC will stay appear.
Like Multitasking Gestures in iOS5, you cannot stop this behavior and must instead rethink how your apps work to suit Apple's changes.
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self performSelector:#selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES
withAnimation:UIStatusBarAnimationSlide];
}
- (BOOL)prefersStatusBarHidden {
return YES;
}

How to know if the Gtk::ComboBoxText is popup

I am writing a simple GUI, in which I have a ComboBoxText. I write a log message when ever the user clicks on the ComboBoxText.
I have tried almost all the button release and popup signals but no results. The only thing which works is signal_changed() but I don't not need that. Please help me, below is my sample code :
myCombo->signal_button_release_event().connect(sigc::mem_fun(this,&ComboBoxText::ComboInput),false);
and here is the call back function:
bool ComboBoxText::ComboInput(GdkEventButton *pEvt) {
// Here do the desired stuffs !!
return false; }
Use GTK+ property popup-shown. Not sure about Gtkmm syntax, probably property_popup_shown().get_value().
If you need a signal to listen to, connect to popdown or notify::popup-shown (the latter is invoked when property value changes; again, I'm not sure about Gtkmm syntax).
The idea here was to fire an event when the ComboBoxText is clicked. After some readings I figured it out that the ComboBoxText does not fire any on_click event as such.
One could mask a key press event (which by the way gets fired) and call the signal handler. This might not be handy for people who specifically looking for a on_click event but for those who are working with a keyboard or touch screen device. Here is a small chunk of code :`
mCombo.add_events(Gdk::KEY_PRESS_MASK);
mCombo.signal_event().connect(sigc::mem_fun(this,&ClassName::Handler),false);
cheers :)