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.

Re: Invisible button issue by Fred

Fred
Tue Mar 22 17:56:41 CST 2005

Why are trying to go a roundabout way of doing things? Just put the code
that's in your invisible button's Click method into a form method and call
it directly. No need for all that chicanery.

--
Fred
Microsoft Visual FoxPro MVP


"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.
>
>



Re: Invisible button issue by Ook

Ook
Tue Mar 22 18:21:33 CST 2005


"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:O9QeKrzLFHA.1884@TK2MSFTNGP15.phx.gbl...
> Why are trying to go a roundabout way of doing things? Just put the code
> that's in your invisible button's Click method into a form method and call
> it directly. No need for all that chicanery.
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "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.
> >
> >
>
>



Re: Invisible button issue by Ook

Ook
Tue Mar 22 18:29:33 CST 2005

This is something that they have done for 10 years. It worked great with
FPW, but we have converted it to VFP and are still finding weird differences
like this with respect to how FPW and VFP works. You take a textbox and a
label or image or whatever you want in whatever colors and fonts you want
and put them under the invisible button and put a border around it. The user
thinks it's a button with all this cool stuff on it. There are dozens of
these throughout the system.

Yes, I can replace this with a visible button in VFP8, and put the
appropriate image and text on the button, but this is more work then we want
to invest into the system at this point. It would be very nice indeed if I
could get the invisible button to function the same way as a visible button.
You can set focus to both, but pressing the ENTER key when focus is set to
an invisible button does not give consistent results.

"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:O9QeKrzLFHA.1884@TK2MSFTNGP15.phx.gbl...
> Why are trying to go a roundabout way of doing things? Just put the code
> that's in your invisible button's Click method into a form method and call
> it directly. No need for all that chicanery.
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "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.
> >
> >
>
>




Re: Invisible button issue by Dan

Dan
Tue Mar 22 18:36:11 CST 2005

Probably just a bug in the way converted "objects" work.

Remember that when you convert from 2.x to VFP you end up with a form with a
WindowType that YOU CAN'T CREATE FROM SCRATCH. IOW, it's non-standard and a
lot of things behave in non-standard ways. (That's why I said "objects"
instead of objects.)

This is one reason a lot of us refuse to deal with conversions. <g>

Can you create a "naked" form in FPW that has only one standard button and
one invisible button, convert it, and reproduce the problem? If you can
repro a problem in the converter, you MIGHT get Microsoft's attention.

Dan



Ook wrote:
> 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.



Re: Invisible button issue by Ook

Ook
Tue Mar 22 19:16:11 CST 2005

I can duplicate this in a "naked" form. This has nothing to do with any
conversion process. AFAICT, this is just the way VFP works versus the way
FPW worked. I have not tried it in earlier versions of VFP, so far I've only
tested it with VFP8.

We actually have several pages of documentation describing the way FPW
worked versus the way VFP worked. I was surprised at how many functional
changes Microsoft made when making VFP, but when you have thousands of users
used to FPW, and you roll out a VFP app, you find out real quick about all
the little things that have changed :-P


"Dan Freeman" <spam@microsoft.com> wrote in message
news:u0NJSB0LFHA.656@TK2MSFTNGP14.phx.gbl...
> Probably just a bug in the way converted "objects" work.
>
> Remember that when you convert from 2.x to VFP you end up with a form with
a
> WindowType that YOU CAN'T CREATE FROM SCRATCH. IOW, it's non-standard and
a
> lot of things behave in non-standard ways. (That's why I said "objects"
> instead of objects.)
>
> This is one reason a lot of us refuse to deal with conversions. <g>
>
> Can you create a "naked" form in FPW that has only one standard button and
> one invisible button, convert it, and reproduce the problem? If you can
> repro a problem in the converter, you MIGHT get Microsoft's attention.
>
> Dan
>
>
>
> Ook wrote:
> > 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.
>
>



Re: Invisible button issue by David

David
Tue Mar 22 22:43:26 CST 2005

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.
>
>



Re: Invisible button issue by Ook

Ook
Wed Mar 23 10:15:28 CST 2005

You know, I think that might do it. I haven't had much time to find a fix,
but I think you have saved me from the time I would have spent reinventing
the wheel. Krispy Kremes are on me today :-)


"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.
> >
> >
>
>



Re: Invisible button issue by Ook

Ook
Wed Mar 23 14:57:02 CST 2005

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.
> >
> >
>
>



Re: Invisible button issue by Dan

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.



Re: Invisible button issue by David

David
Wed Mar 23 19:48:15 CST 2005

Ook,

Well when I went looking into the issue in the VFP event tracking I saw the
oddities in behavior and it looked obvious that some code in he KeyPress
might be able to get the behavior you wanted.

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro

"Ook" <usenet@nospam.zootal.nomorespam.com> wrote in message
news:%23yxgdr%23LFHA.1396@TK2MSFTNGP10.phx.gbl...
> 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



Re: Invisible button issue by Fernando

Fernando
Thu Mar 24 16:26:40 CST 2005

Hi Dan:

> In my mind, an invisible button exists solely to create a clickable area.
> Nothing that's "invisible" should ever get focus.
>
I have "special" controls that merge line objects, shape objects, custom
objects, image objects and an invisible button to get the focus. In this
case I *want* that the invisible button takes the focus, because this is the
only control of them that can do that, and that lets the user the choice to
click or to hit Enter on the control to make it work.

In other of my special controls, I use the invisible button (a collection
of) to navigate a VFP TreeView (no OCX) using the navigation keys (up, down,
left, right, pgup, pgdn, home, end). In this case, the invisible button that
take the focus fires a user event and highlight the selected item.

If I need a invisible button-like that never gets a focus and is just for
clicking, there are many controls to choose from: custom, shape, picture.
All of this have a click event and can be invisible to the user.


Regards,

Fernando D. Bozzo
VFP6/SP5
Madrid/Spain