Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Valid execute
Message
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Title:
Miscellaneous
Thread ID:
00517454
Message ID:
00517517
Views:
20
>i have a help buttom in a form of fpw 26, i want that when user press this buttom a help form appear, problem is that the valid is executed, and i don't know how to make that the valid don't fire when i press a help or cancel buttom.
>How can i solve this ?
>TIA

Favio,

Assuming your valid-code is on the Get-line itself (and not in a function) *and* you have an On Key Label "HelpKey", you must do two things :

1. Let the On Key Label direct to a function/program in which a logical variable (HelpPressed .T./.F.) sets the fact that help was pressed.

2. Provide all your Gets with a Valid IIF(HelpPressed, .F., ValidExpression).
Note that the .F. won't allow the Get to be leaved, and maybe you just need a .T. here. You may also want to replace it with a function-call, in which you can decide what to do.

So the worse part is nr. 2 since all the Gets must be amended.

Another approach would be that the function of nr. 1 will feed the Get with a valid string (or number) so the Valid won't fire. This eliminates the need of nr. 2. Since our app originates from FoxBase where On Key Label didn't exist yet, we trigger the function keys in a very different way. For the Help-key (F3) this comes to :
SET FUNC 3 TO CHR(25)+'M010180'+CHR(51)+CHR(31)+'MF3'
Somehow (don't know anymore, it's from 14 years ago) this leads to *and* the leaving of the Get, *and* the leaving of the Read *and* the Valid not getting fired. Now supposing this works for your app too (I think it must), you just have to deal with the capture of things in a proper way. I mean, somewhere beyond the READ this keypress have to be captured, which we do in a general routine which is called after the Read; if you have such a routine, you must be able to do the same.
Note that the key is getting to you by the 'MF3', but in our app the 'M' is captured by a menu, which always starts with a PROMPT 'Menu'. So, pressing Help (or any function key) when a Menu is active, will trigger "option M" and the 'F3'-part is given to the app. Thus, the MF3 is general for all points in the app.
Note that after the Help is pressed within a Get, it needs some code to (first save) and restore the original contents of the Get. This all can be done not to difficultly, once you can hook-in and hook-out at the proper places (without amending all your programs !).


You may also try to do "something" with a READ VALID ValidFunction, though I don't know whether the Valid on the Get fires first.

Whether the above may lead to a direct solution or not, I think you now have all the options there are, and you are able to find the best solution.

Best wishes,
Previous
Reply
Map
View

Click here to load this message in the networking platform