Python-Telegram-Bot How to allow for multiple callbackdata when using InlineKeyboard? - telegram-bot

Is it possible for the user to click on multiple buttons, thereby appending all the callback_data into one single data set, and only quit the current state of a handler after clicking on the Done button?
My understanding so far is that you can only click on the buttons a single time which will send a single callback_data as the query.
def start(update, context):
keyboard = [[InlineKeyboardButton("bal bla", callback_data='1'),
InlineKeyboardButton("bla bla", callback_data='2')],
[InlineKeyboardButton("bla bla)", callback_data='3'),
InlineKeyboardButton("bla bla", callback_data= '4')],
[InlineKeyboardButton("bla bla", callback_data='5')],
[InlineKeyboardButton("Done", callback_data='Done')]
]
reply_markup = InlineKeyboardMarkup(keyboard)
update.message.reply_text('Please choose:', reply_markup=reply_markup)

My understanding so far is that you can only click on the buttons a single time which will send a single callback_data as the query.
That is correct. You can still design your code such that it saves all the selected data and only starts the next step when the user presses the Done button.

Related

intellijidea code completion not new variables

I'm using Android Studio and I have code completion enabled as in picture.
I have enabled "Autopopup code completion" and "Insert selected variant by typing dot, space, etc..".
I want to write:
Drawable d = new BitmapDrawable(....);
I write "Dr", appears the popup, I click the space bar, and it writes "Drawable". It's all ok.
Then I write "d", appears the popup with "drawable" suggested, I click the space bar, and it writes "drawable".
But I want to write "d".
Is it possible to change this option applying only to classes and methods and not to new variables?
There is not a way to have code complete only apply to classes and methods and not to new variables. You have three options:
Turn off the Insert selected variant by typing dot, space, etc." options. You will then need to use Enter (to insert) or Tab (To overwrite) when you want to select an item from auto complete. The . (period/dot) key will still work when completing classes if you want to invoke a static member. (This is likely the best of the three choices and is the default behavior.)
After you type d for the variable name, hit Esc to close the auto complete popup before you hit the Space.
Turn off "Autopopup code completion" so that you have to manually activate it each time via Ctrl+Space

Dirty on command?

I have an Access 2010 application that has a form with a text box and a command button on it. Clicking the command button places a default value in the text box.
Question: When a user clicks the command button I can either:
Run an SQL update to save the new text box value in the data source that it is bound to plus set the me.textbox1.value to its new value, or
Run the same SQL update to save the new text box value in the data source that it is bound to plus do a form.requery?
Which is better? Would changing the bound value in the data source initiate a current event and an automatic requery?
Thanks in advance.
If you want to save the entry immediately, I would write the value to the text box, and do
Me.Dirty = False
to save the record in the bound form.
I see no point in doing this via SQL.
Would changing the bound value in the data source initiate a current event and an automatic requery?
No, that would actually be the worst method. The form wouldn't know about the changed data source, and once the user would start editing, he would get the "Write Conflict" message.
Your 1. would have the same problem.

Code "delete my account" button

Im using vb 2013. I tried to code my delete button after adding SQL delete in my Database. I wrote code in the class (I called it userFunc) calling the SQL DeleteItYourself with the variable DeleteIt. I created button with the toolbox and double clicked it, now I'm lost. I have session in the Login button to make sure it presents the user nickname. I redirected it to the homepage when the "I want to delete my account" located. Iactually don't know what to do with the button. I want it to call the function DeleteIt, but before the function Delete I want it to ask the user with some pop up alert if he's sure. Any ideas how to code my button?
(I'm a high school student and it's my project, they don't ACTUALLY teach us Java, unfortunately... They tell us to copy paste and try to understand)
Use this as a starting point:
If MsgBox("Are you sure you want to delete your account? This cannot be undone.", _
(MsgBoxStyle.Critical + MsgBoxStyle.OkCancel), _
"Confirm Account Deletion") = MsgBoxResult.Ok Then
UserFunc(DeleteIt)
End If
MsgBox displays a message box to the user, waits for a response, and returns the value of the button pressed. In the code above, the three arguments are:
The message to display
The style of the message box. Note how these are numeric values and can be added.
The title of the window.

Save a user popup selection in a custom Automator Action

Using Xcode 5.* for a cocoa-applescript automator action.
Interface is a a simple popup menu that gets populated using an outlet with:
tell thePopupMenu to removeAllItems()
tell thePopupMenu to addItemsWithTitles_(theList)
When the action is used in a workflow (a Service actually), I want the next time it is run and the action dialog shows up (I will have "Options:Show when run" selected), I want the popup menu to change the selection to the last one that was selected. Right now, the default first item shows, even though last time it was run, the user selected a different item in the popup menu.
My thought was that I need to capture a change in the popup menu with a Sent Action handler, and then set some type of default. I have a working handler:
on thePopupMenuSentAction_(sender)
set popupValue to (popupSelectedValue of my parameters()) as string
-- save this selection somewhere???
end
What's the right way to save this? Do I use User Defaults? My Bindings are currenly all tied through Parameter object/controller. If I should use User Defaults, can someone give example code for setting up User Defaults, and then how to get and set a new value using Cocoa-Applescript?
If I can get the name string of the menu item saved somewhere, I can get the string and then change the selection of the popup menu in the
on opened {}
-- set up the action interface
end
handler which gets called just before the action is displayed each time.
Thanks for any help,
Joe
I did mine a bit differently. I will assume you are referring to what XCode calls a "pop up button" (somewhat misleading). I did not use the parameters at all, although that is probably better for larger projects. Have a look at the code:
script Insert_Picture_into_Powerpoint_Slide_Show
property parent : class "AMBundleAction"
property menuChoices : {"Insert a Beginning", "Insert at End"}
property menuSelection : missing value
if (menuSelection as string) is "missing value"
set menuSelection to 0 as integer -- sets default value
end if
end script
I bound Content Values to File's Owner and under Model Key Path I put menuChoices.
Then you just bind the Selected Index to File's Owner and for the Model Key Path type menuSelection.
Defaults
On the initial run, if the user does not click anything, the menuSelection will be missing value. Because I couldn't find a way around this, I created a conditional which tests for this and sets it to the first choice by default (the one that is shown when you add the action).
When the user selections one of the menu choices, the choice is remembered on sequential runs.

How would I triple-click in Sikuli?

I am trying to select an entire line of text on a web page (in a table) using Sikuli. The easiest way to select the text is to "triple-click" on it. Is there a way to triple-click in Sikuli?
Thanks!
GregH,
I got the following to work for me:
click(img.png)
mouseDown(Button.LEFT)
mouseUp(Button.LEFT)
wait(0.01)
mouseDown(Button.LEFT)
mouseUp(Button.LEFT)
This allowed me triple click on a button, link, or whatever I needed to click on.
This works for me:
def tripleClick(PSMRL):
hover(PSMRL)
for x in xrange(3):
mouseDown(Button.LEFT)
mouseUp()
quick fix solution would be to check out the mouse settings in control panel and you can lower the time between clicks required to register successive clicks needed to perform the 'triple click' action
Have you tried low level mouse functions? Something like this should work:
for x in xrange(3):
region.mouseDown()
region.mouseUp()
Depending on what is being clicked, sometimes, the click type is the same as multiple clicks in succession. Meaning, if what needs to be clicked doesn't have to be double/triple-clicked very fast, then you can just use a sequence of single clicks. 2 clicks = double-click, 3 clicks = triple click. I know that 2 clicks will simulate a double-click on Windows desktop (not sure about things like games, etc.)
I've seldom heard of a triple-click action though.
So, have you tried using 3 clicks to simulate triple-click to see if that works or not?
I f you use .click() will be good enough.
.click() is the left mouse button, .rightClick() is the right mouse button.
For example:
image1 = ("image1.png")
def multiClick(nTime):
imageLoc = find(image1)
for n in xrange(nTime):
imageLoc.click()
# Click 3 times.
multiClick(3)