Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't set Default button at run time
Message
De
28/04/1999 13:24:56
 
 
À
28/04/1999 13:06:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00212505
Message ID:
00213067
Vues:
28
John -

I think Paul Frost may have came up with the real problem (see his thread here) where he said that it's the 'intrinsic' VFP gotfocus() event behavior which resets the command button to its default value. I didn't think that applied to me because I missed him saying 'intrinsic' and I knew I didn't have any gofocus() code on my form. But I do set focus to a control on each page in the page activate, so I guess that's going to fire the intrinsic gotfocus event. This would tend to explain what I observed when I was stepping through the code: the property gets set, but 'a reset to the original default occurs in the intrinsic gotfocus behavior for all VFP controls

MS says its been fixed in 6.0 and they offer a workaround which (as they say) is likely to be difficult to implement:( I certainly want to move to VFP 6.0, but didn't necessarily plan on doing it today...guess I better take a look the workaround...growl!

>Hi Sylvia ---
>
>I keep tossing ideas out :-)
>
>****Pageframe.Refresh
>WITH THIS
>   .Page1.cmdButton1.Default=.F.
>   .Page2.cmdButton2.Default=.F.
>   .Page3.cmdButton3.Default=.F.
>ENDWITH
>DO CASE
>   CASE THIS.ActivePage=1
>      THIS.Page1.cmdButton1.Default=.T.
>   CASE THIS.ActivePage=2
>      THIS.Page2.cmdButton2.Default=.T.
>   (etcetera)
>ENDCASE
>
>See? Only one button active at any one time.
>
>
>
>>
>>Nope, I understood you. But perhaps I didn't explain clearly why that won't work for me. I would have to put this.default = .T. in a one button on page 1 and another button on page 2, since the effect I want is for that particular button on the active page to be set as the default (i.e. I have two different buttons on two different pages). But if I do as you suggest, then the first time I click on page 1 and the button refresh is called, that button gets set to true. Then if I click over to page 2, the button refresh sets that button to true. So now I have two buttons on two different pages set as the default button, when only one button per form can be set as the default because nothing ever sets a button to false. That's why I was trying to include code in the Activate/Deactive of each page to toggle each button's default .T. or .F. so that only one button on the form would ever have its default set to .T. at any one time. Does that make sense? (In any event, I still can't
>>get the button on the second page to ever act like it's the default).
>>
>>Sylvia
>>
>>Hi Sylvia.
>>>
>>>I think you misunderstood. I meant have THIS.Default=.T. in the Refresh() of the affected commandbutton.
>>>
>>>>I think confirm was off, but added it anyway...same result. The problem I have with setting default = .t. in the control itself is that I believe only one control on a form can have default set to .t. So by including that code in the refresh itself, you're going to have all the controls set as default, and then the form doesn't know which one is the default. Since I'm using page frames, I only want the Active Page control (e.g. save) on that page to be set to .t.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform