Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't set Default button at run time
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00212505
Message ID:
00213071
Vues:
30
>>I seem to have the opposite problem of several I've seen relating to the default button: namely, I intentionally begin with default set to .F. for all my buttons, but then when then in the Activate of a page on my page frame, want to set the save button .T. so that Enter works in typical Windows behavior (I want to be able to set the default to one button on page 1 and a different when I click on page 2). Problem is, I can't get it to work, i.e. I set the button's default property to .T., then checked the value which shows as .T., but it doesn't 'work as coded'. I've tried refreshing the page the button is on, and the form, to no avail.

* Sorry about the extra message, my fingers slipped *

Hi Sylvia,
I built a demo form with a pageframe that sets the Default property of the cmdSave control on the active page to .T. (all others .F.) when the Activate event occurs. It works correctly.
Basically, I created a three page pageframe. On each page I placed one textbox txtDummy and one command button cmdSave. I set the tab order to be txtDummy, cmdSave. Next in each page's Activate I added the code:
This.Parent.ActivatePage(This)
I added the method ActivatePage to the parent pageframe class:

LPARMETERS poPage
WITH This
.Page1.cmdSave.Default = .F.
.Page2.cmdSave.Default = .F.
.Page3.cmdSave.Default = .F.
ENDWITH
poPage.Default = .T.

The Click method of each cmdSave button has: MESSAGEBOX("Save")

It is a bit clumsy, but should be a good starting point.
If you would like, give me an email address and I will send you the code.

HTH,
Ned
Ned

Reality is.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform