What is includeInputInList property is used for in Autocomplete from Material-ui? - autocomplete

Have a study of Material-UI's Autocomplete with the playground on https://material-ui.com/components/autocomplete/, I really cannot see any difference with/without includeInputInList property? The document says 'If true, the highlight can move to the input.' I tried it, highlight never move to the input field.

The includeInputInList has 2 associated unit tests.
The description of the tests says:
it considers the textbox the predessor of the first option when pressing Up
it considers the textbox the successor of the last option when pressing Down
This means that with includeInputInList, when you have the focus on the component and you press key up, if it's the first item, the focus will go to the textbox (the input element), before continuing on the items. And if you press down and it's the last item, the focus will also go to the textbox.
Without that option the focus stays on the displayed items and never goes to the textbox, it jumps from the first to the last item (key up), and from the last to the first (key down) while you have the focus on them and just press key up or key down.
You can try on the example provided on the Material UI docs: press tab until you are on the MUI component, and then play with key up or down, with and without the includeInputInList prop on the Autocomplete component.

Related

JavaFX: Need a custom control based on TextArea

I have the following requirement (sorry, but I'm quite new to JavaFX).
I need to have a custom TextArea that supports not only entering text but also entering a kind of macro.
This Macro has a unique ID and an associated text. The text should be displayed in the TextArea but with an e.g. light grey background. This is because it should behave as a unit.
You should not be able to click inside the macro and add a char there. The cursor should be placed behind the macro. And is you press just backspace the complete macro should be deleted.
If you call something like getRawContent() of the custom TextArea you should get a placeholder for the macro and not the associated text like:
getRawContent()
==> "This is text part one MACRO:132 This is text part two"
If the macro 132 has the following text associated "XXX123XXX", you will see inside the custom TextArea:
This is text part oneXXX123XXXThis is text part two"
But the text XXX123XXX has a light grey background to show that this text is associated with a macro and could be deleted, copied, and so on as a whole unit. Could be italic as well as in the above line. Should be only a bit different to the generic text.
Could someone assist me?
My Custom Control works now. I used an Eventfilter to prevent the internal Eventhandler to process the keypressed events in order to set the caret position behind a macro or delete the complete macro when DEL or BACKSPACE is pressed, this works.
And I use a Mouselistener to prevent that someone clicks and set caret position inside a macro.
So now I have only the problem left to mark the text somehow that the user can see what is normal text and what macro content.
Maybe I close here and open a new question.

How do I get OpenOffice Writer Combo boxes to display multi-line text?

I am developing an OpenOffice Writer template that can be used to fill in reports for a child-care centre.
There are some standard outcomes, comprising long sentences, and I want the user to be able to select the appropriate sentence from a combo box. I have entered the sentences into a table in Openoffice Base database, which is then connected to a series of combo boxes in a Writer template. However, when the user choose an option that contains a very long sentence, only the text up to the length of the combo box is visible.
What I want to do is have the selected value of the combo-box wrap over several lines when selected so that all the (very long) text appears in the selected box when the user chooses a long sentence from the combo.
I have been looking through the properties of the combo box control, but have yet to identify one that will allow the selected value in the combo box to word-wrap (so that I could make the combo-box several lines in height such that the entire sentence would fit into the box).
Any pointers on how I could do this would be much appreciated.
thanks,
David.
Thanks Jim K, that was helpful. In the end, what I wound up doing was creating a textbox which I named "selectedOutcomeATextBox" immediately below my combo box which was named "OutcomeCombo".
I then attached the following macro code to the textModified event associated with the "selectedOutcomeATextBox":
Sub UpdateOutcomeA
Dim Doc As Object
Dim Form As Object
Dim Ctl As Object
Dim newCtl as Object
Doc = ThisComponent
Form = Doc.DrawPage.Forms.GetByIndex(0)
Ctl = Form.getByName("OutcomeCombo")
newCtl = Form.getByName("selectedOutcomeATextBox")
newCtl.Text = Ctl.Text
End Sub
I also set the "Printable" property of the "OutcomeCombo" to "No", so that when the document prints, the combo box itself does not appear on the printed page, but the "selectedOutcomeATextBox" textbox which has had its value set by the macro when I choose a value from the combo box does appear with the desired text. I also set the "TextType" property of the selectedOutcomeATextBox" text box to "Multi-Line", so that extra long text will wrap to the next line, thereby showing the very long strings that are stored there.
Thanks heaps Jim K.
cheers,
David Buddrige
Apparently combo boxes do not have the MultiLine attribute. The question was asked a few years ago here but was not solved.
One alternative that requires some macro programming is to use a single multi-line text field and then make a scroll bar button that changes the choice. Instead of a scroll bar, two buttons could be used to change the choice (Previous / Next), or even a list box control. Using a list box control in this way would have the advantage that they could see all the choices at once, like a combo box.
Another approach is to break up each sentence and display the parts across several lines of a list box. Then when one line is clicked, all the lines of a sentence are selected at once, using an event listener for the list box. This could be shown in addition to an ordinary editable multi-line text box, in case none of the answers in the list are wanted.
One more idea: Radio buttons can have multiple lines, so dynamically show radio buttons, one for each sentence. A dialog window could be displayed to hold the radio buttons. The result of the dialog would be used to fill the multi-line text field.
Or you could just live with the truncated sentences. Maybe it would help to make the control a little wider, or abbreviate the sentences.

AutoHotKey: How to select listbox item by it's text

Question in subj.
I have window, and I have ListBox on it. I wanna find particular list item and make it selected.
I've read this
http://www.autohotkey.com/board/topic/17534-selecting-an-item-in-a-listbox/
but it doesn't work - my list dont change selection on key pressing.
So, I need to find item by text in some column and then select it (by clicking or smth else).

How to Automatically have Text Cursor in Text Box (as Opposed to Command Button Selected) in Form?

I have two Excel picture objects linked to different forms, each with a text box and OK/Cancel buttons. In one form, the text cursor is in the textbox when clicking the object which is what I want:
but in another it selects the OK command button rather than have the text cursor in the textbox:
I've gone through the form and textbox/command button properties and see nothing about selection, and the 'correct' macro properties appear to be the same as the 'incorrect' one.
What do I do to change the form such that when it's opened the text cursor goes to the textbox instead of the command button being selected?
Quite easy solution is to change TabIndex Property to 0.
So, 1) go to VBA Editor, 2) select your TextBox in your UserForm and 3) change TabIndex Property in Property window as presented below.
Add an event to the form so that when it is initialized it selects the correct texbox.
Private Sub UserForm_Initialize()
TextBox2.SetFocus
End Sub
Before the form is displayed, you can do soemthing like:
TextBox1.SetFocus
Obviously, replace "TextBox1" with whatever the name of your textbox object is.
This should go in whatever event or macro causes the form to .Show, immediately before the .Show statement.

Why is the enter key behaving like the tab key?

I have a "search" layout, which has several object boxes for the user to type in search queries. I have Set Tab Order... which works great. However, rather confusingly, pressing enter/return also has the same effect as pressing tab.
I have looked in the Inspector > Go to next object using and see that both the return and enter are unchecked.
What/where else could be causing this behaviour? Ideally I would like the return/enter key to perform a script/act like a button, is this possible?
Note: I am in Find Mode.
If there's no script trigger, try to double check that the enter/return is really off for the field in question. Maybe there are two or more fields stacked on top of each other (sometimes developers do that) and you checked the wrong one.
I was having the same issue. I checked the fields and there were no hidden scripts, triggers, conditional formatting or anything like that; however, the fields were either a drop-down list or a drop-down calendar so after selecting the criteria, the cursor would go to the next field.
I noticed that if I enter the finding criteria and double click the same field (to avoid going to any other field) and then click the return or enter keys, it works. So stay in the field when you click return or enter and it will perform the find.
Are you positive that you're in find mode when you're doing this? The default behavior in find mode is that the return key executes the find.
If the field you've selected has a dropdown list then CLICKING ON IT ONCE will bring the list down but not place the cursor in the field. Selecting the field a second time will place the cursor in the field. Once the cursor is actually visible in the field you will find that the TAB key works as you expect.
Otherwise, with the dropdown list down and the cursor not in the field, the RETURN key will move to the next field when in Find mode. This default behaviour sort of makes sense to me because the RETURN key can't act on the field until the cursor is actually in the field.
I had the same problem as you and it stumped me for a while too.