- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello All
I was wondering if there was some way to have an event pop up when the focus is placed on a control of a type other than an Edit Box.
In my dialog, I have made it such that as a user tabs (or mouse clicks) through the various edit boxes the colors invert (i.e., white text on a black background) so as to make it real easy for the user to tell where he/she was on the dialog. This was easy enough to do using the DlgSetSub function and the DLG_GAINFOCUS and DLG_LOSEFOCUS indices, in combination with a subclassed callback procedure, as Mr. Jugoslav Dujic and Mr. Anthony Richards were kind enough to help me with. This method also allowed me to incorporate some validation code as well. Of course, the other control types don't support DLG_GAINFOCUS and DLG_LOSEFOCUS.
I would like to do a similar sort of thing for Combo Boxes, Check Boxes, and Buttons, if possible, but at present am at a loss as to how to proceed.
Is something like this even possible? I am hoping that a solution involving the subclassing technique might be possible. Anything more heroic than that may be beyond my skill level and/or project time constraints.
I am using IVF 11.0.066, integrated into VS 2008, on a 32 bit Vista platform. The application type is windowed (not QuickWin). My client has asked for a 100% FORTRAN solution.
Thanks in advance for any help,
Bob Kiser
I was wondering if there was some way to have an event pop up when the focus is placed on a control of a type other than an Edit Box.
In my dialog, I have made it such that as a user tabs (or mouse clicks) through the various edit boxes the colors invert (i.e., white text on a black background) so as to make it real easy for the user to tell where he/she was on the dialog. This was easy enough to do using the DlgSetSub function and the DLG_GAINFOCUS and DLG_LOSEFOCUS indices, in combination with a subclassed callback procedure, as Mr. Jugoslav Dujic and Mr. Anthony Richards were kind enough to help me with. This method also allowed me to incorporate some validation code as well. Of course, the other control types don't support DLG_GAINFOCUS and DLG_LOSEFOCUS.
I would like to do a similar sort of thing for Combo Boxes, Check Boxes, and Buttons, if possible, but at present am at a loss as to how to proceed.
Is something like this even possible? I am hoping that a solution involving the subclassing technique might be possible. Anything more heroic than that may be beyond my skill level and/or project time constraints.
I am using IVF 11.0.066, integrated into VS 2008, on a 32 bit Vista platform. The application type is windowed (not QuickWin). My client has asked for a 100% FORTRAN solution.
Thanks in advance for any help,
Bob Kiser
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can obtain similar behavior by enabling Windows API "hover" messages, which are returned to your message loop via WM_NOTIFY and indicate which subcontrol is being hovered over; this is the point at which you would then change the subcontrol appearances. Here is how to set this up for a ListView control; this routine is called as part of processing of WM_INITDIALOG for the dialog which contains the ListView:
[cpp] ! enable hover-detection for a listview control; hover information
! is returned via LVN_HOTTRACK messages within WM_NOTIFY
SUBROUTINE ListViewHoverEnable (hwnd, controlId)
IMPLICIT NONE
INTEGER, INTENT(IN) :: hwnd
INTEGER, INTENT(IN) :: controlId
INTEGER :: rval
rval = SendControlMessage (hwnd, controlId, &
LVM_SETEXTENDEDLISTVIEWSTYLE, &
LVS_EX_TRACKSELECT, &
LVS_EX_TRACKSELECT)
END SUBROUTINE ListViewHoverEnable[/cpp]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - rkiseral
This was easy enough to do using the DlgSetSub function and the DLG_GAINFOCUS and DLG_LOSEFOCUS indices, in combination with a subclassed callback procedure, as Mr. Jugoslav Dujic and Mr. Anthony Richards were kind enough to help me with. This method also allowed me to incorporate some validation code as well. Of course, the other control types don't support DLG_GAINFOCUS and DLG_LOSEFOCUS.
I would like to do a similar sort of thing for Combo Boxes, Check Boxes, and Buttons, if possible, but at present am at a loss as to how to proceed.
I would like to do a similar sort of thing for Combo Boxes, Check Boxes, and Buttons, if possible, but at present am at a loss as to how to proceed.
Yes, you can do almost anything by subclassing. (Actually, it might have been cleaner if you had redone the entire dialog using Windows API, but now that you here...).
Most controls have xxN_SETFOCUS and xxN_KILLFOCUS notification messages. Those are "subtypes" of WM_COMMAND message. IFLOGM (obviously) implements only EN_SETFOCUS and EN_KILLFOCUS handling, for edit boxes. In your subclassing procedure, you need something along these lines (untested):
[cpp]case (WM_COMMAND) select case(HIWORD(wParam)) case(CBN_SETFOCUS, BN_SETFOCUS, LBN_SETFOCUS) hControl = lParam idControl = LOWORD(wParam) !now do something with hControl or idControl case default ret = CallWindowProc(lpfnOldDlgProc,...) end select [/cpp]

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page