Backspace not working for IE Toolbar - c#

I am developing the Internet Explorer Toolbar in c#.net using the band objects.
Now in my toolbar, I am using the textbox field to make the search enable, but in this textbox field, I am not able to use the backspace, delete, arrow keys and many other such button.
I am not sure about y I am not able to use this. Please help me about this. I found many question posted over like this, but none of them was having the specific answer.
Thanks

The problem is that the browser is eating the events for those keystrokes, so the solution is to force focus to the toolbar when the text box receives focus.
To fix it add this line to your toolbar's constructor:
yourTextBox.GotFocus += (sender, args) => OnGotFocus(args);
Also make sure you have implemented TranslateAcceleratorIO() per this example.

Compare your code to this one and see what's missing.

Related

Telegram Bot make InlineKeyboardMarkup buttons unclickable

Is there any way to make InlikeKeyBoardMarkup buttons unclickable after user click on any button in? I've searched in google and as far as I understand I can only disappear ReplyKeyboardMarkup buttons, what does not satisfies me.
I am using Telegram-Bot library in C#
Can't be done visually but there is an alternative I've been using for a while:
Use editMessageReplyMarkup method and generate same keyboard layout but the button you want to become unclickable set as callback_data type with value like null or any other value you won't be using, clicking it will send Callback Query to the bot which you can simply not answer to or answerCallbackQuery it instantly (the 'clock' icon on the button will instantly disappear).
You can just delete the message of the question or edit it to say something like:
"I asked you if you like me and your replied of course."

how to detect COPY/PASTE event on mouse right click event in C#?

I am able to catch the right click of the mouse but i want to catch RIGHT CLICK + COPY/PASTE event
I tried to search on net but unable to get a single proper answer.
I've found some useful hints in an other post:
If you want to handle the Paste operation yourself, before it even
happens, you will have to intercept the WM_PASTE message to the text
box. One way of doing is would be by creating a specialized control.
You can find the code here
Question is not clear to me
If you will add specifics I will try and help
I do what may be what you are asking with ContextMenu
This is cut, but you would use Paste
CopyToDigest would be your custom handler
CommandBindings.Add(new CommandBinding(ApplicationCommands.Cut, CopyToDigest, CopyToDigestOK));
I got it from the book Pro WPF by McDonnald

Why do Enter and Space keys behave differently for buttons?

As far as I know, these are the only keys that react when a button has focus.
Pressing Enter instantly 'clicks' the button, even if you keep it the key down. (So the 'click' happens on KeyDown).
Pressing Space acts more like a normal mouse click; holding it down doesn't activate the Click event, but it does once you release it. (So the 'click' happens on KeyUp or KeyPressed.)
Why the difference? I'd like a good article on the subject or simply a logical explanation as to why those two keys have different behavior. Surely there's an explanation out there!
I can't find any articles explaining this and it's a really good question. I personally think that it's for functionality purposes
Enter Key the classic AcceptButton acts like a FullClick (Click/ClickReleased) that's why if you hold it you will have the effect of clicking multiple times.
Space however is a SingleClick (No click release until you release the key) so it can accomplish task where only a Click is required without a ClickRelease and actions where only the selection of a control is required to activate it. Like the CheckBox or RadioButtons which can't be activate with the Enter but can be activated with the Space like if you click on it.
In conclusion, the Space would be the official MouseClick since it has the same effects of a MouseClick uppon pressing or releasing. Enter would be sort of a shortcut for a One click full click. All, of course, in the idea of giving more possibilities to the keyboard itself.
You're seeing two different behaviors, which aren't associated except that they both deal with keyboard events on a winform.
Enter is special because it's the keypress to activate the acceptButton of a form. In fact, you missed another key that can affect buttons: Esc is the cancelButton, and will throw events as well.
As PhaDaPhunk explained, Space is a MouseClick for any component that accepts a MouseClick, but I haven't found a detailed explanation for it. I'd assume it's the default behavior of all controls. The Microsoft guide to accessibility seems to imply that is so in their section on keyboard-based navigation
Incidentally, this Microsoft support knowledge base entry seems to show that the spacebar implementation went from Button.Click to Button.MouseClick. Perhaps that's the reason for it's different behavior.
This functionality seems to have been removed in Big Sur. I came here looking for how I could get it back. It can be very efficient to click enter to proceed or spacebar usually to cancel, to pick the two primary options on most dialog buttons.

Disable bold button

I want to disable "bold" toggle button in an Excel sheet.
How can I do it?
I have the following code but it's not working:
CommandBarControl test = excel1.Application.CommandBars["Formatting"].FindControl(Id:113,Recursive:true);
if (test.Enabled)
{
MessageBox.Show(test.Caption + " enabled");
test.Visible = false;
test.Enabled = false;
}
I think it's not working because from Office 2007 they are using Ribbon Controls.
Can anyone help how to get the control of a specific button? So that I can change it's properties, enable/disable it by default, etc.
I'm afraid the answer is indeed that it isn't possible.
I've been looking at possibilities with class modules, because I thought that using a class, you could intercept the event that changes text to bold and then cancel that event. However, everything I could find was related to other events (value changes, calculation, workbook structure changes etc).
Even if it would work though, it would involve some serious coding and be error prone.
Maybe you're going at it the wrong way - what's the reason you remove this button? Probably there's another solution to your problem.
And as mentioned before, removing the button doesn't block the possibility to use ctrl+B or to paste bold text - you simply can't prevent this.
Not the answer you want, I'm sure, but I'm afraid this cannot be done.

selenium c# nunit problem getting focus off a textbox

I am testing a web app where a file is to be renamed as follows
1)first click on the files name
2) this will make a textbox appear
3) I type the new name in textbox
4) I have to click outside the textbox so that the new name gets set.
or
4) Press enter key
The problem is in step 4. I've tried to get it to click at several places in my app, but the textbox doesn't loose focus and hence the name doesn't get set. I've even tried to use focus command, but, in vain.
Also tried to do this with enter key, but, seems that it doesn't work too. I tried keypress, keypressnative, etc. nothing seems to work.
Note: this sequence works when I do it manually and doesn't work when I do it from IDE or RC for C#.
Any help in this direction??
Thanks,
Vamyip
Selenium does not always fire the proper events. Probably your application relys on the blur event of the text box?
Try
selenium.fireEvent(locator_for_textbox, "blur");
Capybara throws an error because the driver does not support 'blur'
So I use:
find('html').click

Categories

Resources