TComboBox.AutoCloseUp Property: What does it do? - delphi

From the documentations:
Specifies whether the drop-down closes up automatically when the user
selects an item.
I have played with this property (combined with AutoComplete and AutoDropDown) and I just can't seem to figure out the UI behavior of this property.
Setting it to True or False I can't see any difference in how it behaves.
Can anyone explain to me what it does exactly?

You will see the difference if you have AutoCloseUp = True and also AutoDropDown = True. For example, if you have items '0', '1' and '2' and the ComoBox has focus, when you use the keyboard and press 2 the dropdown list flashes briefly and is closed again with item '2' selected. If you change AutoCloseUp = False, then the dropdownlist remains open (and you can change your selection with the arrow keys) until you indicate your selection with Enter
If you operate the combo only with your mouse, then there's no difference.
Addition after comments
If you add to my example items '22' and 'more' and you also have AutoComplete = True (which it is by default) you will note the following:
item '22' is not selectable with two consecutive hits on 2. It is of course still selectable with the arrow keys, like all other items.
The AutoCloseUp feature closes the dropdown when AutoComplete finds a matching item for all sofar typed keys. If you type m, o, r the list is still open, 'more' selected and the list is finally closed if you type the missing e.

Related

How do I check/uncheck items in a ListBox with pywinauto?

I am trying to automate the Cambium LINKPlanner application using pywinauto, and found controls for almost everything I needed. However, there is a checked list box which has the identifier 'ListBox' and there doesn't seem to be any way to check/uncheck the items in the list.
I can list the contents of the ListBox:
>>> app.LINKPlanner.ListBox.item_texts()
['PMP 450b High Gain', 'PMP 450b Mid-gain', 'PMP450 (retired)', 'PMP450d (retired)', 'PMP450i', 'PMP450i ATEX/HAZLOC']
I can highlight an item in the ListBox either by name or position:
>>> app.LINKPlanner.ListBox.select('PMP450i')
<win32_control.ListBoxWrapper - '', ListBox, 70154>
>>> app.LINKPlanner.ListBox.select(2)
<win32_control.ListBoxWrapper - '', ListBox, 70154>
But I can't check/uncheck the checkbox inside the list items.
Any suggestions?
EDIT:
Using Vasily's suggestion, I was able to see the bounding box, then use click_input to click the checkbox.
>>> app.LINKPlanner.ListBox.select('PMP 450b High Gain').item_rect(0)
<RECT L0, T0, R276, B17>
>>> app.LINKPlanner.ListBox.select('PMP 450b High Gain').click_input(coords=(9,9))
If it's detected as ListBox, it may be owner-drawn check boxes which can't be detected separately. I'd suggest using method .item_rect(item_name) and then method .click_input(). Also method .client_to_screen() may be helpful.
I'm using .select("item text") and .send_keys("{SPACE}").
I tried Vasily's answer to use item_rect(). That works but it has some drawbacks.
In my case item_rect was not reliable: it was always 2 to 4 pixels taller than in reality. This error adds up for consecutive items. My script ended up clicking the wrong checkboxes.
Also, if the list is too long it requires scrolling. This requires a separate workaround.
I found my ListBox would toggle the checkbox at the press of the space bar.
So I'm doing this instead:
# De-select all (there is a button to do this).
dialog.window(title="Deselect all").click()
# Select the desired items.
for item in ["Item 1 name", "Item 5 name"]:
dialog.ListBox.select(item)
dialog.ListBox.type_keys("{SPACE}")

Checked Toggle between TMenuItems in group

I have three menu items I would like to toggle between one another with a check.
The first one is default checked = true and the other two are false
I would like to have the check mark show next to the one clicked
I tried setting the group index of the three different from the rest of all the other menu items, but that didn't seem to work. All three menu items have autocheck = true
do I have to manually handle all this by code?
thanx
You need to do the following for each of the three menu items:
Set AutoCheck to True.
Set RadioItem to True.
Set the GroupIndex for all three items to the same value.
This will result in a bullet rather than a tick being placed next to your menu item. That's by design. These menu items operate like radio buttons (hence the bullet) rather than check boxes (which would have ticks).

Excel 2010, how to keyboard shortcut to filter dropdown checkboxes?

For Excel 2010, when I have the filter drop-down open
...how do I get to the filter checkbox section via keyboard shortcut? Skipping everything from "Sort A to Z" to the "Search" box, going all the way to the checkboxes.
Quickest Option: e ↓
In Excel 2010 (English) you just have to press e to get to the filter textbox; from there you can use the down arrow key ↓ to go to the first checkbox:
Alternative Option
Shift+Tab
Shift+Tab
Shift+Tab
(as mentioned by #Sean_Cheshire) - this goes "backwards" from the first entry over "Cancel" and "OK" to the first (sic!) checkbox.
Related Question: How to open the filter drop-down
The question above is about how to move inside the filter drop-down. To open the filter drop-down, you have one or two options:
For any filter: As #Juhi and #Josh have pointed out, you can open said menu with the keyboard when the column heading cell (where you would click to open the drop-down) is selected by typing Alt+ ↓ .
For tables: If you are using a Table object instead of a pivot table or regular filtered range, you can be in any row of the Table and open the filter drop-down using Alt+Shift+ ↓
ALT+DOWN arrow key opens the selection box. Use the arrow keys to select an option and SPACEBAR to "check" or "uncheck."
Try ALT+down. It opens the drop down list in filters and cells as well.

SmartGWT ComboBoxItem - item in Combo is not marked in the pick list

I'm using ComboBoxItem(com.smartgwt.client.widgets.form.fields.ComboBoxItem). My question is how to force it to mark, hilight selected value in a pick list?
It is demonstrated in the SmartGWT showcase, Combo with a Label "A simple ComboBoxItem" http://www.smartclient.com/smartgwt/showcase/#styled_combobox_category.
'Mouse' item is in the combo, however in the pick list 'Cat' item is selected - not as I would expect - a 'Mouse'.
Thanks in advance,
emph
You can't. ComboBoxItem's PickList object (the drop down list), always moves its cursor (the selection marker) at the top of the list, or the first element that will be selected based on the user's input. If you want the cursor to show the selected value, use the SelectedItem instead, in the same way you use the ComboBoxItem. One drawback with this, is the fact that you can't type and have the auto-complete effect. However, if you type after you open the PickList for the SelectItem, the cursor will move to a matching option.

How do I move multiple nodes at once in a TJvTreeView?

When you select multiple nodes of a JvTreeView, and then try to drag these nodes, the JvTreeView selects the node you clicked to drag, rather than initiating dragging all the selected nodes. You end up dragging only this single node.
Is it possible to drag multiple nodes in a JvTreeView? I am using Delphi 2007.
UPDATE: Oddly enough, if I hold down CTRL+SHIFT when dragging the items, I can successfully drag them all. Any ideas?
Suppose MultiSelectStyle is the default [msControlSelect], then the answer to your question is 'you don't release the control key when you're selecting the last item and beginning dragging'.
The culprit is in TJvTreeView.WMLButtonDown in JvComCtrls.pas. Code there tests if 'Ctrl' is pressed when the TreeView is MultiSelect, and clears all items and selects the clicked item if 'Ctrl' is not pressed. It should instead test if the clicked item is already selected and do nothing if it is.
You can see the broken behavior without dragging. Multi select a few items and then click a selected item with the mouse. The VCL TreeView do not select or de-select anything, while the JVTreeView, instead, de-selects all items and selects the clicked one.
Yes absolutely, I do it all the time.
Of course Multi-Select needs to be True and you may need to have a look at the TTreeView's MultiSelectStyle. That controls what type of nodes can be selected at the same time. For example if msSiblingOnly is set to true, you can only select sibblings.
Are you using dmAutomatic or dmManual. If the latter, it could be that you are doing something in the OnMouse* events that is negating the multi-selection you made earlier.

Resources