Getting window handle on active control

NostaNosta Member Posts: 31
Hi all,

I need to get an window handle of currently active control in NAV. For example, when the user opens Item Card form and put the input focus on field "No." I need to get the window handle of field "No." edit box. So far, I analyzed the NAV forms with Spy++ and found that form Item Card has no child controls. I can't believe that NAV draws all forms in run-time as a picture and handle&process all messages with its own engine, instead of using standard windows controls.
Does anyone got stuck with this before?

I need dynamically highlight some fields and prefer using standard windows drawing procedures instead of using Border (and related) properties.


Would be thankful for any ideas.

Answers

  • SavatageSavatage Member Posts: 7,142
    By "Window Handle" are you referring to the field ID or Name?

    What do you want to do? Encompass the field with a red rectangle when a field is activated?
  • NostaNosta Member Posts: 31
    By "window handle" I'm referring to a handle "hWnd" of edit box (check box) control where field is displayed. if you look through Win32API, you see that every control in Windows has its own handle. For example, Find dialog box in Notepad consists of 8 controls (see attach) and each of them has its own handle. But in NAV you cannot access to any of the form controls.

    As a matter of fact, I need to dynamically activate (switch on proper tab if tab control is used) and highlight an active field. I mean a field with input focus (if we are using WinAPI terminology).
    For these purposes I prefer to use GetDC, CreateSolidBrush, Rectangle, etc. standard WinAPI functions instead of playing around Border, Border Color and Border Width form properties (especially when these properties are not available in run-time :D )
  • MBergerMBerger Member Posts: 413
    I can't believe that NAV draws all forms in run-time as a picture and handle&process all messages with its own engine, instead of using standard windows controls.
    It is very well possible that the controls don't have a handle,because some languages have windowless controls ( Delphi and VB6, for instance ), for use in control heavy forms. This has nothing to do with the nav itself, just the programming language used to develop it.
  • NostaNosta Member Posts: 31
    2 MBerger: Obviously, you are right. I've tried a lot of tools to get the handle of field edit box, but was not lucky :( Don't want to believe, but have to
  • jlandeenjlandeen Member Posts: 524
    I've played around with this in the past and I was unable to find a simple and elegant solution to manage tab activiation, but each control on a form has an ACTIVATE function that you can use to control which control is the active control.

    In the past I've built controls that were designed for quick entry so a mouse wasn't used and I found that using the ACTIVATE function in conjunction with defining the tab order (set the Next Control property of each field) that I could accomplish that task.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
Sign In or Register to comment.