Telegram Bot make InlineKeyboardMarkup buttons unclickable - c#

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."

Related

limiting tabbing to a custom in-window message box

I have made a custom MessageBox for my application and it launches as a UserControl. I have two buttons inside it and I would like to allow users to press Tab to switch between Buttons. However, since it's a UserControl overlaying the content, Pressing tab more than twice makes the focus go in the background on elements that aren't supposed to be tabbed at.
I can't figure out a good idea how to prevent this, I've thought of making a method that will select all elements and make their IsTabStop values to false and then restore them later, but I think that would be more of a problem then a solution.
Is there a way around this to limit tabbing only to the UserControl?
I would also appreciate advice on working with the message box.. the whole messagebox is an async function that has an infinitive loop until the answer is given. Is there another way to stop the application until one of the message box options was selected?
Crowcoder's reference has lead to correct MSDN page where I found my solution:
dialog = new UCMessageBox("Are you sure you want to exit the application?", MBType.YesNo);
AppMessageBox.Children.Add(dialog);
KeyboardNavigation.SetTabNavigation(dialog, KeyboardNavigationMode.Cycle);
The key was to call .SetTabNavigation function and direct it to my dialog (custom UserControl for the message box) and setting the KeyboardNavigationMode to Cycle.
After closing the UC rest of the application continued normally regarding navigation.

ASP.NET WebForms WebSite - controls changes their's values in codebehind but not on frontend

I will try my best to express what I do not understand about WebForms. Maybe somone can explain it to me....
I work in 'quite big' WebForms (website) Application.
Application already has a PopUp (which I HAVE TO USE, because I dont have time to make a new one) like MessageBox in Winforms, but:
it's place is in MasterPage.master (I use it like ((MasterPage)Poup.Show("blablabla", yes_no));
I can add buttons to it and change style etc.
it doenst stop application (like .ShowDialog() in WinForms), so I have to assign onClick events dynamicly and assign/catch them on Page_Load to go to the wanted method depending on users input on form. At the moment i can't to anything about it.
And here is the problem:
Depending on form validation, if users press a button (on a form) - then form realods it's TextBox.Text's values and changes DropDownLists's SelectedIndexes and SelectedValues.
BUT IF YOU GO TO THE SAME METHOD WITH MY POPUP WINDOW:
ex: Do you confirm? YES/NO
If you press You press ANY button, then: CHANGES ARE VISIBLE BY CODEBEHIND BUT TEXTBOXES ARE STILL VISIBLE WITH PREVIOUS DATA ON THE SCREEN, ALSO DROPDOWNLISTS HAVE OLD VALUES SELECTED
BUT IF YOU PRESS A FORM BUTTON (WHATEVER WHICH), EVEN IF IT'S METHOD DOES NOTHING - ALL FORM WILL "RELOAD" AND HAVE PROPER DATA ON THE SCREEN.
(it's not about Runat="server" or AutoPostBack, I checked it)
I dont event know what to do about it :(
Update panels are used to partial refresh of some fields inside him, caused by certain triggers, like buttons, textchanged, etc.
See more about update panel's:
https://msdn.microsoft.com/en-us/library/bb399001.aspx
http://www.asp.net/web-forms/overview/older-versions-getting-started/aspnet-ajax/understanding-asp-net-ajax-updatepanel-triggers
http://www.asp.net/ajax/documentation/live/tutorials/IntroductionUpdatePanel.aspx
(Haven't worked with web forms events in a while, just answering in case nobody else does.)
Out of curiosity, what happens if, in your javascript handler for your popop button, you getElementById one of the form buttons on the main page and call ".click()" on it?
The basic problem sounds like there's a runat/server form on the main page, with certain behaviors associated with it, which is submitted by the main page runat server buttons but not by your popup JS.
Easy enough to test with the above approach. If that works, take a step further and try to figure out why it worked, based on what those buttons are doing.
(If you're not using JS at all for the popup, then View Source the output HTML, because I'm sure it is. Backtracking those calls should help you understand the trace from popup button press to form submission.)
I probably mislead you by "OnClick", it's NOT javascript OnClick="method()" issue.
I mean ClickEvent on a button (in codebehind). For Ex. If form is validated I have to do:
ViewState["PopUpSelection"] = "yes_no";
(MasterPage)PopUp.Show("blabla",yes_no) //loads popup from MasterPage;
return;
then on Page_Load I have:
**if (string)ViewState["PopUpSelection"] == "yes_no"
{
ButtonConfirmYes.Click += new EventHandler(MyMethod);
}**
And if method "MyMethod" is called from a FORM button, everything "will go ok".
If you call the same method from PopUp button: changes are visible by codebehind, but on the screen nothing happens, unless i press ANY FORM BUTTON, whatever it does

Numeric keypad on MonoTouch

I have a problem when using MonoTouch.Dialog to create a login screen.
If you look at the screenshots below, for a user to login they must enter their mobile number and PIN. Both of these EntryElements use a numeric keypad. The first problem is that there is no way to move from the mobile number field to the pin field. Secondly once they have entered their pin there is no 'done' button or anything to dismiss the keyboard. It's very counter-intuitive for them to scroll up in order to poke the Login button (shown in the second screenshot).
How do I get the little bar with previous, next and done buttons as shown in the third screenshot? I've seen this on some apps and was wondering if it's possible to get this working using MonoTouch.Dialog?
Keyboard in the way:
How do you dismiss the keyboard?
Ideally this is what I want:
This other Stackoverflow answer shows how to add a "done" button on top of the keyboard. Using this method you can add other buttons, as well.
The answer is to create your own DialogViewController with the following:
private UIView _toolbar;
public override UIView InputAccessoryView
{
get
{
return _toolbar;
}
}
You then create whatever you want to display in the UIView that is returned. I used a UISegmentedControl for the Next and Prev buttons and a UIBarButtonItem for the Done button.

Backspace not working for IE Toolbar

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.

Show only one instance of messagebox.show in c#

I have a created a custom keyboard shortcut for my application,
when the user press combination keys of CTRL + ALT + Q, i show
a messagebox "Are you sure you want to log out ?" Then if clicked
YES, i log out of the application.
Problem :
I want to make sure that, only once instance of message box shows.
No matter how many times the user presses the shortcut.
currently it shows multiple message box, on pressing multiple
shortcuts.
How to overcome this ?
From MSDN
A message box is a modal dialog box,
which means no input (keyboard or
mouse click) can occur except to
objects on the modal form. The program
must hide or close a modal form
(typically in response to some user
action) before input to another form
can occur.
File a bug on connect.microsoft.com !
Taking ck's comment into consideration...If you are showing a custom dialog (form) then you need to invoke the form using Form.ShowDialog() and not Show().
A quick and dirty way would be to have a class level boolean variable that tracks when the user is trying to exit. If they are, it's set to true, and your routine to display the dialog box can check this flag, then return without doing anything.
Seems like Singleton Pattern is your option.
I think you can create your own form and use the mymessageboxform.show() method, and check its dialogue result.
You'll want to make your application single instance so it can only be started once.
Single Instance App

Categories

Resources