Mouse Right Click on WindowsUI DevExpress - c#

Actually, I am have designed an application using WindowsUI(MetroUI) with TileContainers.
Now,My problem is that : I have a text in TextBox and I have selected the text and want to copy it with mouse right click other than ctrl+c.(Because my clients are not aware of the shortcuts).
So,When I'm rightclicking on the textbox with mouse,the TileContainer WindowsUIButtons are sliding from top of the page.
Is there any chance of getting that?
sorry for my bad english :)

If I understand your question correctly then you could just use a Context Menu.
See this URL for a step by step process on doing exactly what it sounds like you are wanting.
Hope this helps.

Related

Press a button using class names in c# dom

So basically I want to press a button in a website and i dont know what code to use. The HTML line looks like this:
Click Here
I want the program to click on that Free Button using DOM. I tried this :
webBrowser1.Document.GetElementByClassName("free").InvokeMember("click");
But for some reason the GetElementByClassName is highlighted (in visual studio 2015)
I cannot change the HTML since the website is not mine.
It's highlighted cause there is no function GetElementByClassName in WebBrowser.Document!
Look at this, maybe it would help you:
How to select a class by GetElementByClass and click on it programmically

DevExpress TreeList hanging on expand

So my tree loads and looks just fine and I can get it to workish. When I click on the expand button, the children load just fine, but the loading box doesn't go away. But if I click the check boxes next to the expand button it makes the loading box go away and I can then expand or minimize once more. But again when I click the expand it hangs up until I check and uncheck one of those boxes again. Can anyone point me towards what could be causing this. I don't know if maybe its just a setting or maybe I need to load my Data dynamically or something. If someone could just point me in the right direction I would be grateful.
I found out that I am getting an error now, but I have to head home for the day. Ill post the error and maybe that will help you guys help me.
Uncaught TypeError: Cannot read property 'settings' of undefinedVM105:346
delegateVM105:1240 (anonymous function)VM93:5109
jQuery.event.dispatchVM93:4780 elemData.handleVM93:5021
jQuery.event.triggerVM93:5344 jQuery.event.simulateVM93:5595
handlerVM138:742 _aspxSetInnerHtmlVM138:8958
_aspxCreateClass.ProcessFullCallbackResultVM138:8925
_aspxCreateClass.ProcessCallbackResultVM138:11431
_aspxCreateClass.ProcessCallbackResultVM138:8767
_aspxCreateClass.OnCallbackVM138:5213
_aspxCreateClass.ProcessCallbackVM138:5198
_aspxCreateClass.DoCallbackVM138:10647 $.ajax.successVM140:3062
jQuery.Callbacks.fireVM140:3174 jQuery.Callbacks.self.fireWithVM140:8249
doneVM140:8792 jQuery.ajaxTransport.send.callback

Programmatically Clicking on a Web Page's Button in Windows Forms Application

I am working on a project which is Analysis of Papers from Google Scholar. What I do is basically, parsing the HTML, storing related fields into database etc. However, I am stuck at a point, while I am taking the Titles of the publications, I realized, I am able to get first twenty elements. But, there are sixty papers in related account:
http://scholar.google.com/citations?user=B7vSqZsAAAAJ
So, I think as a solution, I need to click to the 'show more' button programmatically, so I can have all the Title's, Publication Venue etc.
What do you think? How can I perform that kind of action?
Edit: I checked the 'show more' button, while there is nothing to show as a next page, its html code still remains same. As a solution I can use loop for n times. However, I am looking for more robust solution.
Thank you for your time!
If it is clicking on a button within a WebBrowser control on a Windows Form Application, then 'Yes' you can do it.
There are ways of getting more control over identification by using XPath.
(You might need to use Javascript to use XPath for object interactions - since you haven't asked for that, I will assume you don't need it)
webBrowser.Navigate("http://www.google.com");
// Or
HtmlElement textElement = webBrowser.Document.All.GetElementsByName("q")[0];
textElement.SetAttribute("value", "your text to search");
HtmlElement btnElement = webBrowser.Document.All.GetElementsByName("btnG")[0];
btnElement.InvokeMember("click");
Or even typing into text boxes with
webBrowser1.Document.GetElementById("gs_tti0").InnerText = "hello world";
If its this website specifically, there is a simple workaround. Change the query string to what records you want.
http://scholar.google.com/citations?user=B7vSqZsAAAAJ&cstart=0&pagesize=2000

Search for a button by its HTML Code

I am writing Coded UI Test's for a web app. I am having problems such as I record actions using the test builder, however sometimes the button that is clicked has different information each time I run the test and as result VS can't find the button.
The html code never changes so what I want to do is find the button by its html code and click it that way.
For example on Google the path to the search button is
<button id="gbqfba" aria-label="Google Search" name="btnK" class="gbqfba"><span id="gbqfsa">Google Search</span></button>
How can I click this button using the code above or Alternativly using the XPath
//*[#id="gbqfba"]
Any help would be greatly appreciated.
adjust the Search Properties and Filter Properties.
Something like:
$('button span').each(function(){
If($(this).html() == "Google Search")
{
$(this).parent('button').click();
}
});
I found the answer, If you go to the UIMap.uitest file and click the method you have the problem with you can change the filter properties and the search properties to remove parts that are failing your test.
This will do the trick:
BrowserWindow.ExecuteScript("$('#gbqfba').click();");

Get highlighted text from active window

I would like to know how can I get highlighted text from any window for example: (excel, ie, firefox,…).
please note that the following message not work in the above application
WM_GETTEXT,WM_COPY,EM_GETSELTEXT.
I have also tried control C (copy) and get selected text from clipboard but it is not a good idea.
Language used: C#
I haven't tried it myself, but the Microsoft UI Automation API should have the functionality that you need.
The UI Automation API is what you would use if you were building a screen reader to assist blind people. So it should definitely be able to access the selected text in an arbitrary application.
A good place to start would be with the "Text Pattern Overview" at http://msdn.microsoft.com/en-us/library/ms745158.aspx
Also keep your eye on question 517694. I think you'll find that answers to that question will solve your problem.
No answers huh? Well, I know you can get it from Excel, Word etc using interop. Look into that. It might give you som ideas on how to proceed with ie and ff. But basically the recieving application must have some sort of fascility for letting you do this and I don't think there's any general way which works all the time.
There is no general purpose answer to this question. Each window class will have a different solution.
For instance, if the hilighted text is in an edit window, then you can use EM_GETSEL to get the range of the selection, then WM_GETTEXT to get the text (and then throw the unselected part a way) or EM_LINEFROMCHAR to turn that range into line indexes, and then EM_GETLINE to get the selected text one line at a time.
But this won't work for any other window class.
No need to write this in C# from scratch. What's wrong with using the clipboard? This script ensures that it restores what was on the clipboard when it has finished.
Autohotkey makes this much simpler.
; Hotkey: Ctrl Shift t
^!t::
; Remember what was in the clipboard
clipboardPrev = %clipboard%
; Clear the clipboard
clipboard:=
Sleep,200
; Send a Ctrl C to copy the current selection
SendInput, {Ctrl down}c{Ctrl up}
Sleep,200
; Get the current selection from the clipboard
selectedText=%Clipboard%
if SelectedText =
{
; If the first attempt didn't get any test, try again
Sleep,200
; Send a Ctrl C to copy the current selection
SendInput, {Ctrl down}c{Ctrl up}
; Get the current selection from the clipboard
selectedText=%Clipboard%
}
; Restore the clipboard
clipboard=%clipboardPrev%
MsgBox, %selectedText%
return

Categories