Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't set Default button at run time
Message
 
 
À
28/04/1999 15:43:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00212505
Message ID:
00213199
Vues:
35
>>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.cmdSave.Default = .T.
>
>Hi Edwin -
>
>I'm a little confused. I don't understand why you'd need to put the code you indicated in the page activate, since clicking on a page should make it the active page anyway (i.e. set the pageframe active page to the current page).

I use the call to ActivatePage to respond to a new page being activated. The activation of the page is indeed handled by VFP. Perhaps I should have called the method OnPageActivate.

The code in the pageframe responds to a new page becomming active by setting all cmdSave button's Default properties to .F. except that of the newly activated page.

Unfortunately you must not have read my second post. I accidentally sent the first post before I had finished the message, fumblefingers *g*. I have inserted the code for the ActivatePage method (should probably be called OnActivatePage) at the top of this message.

>But it is interesting you didn't get the bug that Paul Frost mentioned (the >one acknowledged by MS). On the other hand, I have a lot of controls (text >boxes, combos, etc. on each of my pages, so maybe the complexity...?)

I believe that the MS bug report that Paul Frost mentioned had to do with GetFocus, which I do not call in my code.

Anyway, you should have enough info to duplicate my approach, if not I can send you the test class that I worked up.

HTH,
Ned
Ned

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

Click here to load this message in the networking platform