Popup menuby Michael Kurz
The normal popup menu's from Visual DataFlex do not support bitmaps or cascading menu's. This feature however can spice up your program a bit and make the userinterface more friendly and easier to understand.
The popmenu package that is discussed here supports both of these options (see the screenshot below) and presents to you a programmer's interface that will look very familiar to the default VDF package, making the conversion a bliss.
Supported are transparent bitmaps and it seems to work fine on all major platforms (tested are 9x, NT and 2000)
The packages are build around some WinAPI calls for the menu and loading of the bitmaps. The transparancy works according to a windows standard; the color of the first pixel is the color that will be used as transparant color. One would think that this is the leftmost pixel, but as it turns out this is the bottomleft pixel.
We found out that the following specs for the bitmaps work best in all cases.
Bitmapsize: 13 x 13 pixels
Colordepth: 256 colors (= 8bpp)
The screenresolution of your screen doesn't really matter 800x600 and 1024x768 all use the same size. The size that is used is queried from the Systemparameters API call. This call will only report a different size when you change to large fontsize. In this case windows 2000 Prof reports a size of 17x17 pixels. Windows itself resizes the bitmap automatically, but is having a hard job doing so as the bitmaps are so small.
For more details see the header of the package and the little example program.
The example program is written with a plain texteditor meaning that this example is not IDE compatible. You can compile it using the compiler after selecting the [default] workspace and selecting the source.
The package itself ofcourse works with the IDE, you will just have to drop the popup object code in a Data entry object like a dbGrid, dbForm or dbEdit and include a line "use popupmenu.pkg" in the top of your program.
If a workspace is used the bitmaps should be located in the bitmaps folder. If no workspace is used the same folder as the program will be used by default.
Copyright © 1999 - 2021 VDF-GUIdance on all material published, for details see our Disclaimer.