Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to add image to the Toolbar ?
Message
 
À
07/02/1999 10:46:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00184681
Message ID:
00184888
Vues:
37
>George,
> Can you show me how to add the buttons and image programmatically?
>Since i try it in VB, it can be use the dialog properties to add the buttons and image.
>Thanks.
>
>regard,
Hi chang,

The basic syntax for adding the buttons is:

ToolbarObject.Buttons.Add(Index, Key, Style, Caption, Image)

While all items are optional, you should add a Key and use that to determine which button has been clicked. Unlike the VFP Toolbar (in which each button has its own click event, only one click event is associated with the MS Toolbar.

Index is a numeric value telling where the button is in the list. If omitted, the button is added on to the end.

Key is a unique character string associated with the particular button. The button click event receives the button and you determine which button was clicked by referencing the Button.Key property.

Style is is a numeric value indicating the style of the button. See the Windows Control help file for the various values. If not passed, the default is a normal clickable button. You can also specify a buttongroup, placeholder, and so on.

Caption is a string indicating the caption to appear (if applicable) on the button.

Image is a numeric value corresponding to one of the images in the image list.

What I do is DIMENSION an array holding the keys and/or captions. The image list(s) are loaded in the order that the buttons are to be created. All I have to do then is:
* a_buttons is the array containing the keys
lnlast = ALEN(a_buttons, 1)
FOR lni = 1 TO lnlast
  ThisForm.MyToolbar.Buttons.Add(, a_buttons(lni),, lni)
NEXT
The above will create the buttons and indicate the images.

hth,
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform