Kivy search box with suggestion? - kivy

I am beginner to kivy so seniors pls help me how we can bind textinput box to suggestion so that user and touch and select the suggestions?so user can touch(suggestion) ,select and open(suggestion)in Label.I have a long multi text file so i want to open it by chapter or by title.thanks a million for your helpgetting suggestion from search bar
opening suggestion keyword(text)to new screen/Label

it is easier to understand your questions, when you write it more specific and adding the code, e.g. of the TextInput etc.
However, if you want suggestions pop up while the user is typing anything into the TextInput: use the `on_text' method. it gets called when the text is changing.
e.g.
class SearchBar(TextInput):
def on_text(self, widget, value):
#value is the currently typed text
#call function that gets the suggestsions based on the typed text
# use add_widget() function to create Widgets into the layout for the suggestisons....
pass

Related

Why is it impossible to make a Markup TextInput in kivy?

So i am trying like for months using different techniques to make a markup textinput. However their are a million issues that arises. However if we would see TextInput.py we can see that the textinput uses a label for displaying text. so I tried dding a markup = True to that label. However I see no good result. So why is it that kivy textinput have no markup. and is it possible to add a markup.
TextInput uses labels, but it doesn't inherit the Label class. Even though you set markup = True, nothing happens because TextInput doesn't have the attribute. The kivy document says
The TextInput widget provides a box for editable plain text.
So why is it that kivy textinput have no markup.
Ultimately, because it's hard and nobody has both wanted to and had time to implement that feature.
and is it possible to add a markup.
It is certainly technically possible, but you'd need to read the TextInput source and work out how to add it.
You can extend TextInput to create a markup capable TextInput by importing MarkupLabel as Label like this:
from kivy.core.text.markup import MarkupLabel as Label
from kivy.cache import Cache
from kivy.graphics.texture import Texture
Cache_get = Cache.get
Cache_append = Cache.append
class MarkupTextInput(TextInput):
def _create_line_label(self, text, hint=False):
# Copy this method from TextInput with no changes
The _create_line_label() method creates a Label and uses the Texture from that Label in the TextInput. Normally kivy.core.text.Label is used, but the above mentioned import results in kivy.core.text.markup.MarkupLabel being used instead.
That will give you a MarkupTextInput where you can type in markups (like[b] and [/b]). It is still not complete because the cursor position will be incorrect. When you type in [b], those three characters suddenly disappear, but the cursor position won't back up. Fixing that is the hard part. Maybe someone can figure that part.

Textbox hint in ZK

I want to have a textbox with a hint. For example, if that textbox triggers a search, I want it to initially have a "Search" text greyed out and when the user starts typing for it to disappear. How do I achieve this in ZK?
In android I think I had the hint tag, so I want something similar to that.
Okay, so I found it's called placeholder.

How to make text is constant in edit text in android app?

I have one edit text in one activity,
I make the text inside it as number and saved that number in shererdPreference.. and make that activity is visible once at the begging of the app, and return to that activity from the setting we made.
How to make that text is visible to user ( fixed ) in edit text?
If the user should not be able to modify the text, use setEnabled(false).

Dynamically change certain text in textarea with drop-down selection

I have a text area that has names within the default value. For example the textarea reads..
(dynamic registrant name) just registered to become
a donor in (dynamic from pull-down above)
honor. This text is editable
So in the same form I have an input that asks the user for their name and a select box where they can choose among a selections of names. I am trying to change the names within the text area based on the values they enter in the input and drop-down fields above the text area. Can someone help with this? I am completely stuck. I have read through some of the forums here and it looks like a lot of the solutions are to use ajax. I have zero experience in ajax and would like to find a solution that does not use that...is it possible? Or could someone help with a solution?
I don't think textarea is what you want exactly. What if the user takes off the (dynamic from pull-down above) part? How would you know where to put the text at? Even if you somehow could, I suggest you make regular text input elements for contents that the user can change and put the other dynamically changing text as uneditable html text elements (or however you want to format them).

How can I add selectable suggestion on textfield

I'm not sure if I use the phrase correctly.
The function I want is that after user typed some characters (or clicked a button), a list will be shown under the textfield.
An easy example is Google search. After you typed "fb" or "faceb", it shows "facebook" in the suggestion list.
The content of the list is stored in an array, which comes from the return of web services.
Thanks
You've got to intercept the keystrokes with UITextView textViewDidChange. Then, with each keystroke, you implement the lookup algorithm and display your list of selections above or below the UITextView where the data entry is occurring. The list has to somehow be "touchable" to select from it.
Ray Wenderlich has a tutorial that shows how this can be done over at his blog
He creates a table below the text field that is touchable.
There is also a sample project there.

Resources