Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Coolbar and Toolbar - how to use them?
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00357490
Message ID:
00357515
Views:
13
>Hi, George!
>
>>The Coolbar control does not work in VFP. This is documented in the MS KB >article number Q186123.
>
>this is so sad...

It's caused by VFP's non-standard handling of Windows messaging.

>>I've used the toolbar, however, and it does work. The only catch is that >_SCREEN.ActiveForm will refer to the toolbar rather than your form when at the >top of the Z-order.
>
>this is good. I've made some tests with toolbar, but I think it is so "bad-documented". The sample code that ships with MSDN is for VB use... Please, can you send me some example to use it?

The VB code should be fairly simple for you to translate. I will post, however, how I do it.

>I don't understand, for example, how to put a image in my buttons... and there's a lot of doubts that I don't find in documentation.
>
The toolbar can use up to three ImageLists containing the normal images (ImageList property); the "hot images", which appears when the mouse is over the button (HotImageList); and the disabled images (DisabledImageList).

I use a Picture Clip control to hold all of the images. This control allows the use of one bitmap (rather than multiple ones). This speeds loading the form since only one image has to be loaded. It's important to note that the order of instantiation of the control is significant. The Picture must instiate before the ImageLists and the ImageLists must exist before the Toolbar initializes.

The following code is from the Init event of one of my ImageLists, and adds the images to the list:
LOCAL lncols, lni
* The "ToolPics" is the Picture Clip control
lncols = ThisForm.ToolPics.Cols
FOR lni = 0 TO lncols - 1
  This.ListImages.Add(,, ThisForm.ToolPics.GraphicCell(lni))
NEXT
The following code creates the buttons on the toolbar and is in its Init event
LOCAL a_buttons, lni, lnlast, lncount
DIMENSION a_buttons[14]
a_buttons[1] = 'Add'
a_buttons[2] = 'Delete'
a_buttons[3] = 'Recall'
a_buttons[5] = 'Top'
a_buttons[6] = 'Previous'
a_buttons[7] = 'Next'
a_buttons[8] = 'Bottom'
a_buttons[9] = 'Find'
a_buttons[11] = 'Save'
a_buttons[12] = 'Cancel'
a_buttons[14] = 'Exit'
lnlast = ALEN(a_buttons, 1)
This.ImageList = ThisForm.NormalIList.Object
This.HotImageList = ThisForm.HotIList.Object
This.DisabledImageList = ThisForm.DisabledIList.Object
lncount = 0
FOR lni = 1 TO lnlast
  IF NOT EMPTY(a_buttons[lni])
    lncount = lncount + 1
    This.Buttons.Add(, a_buttons[lni], , , lncount)
    oButton = This.Buttons(lni)
    oButton.ToolTipText = a_buttons[lni]
  ELSE
    This.Buttons.Add(, , , 3,)
  ENDIF
NEXT
Note that in the above, uninitialized array elements indicates spacers for the toolbar.
George

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

Click here to load this message in the networking platform