Disable dynamic searching when typing in a listbox - vb6

In VB6, if a listbox containing alphanumeric data has focus and a character key is pressed, the first element in the listbox starting with that character is highlighted. If multiple characters are pressed, the first element starting with each character is selected after each character press. Typing M-A-R-T will select the first M-word, then the first A-word, etc.
What I want to do is write an algorithm that dynamically searches the listbox using a multiple character string. So typing M-A-R-T will highlight the first element beginning with M-A-R-T. The "Sorted" property already does this, but my listboxes are in a wrapper that uses a custom sorting method that gets broken if Sorted is turned on.
I've written all the code to search the listbox and it works correctly, except that the default search behavior is still happening. When I press M, the first M word is highlighted. Then I press A, and the first A word is highlighted. When I release A, the first M-A word is highlighted. Then I press R, and the first R word is highlighted. Then I release R and the first M-A-R word is highlighted. So the behavior is what I want, except there is an extra search being done somewhere between the Keydown and Keyup events.
Is there a way to disable or mask the default listbox searching behavior? Or a way to lock the scrollbar so the system can't scroll it?

Try adding this:
Private Sub List1_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub

The automatic scrolling was happening sometime after the KeyDown event. If a form element is disabled, it won't register any key events. So I added these 3 lines after my own filter:
mobjListBox.Enabled = False
mobjListBox.Enabled = True
mobjListBox.SetFocus
I guess when a key is first pressed, VB6 figures out all of the key events it is going to call ahead of time. If the control is disabled, VB refactors the list of key events to call. So by disabling the control I force VB to remove the other Key events (like Scroll) from the workflow. Then I enable the control again and give it back the focus.
Tadaa!

Related

Sublime Text: disable refresh/replacement in 'Replace' function?

using the "Replace..." [Find menu] function a slide-in at the bottom appears with an option field/entry for "Find:" and below that one, one for "Replace:"
having completed a replace [eg "Find: abc", "Replace: xyz"] for instance by employing "Replace All" the very slide-in disappears
now for another, new, search, for instance within a document having selected a different, let's say word like "oha", that selection 'oha' is auto-copied over as new entry in "Find:" when using "Replace..." again. this is to say that now in "Find:" the entry does read "oha" tho didn't paste it manually in -- the "abc" entry fromthe previous search got replaced
however, the last entry in the "Replace:"-entry-field remains unchanged
it's the "Find:" entry that get's auto filled in w/out the option [as far as i could figure out]
and that exactly is my question about :
any option to modify Sublime's settings such that nothing gets changed/auto-copied/filled-in at "Find:" ?
pretty annoying behaviour, as i experience it, for instance when having to replace just a single character combi within similar text and each time the copy-selected text get's auto-copied/filled-in at "Find:" rather than leave it be till the usr opts to modify that entry from previous replace-calls
The Find and Find and Replace widgets automatically populate the Find box with either the current selection if there is one, or the previous value used in that box. This box is a dropdown, which contains the previous values used, so you can easily go back through your history in that window and not have to re-type a complicated regular expression, for example.
When the Find box opens pre-populated with a value, it is automatically selected, so to get rid of it all you have to do is hit Backspace or Delete. Alternatively, you can just begin typing your new search query, and it will erase the old one.
There is a setting in Sublime Text 4 that modifies this behavior:
// If true, the selected text will be copied into the find panel when it's
// shown.
// On Mac, this value is overridden in the platform specific settings.
"find_selected_text": true,
If you set "find_selected_text": false, in your user settings, you can disable this behavior.

Automatically leave field after value is entered

I am creating a form in Visual FoxPro where the user will be entering a large number of values that are only one character values. So that the user does not have to press tab after every key press, I would like to setup the form so that once the value is entered the cursor automatically goes to the next field.
What is a good way to do this?
Make sure you have SET CONFIRM OFF
From the help file:
SET CONFIRM ON | OFF
...
OFF Specifies that the user can exit a text box by typing past the
last character in the text box. The insertion point, when it reaches
the last character in a text box, moves to the next control, and the
bell is sounded (if SET BELL is set to ON).
OFF is the default value of SET CONFIRM.
SET CONFIRM OFF also affects menu items and menu titles. If SET
CONFIRM is set to OFF, the user can choose an item from a menu or a
menu title in a menu bar by pressing the key corresponding to the
first letter of the menu item or title. (When SET CONFIRM is set to
ON, this action only selects the menu item or title.)
I made a simple form with two text boxes and verified that after typing one character, it jumps to the next text box.
Herb's answer is correct, but keep in mind that the cursor will jump to the next field in the TAB Order.
So if you entered your Textbox fields in some other order you might need to re-order the TAB's.
To verify that you have your TAB Order as you need, with the Form open in the VFP Development environment, from the Menu, click View - Tab Order - Assign Interactively. Then using your mouse, you can re-order the TAB settings for your Textboxes.
Also note that the TAB Order also includes the other Form objects such as Buttons, Grids, etc.
Good Luck

NSLeftTextMovement and NSRightTextMovement

On what action do the NSTextEndEditing notifications contain NSLeftTextMovement & NSRightTextMovement? I was trying to catch left/right/up/down key press inside a text field, but the NSTextMovement key value is always either Tab/BackTab or Return.
This will not work to catch arrow key presses in a text field.
The NSTextDidEndEditingNotification is only sent when focus leaves the field editor. So, NSLeftTextMovement would only be used if/when a press of the left arrow press actually caused focus to leave the field. That's not something that normally happens. I don't know if it might happen when using a matrix of text fields or an NSForm. One could arrange to use a custom field editor and have that end editing on an arrow key press, too, I suppose.

Informatica PowerCenter: does anyone know a way of using the keyboard instead of mouse pointer in Edit Tasks in Workflow Designer?

In Informatica PowerCenter I'm looking for ways to make less use of the mouse, and more of the keyboard keys.
In the Workflow Designer, when editting a task, I'd like to 'jump' from value of connection to the other value of connection, and change the connection type, with only using the keyboard, and not by using the mouse pointer. Now I have to click on the downarrow of the first connection, and then use the mouse to go to the second downarrow, etc. I can't imagine it is not possible, but so far I tried without succes.
Jumping from connection to connection IS possible though, with using the down and up keys. But opening up the value I have not yet discovered.
I tried Enter (which closed the edit task window), space (does nothing), tab (does nothing), F2 (does nothing).
Does anyone have an idea?
For further explanation see my printscreen: http://prntscr.com/9euxd6. The downarrow I talk about are circled. So, I want to jump from connection 1 to 2 and alter the value by not clicking on the downarrow, but by using the keyboard only. Does anyone have an idea?
The below is copied from the Informatica PowerCenter - 9.5.1 - Designer Guide PDF.
Using Shortcut Keys
When editing a repository object, use shortcuts on the Ports or Columns tab.
The following table lists the Designer shortcuts:
Add a new field or port. Alt+F
Cancel editing in a cell. Esc
Select or clear a port type check box. Space bar
Copy a row. Alt+O
Copy text in a cell. Ctrl+C
Cut a row. Alt+C
To edit the text of a cell, press F2, then move the cursor to the location inside the cell.
To find all combination and list boxes, type the first letter on the list.
Find tables or fields in the workspace. Ctrl+F
Move current row down. Alt+W
Move current row up. Alt+U
To open the Expression Editor from the expression field. Press F2, then press F3
Paste a row. Alt+P
Paste copied text into a cell. Ctrl+V
Select the text of a cell. F2
Validate the default value in a transformation. Alt+V

WP7 TextBox automatically add dot

I have a very simple Windows Phone app with one TextBox. When I type some text, then press Space 2 times, WP7 automatically add a dot.
I dont want the dot. How to handle this ?
Adding a dot when pressing "space" two times is a feature from the WP7 keyboard. The user can disable it from the phone settings.
Since it's a global setting, you can't change it. The best you can do it to forbid the user to type dots altogether (when pressing space two times AND when pressing the dot key). If you want to do that, just subscribe to the TextChanged event of your TextBox, and remove the dots.

Resources