VB6 Combo box events - events

I have a form in VB6 with two combo boxes (cboCustomer and cboItemNumber). When someone selects a value from cboCustomer, I want to populate cboItemNumber with a list of item numbers relevent to the customer selected. What event does VB6 offer that I can use? I've tried _Change and _LostFocus and neither are doing what I need. I find it hard to believe that I'm having such a difficult time finding a list of possible events.

Try the _Click event. This event fires even if the control is't actually clicked on. For example, if you tab in to it and use the up/down arrow keys to change the selected item, the click event still fires.

As G Mastros says, the _Click event is the one to use, since it fires when the selection is changed via either keyboard or mouse.
If you want to see a list of all the events, then use the Object Browser (F2), and search for or browse to ComboBox. Events are shown with yellow lightning bolts in the Members pane.

Related

Difference between SelectionChange and ValueChange events of Kendo-Combobox

I have just started working on Kendo Controls in Angular. I have found an example here where its making use of both selectionChange and valueChange event. So, my question is what is the difference between these both and when to use them?
Thank you
Imagine focusing the combobox, pressing the down arrow a few times until you find what you want, and hitting enter to choose it. In this example, each press of the down arrow changes the selection, and pressing enter changes the value.

Is it possible to see where control focus is being lost to?

I have a ClistCtrl (wraps Windows list view for non-MFC users) on a dialog. I set functionality that when the list loses focus, any selected items are unselected.
I also have a "remove items" button, whose on-click handler will delete any selected items in the list.
The idea is you select items in the list, and then either click the button to remove these items, or click somewhere else and the selection is cancelled.
But, when you click the delete button, the list loses focus first and therefore nothing happens! Is there a way around this?
You can receive message about lost focus with WM_KILLFOCUS, its wParam will give you a handle to window which got focus:
wParam
A handle to the window that receives the keyboard focus. This
parameter can be NULL.
You should be able to use Spy++ to see WM_KILLFOCUS on you list window, and read its wParam - and later find also with spy++ which window is it.
As said in other posts, you can use WM_KILLFOCUS for that.
But I think it's a very bad idea to clear the selection on losing focus.
Just imagine: the user selects a whole bunch of items using multiselect (using shift, ctrl, scrollbar..), and then, one of the following happens:
The phone rings, urgent call - the user needs to check a mail: selection: gone!
An annoying message box pops up taking focus (yes, it does happen): selection -> gone.
Your users might hate you for this, so don't do it :) (not even if there are only 3 items in the listcontrol).
The usual way is to gray the selection on losing focus. You could add a 'clear selection' button, but even that isn't needed. Just clicking on one item will clear the selection (except for that one item of course).
Bottom line: don't clear the selection on losing focus, ever.
Update:
If the selection is not visible on losing focus, the LVS_SHOWSELALWAYS flag is what you need:
LVS_SHOWSELALWAYS
The selection, if any, is always shown, even if the control does not
have the focus.

show NSUserNotification additionalActions on click

In the image above you can see two notifications on OS X. The first one is from my app and the second is from Apple's Reminders.app. In the image you can see the otherButtonTitle 'Complete' and the actionButtonTitle 'Later'.
The second notification, i.e. the one from Reminders.app behaves quite differently. It gets this little arrow pointing downwards on mouse over indicating that there are more actions when clicked. And indeed, you just need to click once on 'Later' and it will give you a couple more options to choose from.
However, I can't get the same behavior to work for my notification. I don't get the little arrow on mouse over and I don't get more options displayed from a single click on 'Later' (notification just gets dismissed). More options only get displayed when holding down the mouse button on 'Later' which is not obvious.
Am I missing something obvious here? How can I get my notification to have exactly the same as the ones from the Reminders.app?
While trying to find a solution for the same problem I found this nice explanation for the NSUserNotificationPrivate class that explains how the Reminders app does it.
https://github.com/indragiek/NSUserNotificationPrivate
If the notification type is set to "Alert", the alternateActionButtonTitles property lets you set an array of additional menu item titles to be shown in an action menu that can be accessed by hovering on the Action button and clicking on the arrow.
Once a notification is handled, the index of the action can be retrieved using the _alternateActionIndex property.
So they are using a private API. As the site's disclaimer say using any of this will result in your app being rejected from the MAS and potentially breaking if the APIs change.

Is there an event that is fired when HoT puts a cell into edit mode?

I'd like to alter a cell's data, but only when it enters "edit" mode. There are a lot of events I can use, onSelectionByProp seems close but it's firing too often to be useful. Let's say, for instance, that I want to add '*' to a cell that has a value that is invalid in some way, but only when that cell is about to be edited. OK, it's a silly example but it's easier to explain that than what I'm actually doing.
My current approach (haven't done it yet) is to find TD.current when a cell is double-clicked and then alter the text directly. Ideally I'd like to find a "retrieve data" event and alter what's coming back from that.
You can map keyup, keydown, keypress or change event from jQuery for .handsontableInputHolder element in a page. Is a textarea in which user enter data, so this is your 'edit mode' for handsontable.
onEditBegin is a proposed event for future version.
See here for list of events

Windows Menu: MF_HILITE flag does not cleared

I have CMenu instance on which I add multiple items. For one of the items I added in it, I set the MF_HILITE flag.
When I show the menu, the appropriate item get hi-lighted correctly, as requested. The problem is that it stays hi-lighted until I move the mouse over it and leave. I only want one item to be hi-lighted at the time. It seems that Windows does not un-light it when another item is hi-lighed.
How could I force it to be un-lighted as soon as another item get the hi-light? I could not find any mouse-over callback or message for the menu, and I could not find a invalidate either.
You're using MF_HILITE in a weird way. The item isn't actually highlighted, it's just drawn like it is. If the user presss enter, the "highlighted" item won't be selected.
You're probably looking for MF_DEFAULT.
It does not appear to be possible.
The internal state for the currently selected item in the menu can't be set. Using the MF_HILITE or HiliteMenuItem does not set the currently selected item, it only sets the visual style.
As a work-around, I have used a popup ListBox instead, which has all the features I need.

Resources