Silverlight 5 Double-click in a ListBox - silverlight-5.0

I have seen lots of examples of using the new Silverlight 5 double-click feature. However, none of them have shown how to capture double-click in a ListBox.
Anyone have any examples/tips on how to set this up?
I am using MVVM.
Thanks!

You might be able to do this by creating a custom trigger that keeps a tally of the number of mouse clicks. Once args.ClickCount == 2 via the the parameter MouseButtonEventArgs args being true, you can invoke the logic you need:
public class DoubleClickTrigger : TriggerBase<FrameworkElement>
Within the <DataTemplate> for the ListBox you could use the custom event trigger created above. See the following post for more in-depth information:
Double Click trigger for Silverlight

Related

How to set click events in WebKitX ActiveX control in C++

I am using WebKitX ActiveX control for displaying web page in MFC Dialog. Now i want to set click events for same. I am setting click events using below code :
m_ctrlWebKit.SetEvents(m_ctrlWebKit.DOM_EVENT_CLICK || m_ctrlWebKit.DOM_EVENT_DBLCKICK);
But when i click on web page i always get only click event not double click. So can anyone tell me how to do it.
WebKitX - Getting Started with C++
https://www.webkitx.com/doc/light/Getting%20Started%20with%20CPP.html
I hope this helps!

Opening and testing a sub-window programmatically made in Vaadin, using Vaadin TestBench

Good day, fellow stackoverflow users. I have a problem using Vaadin TestBench in order to test a sub-window.
To be more specific, I've programmed a "popup" window that will be invoked by the main application when such application fails for whatever reason. As this sub-window doesn't have an URL, it will simply be invoked programmatically. I'm having problems coming up with a way of testing this single sub-window, as I have searched and read the Vaadin documentation, but all examples I see involve creating a driver for a certain browser, invoking a URL, accessing its elements and then doing the tests.
All I want is something like this:
Window popup = new Window() // Create sub-window (popup) programmatically
// instead of navigating to an URL with a web driver
// Here, I select the elements of the popup and do actions on it
// programmatically
...
// End the test and close the popup window
popup.close()
Is there a way of accomplishing this feat? I'm using the latest version of Vaadin on Springboot.
Vaadin Testbench and Selenium use the same base. You can reach the popup in the same way you do in Selenium:
driver.switchTo().activeElement();
or (if it is an alert)
driver.switchTo().alert().submit(); //submit = click OK, maybe it differs from your intention
If your "popup" is a separate browser window, you can switch by windowHandle.
driver.switchTo().window();
Hope this helps :)

Appcelerator. Options dialog is opening several times when refreshing table

Titanium SDK version: 1.7.0.RC1
iPhone SDK version: 4.2
I am developing an iOS app in Appcelerator. I am retrieving tweets from twitter and inserting them into a table. For each row/tweet I am also extracting the containing links for that individual tweet/row and the user can select them from an options dialog which is opened when the row is clicked.
The problem is that if I reload the page and click the row, two dialogs are open upon each other. If I click three times, three dialogs is opened and so on. How can I make sure that the dialog only opens once?
This is my code: http://pastie.org/2004091
Thankful for all help!
I had a similar problem. Especially on the iPhone 3G as this runs slowly and you're more tempted to tap things more than once. The way I got around it is to either remove the event listener from within the event listener itself. Or you set a variable and test for its value in the event listener. So, if you set a variable call 'clicked' to false. When the listener is first check for 'clicked' = false, if it is set it to true so next time the code is not executed.

can I set the AppUserModelID of an arbitrary process launched through a jumplist?

I have a simple console application written in C++ that acts as a stub for launching another application through it's jumplist. Purpose is to add jumplist abilities to applications that do not support this. Call it stub.exe. When running stub.exe it creates a custom jumplist using these steps (taken right form the MS samples):
create an ICustomDestinationList
ICustomDestinationList::BeginList()
create an IObjectCollection
for_each item_to_add
create an IShellLink, set its path/arguments/title/icon
add IShellLink to the IObjectCollection
get the IObjectArray interface from the IObjectCollection
call ICustomDestinationList::AddUserTasks( IObjectArray interface )
ICustomDestinationList::CommitList()
When pinning stub.exe to the taskbar and right-clicking it, the jumpilst appears and it contains all IShellLinks added. When clicking an item, it will launch the corresponding process.
Now I'd like a process launched through this jumplist have it's window(s) grouped under stub.exe's taskbar icon, instead of having it's own group. They key to get this working seems to be the AppUsermodelID. This is what I tried so far:
just for testing, create a couple of shortcuts and set the id through IPropertyStore->SetValue( PKEY_AppUserModel_ID, "id" ). Indeed, when launching these shortcuts, they will all group under the same taskbar icon.
since the shortcuts do what I want, I tried adding shortcuts to stub.exe's jumplist: no effect. The shortcuts don't even show up in the jumplist (maybe one cannot have a shortcut to a shortcut?), yet all methods return S_OK
setting the PKEY_AppUserModel_ID on each of the IShellLinks that get added to the jumplist: no effect
calling ICustomDestinationList->SetAppID(): no effect
instead of using SubTasks, tried with SHAddToRecentDocs: no effect. The recent doc list does not show up. But now things get messy. After setting the AppUserModelID on the shortcut that is responsible for the pinned taskbar item (the one in %APPDATA%/Roaming/Microsoft/Internet Explorer/Quick Launch/User Pinned/TaskBar), the jumplist changed: it does not show the 'Tasks' item anymore, but does show 'Recent' and the items I added using SHAddToRecentDocs. Now when clicking them I get a dialog box with a title that starts with 'd:\desktop' followed by Chinese characters. Hovering the items in the jumplist also shows Chinese characters instead of the descirption I set.
Questions:
What's with the Chinese characters in the jumplist?
How come setting the app id on the taskbar shortcut toggles between 'Tasks' and 'Recent' sections, why are they not both there?
What would be the way, if even possible, to achive what I actually want: a custom jump list of which the items launched will group under it's taskbar icon? (note that the processes I plan to laucnh their do not have their app id set currently)
not much reactions here ;]
In the meantime I managed to solve the main problem myself; it's not quite a straightforward solution but it fullfills the requirements: a program runs in the backround and installs a CBT hook. Each time an application creates a window (HookProc code = HCBT_CREATEWND), the hook checks the application's path against a map containing paths and desired application ids. If a match is found, the application id of the HWND is set. Since this occurs before the window is actually shown and is combined with the custom task list, from a user's point of view the application behaves just like one that does support a recent/pinned document list.

How to practically customize IE context menu?

I need to add one menu item in IE context menu. It is similar with Google customized context menu "Search Google for xxx" when you right click on IE.
I did a research and found that overriding IDocHostUIHandler::ShowContextMenu in a IE BHO can customized IE context menu. The sample project can be found in Popup blocker project published in codeproject. It works well and is easy to implement. However this approach has a problem. The problem is it will conflict with other add-ons' context menu customization per MSDN.
In MSDN Internet Explorer Center forum, there are some discussions about this topic. However there is not a proper implementation posted.
If anybody has experience on this, please share your idea. Thanks!
See Adding Entries to the Standard Context Menu on MSDN.
For some sample code, download and extract the Web Accessories for Internet Explorer 5 (the mechanism still works in IE versions up to and including 8). Look at ie5wa.inf and *.html for examples of various IE context menu extensions.
Note that the abive is achieved without COM, purely via one registry setting and a file containing a blob of script (Javascript, JScript, VBScript etc.) The script (JScript, VBScript) may in turn work with COM objects, should your menu action logic reside in such an object, e.g.
create a HKCU\Software\Microsoft\Internet Explorer\MenuExt\My &Context Menu" registry key (&` precedes the menu accelerator letter, if any)
set the default value for the key to point to a file containing the script code implementing the context menu action(s), possibly interacting with a COM object (must support IDispatch IIRC; also read up on the My Computer Security Zone)
create a binary contexts value (0x02 for images, 0x10 for selections, etc.) which regulates when the new context menu should be displayed
I customized my IE in order to navigate to a selected text. You can read the full story and get detailed source code here.
The hearth of my solution is built around the following javascript code and the Registry key [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt]:
var parentwin = external.menuArguments;
var doc = parentwin.document;
var sel = doc.selection;
var rng = sel.createRange();
var str = new String(rng.text);
if(0 < str.length)
{
if (str.indexOf("http")!=0)
window.open("http://"+str, "_blank");
else
window.open(str, "_blank");
}