I would recurse down the object tree from FORM, looking for commandbuttons as the base object, and check whether Default = .T. Alternatively, checking each object for whether it has a Default property and checking whether it is .T.
Or am I missing something?
Hank
>Hi Folks,
>
>I look for an idea to figure out what object on a form is the default one, i.e. the one that has the DEFAULT property true
>
>Background:
>
>I have a rather tricky grid that recieves the Enter key and performs stuff. Sometimes just some internal blabla, sometimes it performs an action directly bound to the key.
>
>I think I can tetermine what of the above, but the problem is how to rise the default objects default action (Click) / or not. For the moment it's simply doing nothing with the default object
>
>the code in the grid's textbox looks
>
> DO CASE
> CASE tnKeyCode = 13
>*<Enter>
> NODEFAULT
> CASE INLIST(tnKeyCode,5,24) AND tnShiftAltCtrl=0
>*<Up>,<Down>
> .SETFOCUS()
> CASE tnKeyCode = 27
>*<ESC>
> NODEFAULT
>...
>
>
>If I compare with
ESC I see no difference (even in the keypress stuff around objects keypress , since form is KeyPreview = .T.), this is checkes with SET COVERAGE.
>
>Both keys just differ in the way they run throug this case.
>
>After the keypress is ended, ESC raises the events that will end up with the Click of Cancel- object Enter just does nothing.
>
>Well, I can not figure that out. O.K. But then, how do I raise default objects Click?
>
>TIA
>
>Lutz