Slack Block Kit Plain-Text input element update text value - slack-api

Im currently writing a small Slack App in Python using Bolt. Im creating a Modal in response to a slash command which consists of a few Plain-Text input fields and two date pickers.
On one of the text input fields i set dispatch_action to True and define on_character_entered as trigger action as suggested by the API reference.
This way i can handle the event issued when the user enters text into the field.
This does work great and i push a new modal view when a specific keyword is entered. I store the initial's modal view id and hash to access it again when the newly pushed modal view is submitted in order to call views_update() on it (api). The idea is to change parts of the text based on the input of the second modal view.
This seems to work, but does not quite do what i want. The Plain-Text input does not have a field for its value, only for initial_value (which is the only thing i change in the views_update()).
When i return to the first modal view which contains the text input it still displays the original text without reflecting the changes, but from the response of the views_update() call i can see that the initial_value was changed correctly.
I guess that the initial_value only sets the text when the view is created for the first time, but does this mean there is no way to update a text input's text value without recreating the whole view?

Okay i just found the solution here. Basically you need to force slack to rebuild the ui element (in this case the text input field) by giving it a new block id when calling views_update().
Then the initial value gets used to fill the text input thus solving my issue.

Related

Xcode swift : connection from buttons to Text Fields

I am new to swift programming and Xcode
However I am creating a dart counter app but having trouble connecting the buttons to Text fields
I have buttons numbered 0-20 on the main story board and three text fields (one for each dart) how do I connect the buttons to the UITextFields - I can’t figure this out
Thanks
Based on my understanding of your issue, you actually need to connect the buttons to the text field in code. There is not going to be a simple way to do this in the interface builder. What you are looking for is to have some action happen when the user presses a number, and this may be added to the current value in the text field.
Create a function that handles any number button being pressed.
#IBAction func buttonPress(sender: UIButton) {
print(sender.tag)
//TODO: process the button based on its tag
}
Update all of the buttons in interface builder to have a tag value according to their number. This will let you handle them all in the same function (above) and differentiate between them.
Update the TODO block to handle the action appropriately. I would start by adding a variable to keep track of which dart number you are on, and using a switch statement to handle putting the value in the appropriate dart text box.
So there is always a current text field. Maintain an instance property that points to it. When the user taps a number, use that instance property to enter that value in that text field. When the user taps Enter, change the instance property to point to the next text field.

Value from dropdown on IconTabBar empty

change view (XML) contains IconTabBar with 3 IconTabFilters, which contain input controls (input, combobox, datePicker...). These input controls have pre-filled value from OData model. On the bottom of the view is button "Save". When I click on "Save" button, in my "onSave" function I am reading values from input controls from all IconTabFilters, but only values from the input controls on the first IconTabFilter are filled. Values from the rest of the fields are empty.
When I click on all IconTabFilters (without changing values), click "Save", then I'm getting all values correctly.
Please what I'm doing wrong? Odata model contains all required values, and also IconTabFilters contain all required values. But I can't read them from input controls before clicking on all IconTabFilters.
The Controls on the tabs only get initiated when they have to be displayed. This is done to improve the felt performance of the UI.
Since you are already using model binding, you should take the values out of the model instead of the input fields.

UserInteractive Substring in text Label

i am generating a label in a view with label text retrieving from a JSON file.
now there are certain texts(values) retrieved from the JSON file that are user interactive texts (URL/some action) and some are not.
Now i am retrieving the data which are user interactive, setting them as text of a UILabel (which i created dynamically) and setting it in the view (PS. my view controller only has a 2 views inside,one that is default and another in which i am generating the label).
The problem that is arising is that the interactive strings(labels) are set in one line and the ones that are not interactive are set in the next line(as i am creating individial labels for them) even if its a single word.
I want to set the labels (with the texts - interactive/noninteractive) side by side untill there is no space.
Cant wrap my head around it because its a logical problem.
Any help is appreciated

Keyboard pushes the whole view up in WP7

I have 3 grids:- Header,Body and Footer with Body having textboxes.
I have included the Body inside a scrollviewer so that user can type as much data as he wants in the texboxes of Body.
But when the Keyboard pops up the whole view is pushed at top and I cannot see the Header.
The textboxes have wrapping on and also accepts return.
Can the scrollview move up the text when keyboard pops up?
Thanks and Regards,
Kanaya
Not entirely sure if this will help. How about some XAML?
You could capturing the Focus event of the text box that brings the Keyboard up. In that event you could set the scrollViewer.HorizontalOffset property to some caluclated value to get whatever you want in view.
Edit: HorizontalOffest is only a getter user ScrollToHorizontalOffset instead
You probably can make it scroll up like you want, but it will appear very strange to seasoned users of the WP7 operating system. Expected behavior for text input is exactly what you described, the notion Microsoft (I believe) is trying to hit here is that when you want to type something in, you want to clear everything else out of view, and only focus on the textbox at hand.

read-only Textbox

The form window(chat window) that i am creating for a lan messenger is similar to the one in google talk with two textboxes. What i need to do is to transfer characters typed in the lower textbox(textbox2) to the upper textbox(textbox1 which is read-only) when i click the submit button without showing that textbox1 is read-only because the characters are appearing in grey.please help with code if possible.
Use a label for this instead of a textbox. If the only thing it is doing is display the characters and not a direct edit, you won't lose any functionality and the text would not be greyed out...
If you're going to use a Texbox, set it to Locked. That shouldn't gray the characters out. Otherwise in KeyDown/KeyUp events, set the e.Handled property to true (which will tell the box that you want to handle the input yourself and don't want the message to filter down).
That oughta do it for you.

Resources