Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding button to toolbar at runtime
Message
De
25/04/2009 21:15:27
 
 
À
25/04/2009 10:25:37
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01396361
Message ID:
01396397
Vues:
55
>>Question:
>>Am I doing it the correct way?
>>Any better suggestion?
>
>If your toolbar may show/hide buttons under any set of rules, then show() would show them all, i.e. it may fire whenever the toolbar is hidden then shown. You may either have an visible_assign() method on each button, or have the .visible=.t. at the line after .addobject(), and then later set it to .t. or .f. depending on the situation.
>
>Usually (at least what I do):
>
>
this.addobject(lcObj, lcClass)
>loObj=getpem(this, lcObj)
>with loObj
>   .property...=value
>   .propert...=value
>   * set whatever else you may want
>   .visible=.t.
>endwith
>
>So the object starts as visible, and then later its visibility is set as needed. With your method they all come visible, which may not be what you want. With just two buttons, or if all the buttons are visible all the time, it's not a problem. I've seen frameworks put code in .button.refresh() to decide whether a button will be enabled or not, visible or not. IOW, nothing wrong with your code, it's a matter of where the code goes, a matter of taste.

I normally use designer to create a toolbar with fix set of buttons all ready on it and I have never bother with this button's visible setting. This is the first time I need that to be programmatically done.

Thanks for your clarification.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform