Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to add image to the Toolbar ?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00184681
Message ID:
00185111
Views:
55
>Hi,
> At the moment, i just make the toolbar button HIGHTLIGHTED when mousemove. I still cannot make it to have 3 different image for mousemove, normal and clicked. Do u have any ideas with it using ActiveX toolbar?? Again, how to insert all images into a single file? Using picture clip? Picture clip was used to collect all imagelist ...am i right??

Hi John,

The first thing I did was, using cut and paste, create a bitmap with all the images in it. The images have to be exactly the same size. The first row contains the "hot" images that appear whenever the mouse is above the button. The second row contains the "normal" images (those that are used when the mouse isn't over the button. The third row contains the disable button images for each. Each column of the picture clip contains, therefore, the image of one particular button. I added the picture clip control to the form (actually it's a class) and loaded the bitmap containing all the images. The code below is used to initialize the individual imagelists and finally the toolbar:
* The PictureClip is named "ToolPics"
* The ImageList controls were added after the PictureClip
* and before the Toolbar
* The "hot" imagelist Init
LOCAL lni, lnstart, lnfinish
lnstart = 0 
lnfinish = ThisForm.ToolPics.Cols - 1
FOR lni = lnstart TO lnfinish
  This.ListImages.Add(,,ThisForm.ToolPics.GraphicCell(lni))
NEXT
* The "normal" imagelist Init
LOCAL lni, lnstart, lnfinish
lnstart = ThisForm.ToolPics.Cols
lnfinish = (lnstart * 2) - 1
FOR lni = lnstart TO lnfinish
  This.ListImages.Add(,,ThisForm.ToolPics.GraphicCell(lni))
NEXT
* The "disabled" imagelist Init
LOCAL lni, lnstart, lnfinish
lnstart = ThisForm.ToolPics.Cols * 2
lnfinish = lnstart + ThisForm.ToolPics.Cols - 1
FOR lni = lnstart TO lnfinish
  This.ListImages.Add(,,ThisForm.ToolPics.GraphicCell(lni))
NEXT
* The form's Init
LOCAL a_buttons, lni, obutton, lnlast
lnlast = ThisForm.ToolPics.Cols
DIMENSION a_buttons[lnlast]
a_buttons[1] = "Save"
a_buttons[2] = "Cancel"
a_buttons[3] = "Add"
a_buttons[4] = "Delete"
a_buttons[5] = "Top"
a_buttons[6] = "Previous"
a_buttons[7] = "Next"
a_buttons[8] = "Bottom"
a_buttons[9] = "Seek"
a_buttons[10] = "Exit"
WITH ThisForm
  .CoolBar.ImageList = .NormalIList.Object
  .CoolBar.HotImageList = .HotIList.Object
  .CoolBar.DisabledImageList = .DisabledIList.Object
  FOR lni = 1 TO lnlast
    * This adds the Button's Key and image
    obutton = .Coolbar.Buttons.Add(, a_buttons[lni],,,lni)
    obutton.ToolTipText = a_buttons[lni]
  NEXT
ENDWITH
Does this help?
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform