Odcl_GetFocus and Hwnd

Started by Paul G, February 05, 2008, 03:02:39 PM

Previous topic - Next topic

Paul G

(release 4.0.1.1)
Don't know if this is a bug or not, but I was not able to make (Setq rValue (Odcl_GetFocus )) work.  I thought it's suppose to return the control with the focus, but mine keeps returning nil, no matter what.

And I noticed there are two "GetHwnd" in the intelibebt help file.  What is "GetHwnd" anyway???

Any help reply would be great.
Thanks,
Paul G.

owenwengerd

Paul, if GetFocus returns nil, then it's probably because an ODCL control does not have the input focus. For example, if you're entering the function at the AutoCAD command line, then AutoCAD has the input focus and this function will always return nil. It is only useful when called from inside an event handler.

The GetHwnd function returns a window handle for the control. I'm not sure what good it does to return this handle to AutoLISP, but I guess someone used it at some point for something. I'm pretty sure the intelligent help's duplicate entries for getHwnd has long since been fixed, but I'll double check.

Paul G

Thanks Owen,

It turns out to be the timing.  Apparently, it wouldn't grab the control because of where it was sitting.  I had it in the "CloseCancel" function, which by then it's too late to know what the focus is on.  I know what I need to do now.  The good news is, it's working.

Thanks for the help.