Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Microsoft Toolbar & Imagelist Problem
Message
 
To
02/07/1999 00:21:14
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00236802
Message ID:
00236932
Views:
11
>I am trying to use the Toolbar and the Imagelist ActiveX controls in a form. I have read everyone's advice concerning the programming involved for VFP.
>
>My form works well when it is executed within VFP. However, the form does not work when I compile it into an .APP or an .EXE. When I execute it, I get an OLE error (#1426 - OLE error code 0x800a01e1: Unknown COM status code). The error occurs at the .Add method of ListImages.
>
>The following code is in the form's INIT method...
>
>WITH THISFORM
> .Imagelist.ListImages.Add(,"New", loadpicture("new.bmp"))
> .Imagelist.ListImages.Add(,"Open", loadpicture("open.bmp"))
>ENDWITH
>
>This.Coolbar.Imagelist = This.Imagelist
>
>WITH THISFORM.Coolbar
> .Buttons.Add(,"New","New",1,"New")
> .Buttons.Add(,"space",,3,)
> .Buttons.Add(,"Open","Open",1,"Open")
>ENDWITH
>
>The main program file code that starts the app is...
>
>DO FORM coolform
>READ EVENTS
>
>Is this a bug (or new one)? Your help is greatly appreciated.
>
>Leo St-Jacques
>
>(and happy Canada Day and Independence Day to all fellow VFP Canadians and Americans)

Hi Leo,

In addition to what BOb has told you, let me suggest a workaround that may prove very beneficial.

One problem you might run into using the ImageList and Toolbar ActiveX controls is that you may find that your forms take long to load. Consider the following: If you have defined Hot, Cool and Disabled ImageLists for your toolbar and you have ten buttons on it, you have to call LoadPicture 30 times to populate the ImageLists. Each call to LoadPicture requires that each of the individual bitmaps be evaluated. Each bitmap contains information regarding itself so that it can be properly displayed. So you got all that overhead, and this doesn't include the file i/o that occurs or the space that the bitmaps take on the drive.

One of the least mentioned or used (IMHO) but useful, in these situations, ActiveX controls is the Picture Clip control. What it allows you to do is specify a single bitmap, containing all the images required. This means that instead of having 30 (as mentioned in my example) bitmaps, there's only the additional control and one bitmap. Further, the bitmap doesn't have to be supplied separately in an application.

FWIW, the biggest drawback to using the control is creating the bitmap. Since each must be exactly the same size, and precisely located within the larger bitmap. This is because the Picture Clip allows you to specify the number of rows and columns in the bitmap and, via its GraphicCell collection, allows the bitmaps to be retrieved via a single sub-script (GraphicCell(1), for example).

The second biggest drawback is adding additional bitmaps to the one containing all the references. However, inspite of this, I still feel that the additional effort is far outweighed by its benefits.
George

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

Click here to load this message in the networking platform