Dan
Wed Mar 23 15:07:39 CST 2005
Invisible buttons were always a kludge.
IIRC, I used to RETURN .F. in their when clauses so they never got focus.
In my mind, an invisible button exists solely to create a clickable area.
Nothing that's "invisible" should ever get focus.
<shrug>
Dan
Ook wrote:
> This is what I ended up doing to get it to work. Invisible buttons
> are a freakin' kluge....especially the way they respond when you set
> focus to them and press enter. Fortunately, this was easy to code
> around.
>
> LPARAMETERS nKeyCode, nShiftAltCtrl
> IF ( nKeyCode = 13 )
> THIS.CLICK()
> NODEFAULT
> IF .NOT. THIS.ENABLED
> THIS.ENABLED = .T.
> THIS.SETFOCUS
> KEYBOARD '{TAB}'
> THIS.ENABLED = .F.
> ENDIF
> ENDIF
>
>
>
> "David Frankenbach" <sendnospam@sendnospam.net> wrote in message
> news:uujwbL2LFHA.656@TK2MSFTNGP14.phx.gbl...
>> Ook,
>>
>> Using a special button subclass for your invisible buttons would
>> seem to solve your problem. Use this as it's KeyPress() method:
>>
>> LPARAMETERS nKeyCode, nShiftAltCtrl
>>
>> if ( nKeyCode = 13 )
>> this.Click()
>> nodefault
>> endif
>>
>> --
>> df - Microsoft MVP FoxPro
http://www.geocities.com/df_foxpro
>>
>>
>> "Ook" <usenet@nospam.zootal.nomorespam.com> wrote in message
>> news:eaGNgmzLFHA.4092@tk2msftngp13.phx.gbl...
>>> Here is a bit of an off-the-wall problem. I have an app converted
>>> from FPW to VFP. In FPW, if you set focus to an invisible button
>>> and press Enter, it
>>> fires the buttons valid code. In VFP, it gets weird:
>>>
>>> Condition one. The form has been run and focus has NOT been set to a
>>> non-invisible button. Set focus to invisible button, press Enter.
>>> Button click method fires, focus goes to next object.
>>>
>>> Contition two. The form has been run and focus HAS been set to a
>>> non-invisible button. Set focus to invisible button, press Enter.
>>> The cliick
>>> method of the Visible button you last set focus to fires -
>>> specifically, focus goes to the last visible button you set focus
>>> to, and fires the click
>>> method of that button.
>>>
>>> So - has anyone had any experience in this area? I would like the
>>> click method of the invisible button to fire when I set focus to it
>>> and press the
>>> Enter key. The docs are pretty sparse about the visible property,
>>> so I'm playing with this to see if there is an easy fix.