Context:
I am implementing a flex auto-suggest combobox - as the user types in each character: Consider the string 'Stackoverflow' and user input = 'st'
1) the data provider is filtered to show all items starting with 'st'
2) text is set to auto-suggest string such that the un-typed part is highlighted.
So for instance, the combobox text may contain st'ackoverflow', where 'ackoverflow' is highlighted using setSelectedIndex()
Issue:
When I hit back-space or delete, and check the 'this.text' value, I expect that the last un-highlighted character ('t' in the above case) gets deleted and the data provider is filtered to show all items starting with 's'. However the text property contains 'st', as before
Question:
what am I missing? What else can I try out?
I realized that my assumption was incorrect - when I hit backspace, the highlighted portion of the text alone should go away - I need to do some extra processing to get one extra character at the beginning to go away
Here is how this was implemented: Listen to the backspace key event and set a Boolean flag.
Then in the List change handler, read the boolean flag and set the this.text to what you want (i.e.) with 1 char deleted beyond the beginning of the highlight. Note that you cannot immediately set the this.text in the backspace handler because the textinput control backspace handler will reset what we set.
Related
I am using org.eclipse.swt.widgets.Combo which is not read only, meaning a user can insert any string or may select from the dropdown box.
But when I bind it to my model class property I get Null Pointer Exception whenever I am entering any text which is not present in the combo.
databindingContext.bindValue(WidgetProperties.singleSelectionIndex().observe(ComboReporterId),
BeansObservables.observeValue(Model, TextReporter_M));
Please help on this issue.
For a Combo where text can be entered you will need to observe the text:
IObservableValue targetOV = WidgetProperties.text().observe(combo);
You will have to bind this to a value that is a String (or use a Converter).
To Whom It May Concern:
I have a Dropdown list that populate a Text Field based on below code:
TextField.rawValue = Dropdownlist.rawValue
The user is Allowed Custom text Entry.
What I need is if the user adds his own text the textfield.rawValue should be empty
So far I have the follow script:
If (Dropdownlist.selectedIndex == Dropdownlist.selectedindex)
TextField.rawValue = Dropdownlist.rawValue
else
textfield.rawValue = "Empty"
endif
if I run this I get on the textField the value of "Empty" although I have selected a value that has a specific value assigned.
Your assistance is appreciated
That is in FormCalc and I work in javascript but the issue is in the logic, not in the syntax.
In your current setup the if statement condition will always evaluate to true - Dropdownlist.selectedIndex will always equal itself.
However, if the user has entered a custom value then the selectedIndex for that dropdown will be -1, so you can test for that.
Use this condition instead in your If statement:
(Dropdownlist.selectedIndex <> -1)
This Question was asked in interview but i was unable to answer it
please any one can tell me how to do this ?
i have two textboxs txtInput and txtOutput
When user clicks the btnSubmit, he should get the number written in txtInput in words in txtOutput. Eg. if user enters 100 in txtInput, he should get hundred in txtOutput
Prumably this is JS. If it is the you can setup an event listener on the submit button and disable the default behavior. Pass the input value to a function that builds the number string and update the dom element for the output textbox with that return result.
If you're using a round trip to the server for the calculation then just ignore all the dom stuff and return the page with the appropriate values set.
If you're using a front end framework then this gets easier but more specific to the framework.
thanks ..found solution here
.NET convert number to string representation (1 to one, 2 to two, etc...)
I would like an Unbound combobox located in the header of a form to match or filter by any character (s) that a User inputs. I would like those matches only to display in the combobox itself. Once the User selects one of the choices have the form go to that selection and reset the combobox to a complete list.
I tried a parameter query, but that only works once and does not reset. I also looked into LIKE and CONTAINS , but have had no luck.
Use the following in the combo RowSource property:
SELECT [Value for combobox list] FROM tbl WHERE [Value for combobox list] LIKE '*' & forms!MyForm!txtInput & '*'
You need to do cmb.Requery at some stage after a change is made in txtInput. If you do it on the txtInput_OnChange event, you will need to access the Text property of txtInput, so you would need to change the above SQL slightly.
Simplest would be to have a button to be pressed after typing in the filter and putting the Requery method in cmdFilter_Click event
I have a basic question about the usage of QTable. Consider the following example. I would like to create a table with three columns - Name, Age and weight. An "add" button should be able to add a row in the table. The newly added row show be completely edited before leaving (i.e. all the three columns should be edited). Is there a signal which indicates that the complete row is left or the control is no more there in current row?
Such a signal will help me to put some error checking on the input values (e.g. checking if age is a positive no.) in all three columns (also to ensure that none of them is empty). Since this seems to be a very basic requirement, I think I am either missing the signal or the mechanism to support such working.
Instead of QTable you should use QTableWidget or QTableView.
See http://doc.qt.io/qt-4.8/porting4.html#qtable
Now, responding to your question.
Have you tried using the itemSelectionChanged() or itemEntered() signals?
Another way to do it would be to use the signal cellActivated() or the signal fired by your "Add" button - to indicate that the edit has started. Then you setup a connection to catch the next mouse button click or Return key pressed signals to detect the editing ended.
Edit:
I suppose that in your app you subclass QMainWindow or QWidget, if so, reimplement QWidget::mouseMoveEvent and/or QWidget::keyPressedEvent to detect when the left mouse button was clicked ( use keyPressedEvent to detect when the Return Key is pressed ).
You can read more about events in http://doc.qt.io/qt-5/eventsandfilters.html