The issue is solved
The issue is fixed, by using Win32.GetFocus() function and moving the logic to an nvo.
I was not able to get the handle of a specific control in the datawindow but only the current focus ...Which worked fine after I moved the logic to an nvo instead of having the logic in the new dropdown replacement window which already had the focus, so getfocus() was returning the handle of the control with focus on the new window instead of the handle of the caller/parent ....
FUNCTION ULONG GetFocus() Library "user32.dll"
FUNCTION BOOLEAN GetWindowRect( ulong hWnd, REF st_rectangle lpRect ) Library "user32.dll"
global type st_refdddw from structure
unsignedlong dweditcontrolhandle descriptor "comment" = "Windows handle to the floating datawindow edit control"
st_rectangle dweditcontrolrectangle descriptor "comment" = "Rectangle of the floating datawindow edit control in pixels"
end type
// Get information (handle and rectangle) about the floating edit control
st_refdddw lst_struc
lst_struc.DwEditControlHandle = GetFocus()
GetWindowRect(lst_struc.DwEditControlHandle, lst_struc.DwEditControlRectangle)
// Open Location selection window
OpenWithparm(w_picklist, lst_struc)