Software Archive
Read-only legacy content
17060 Discussions

Visual Programming. Adding icons to menus and stuff...

ivomar
Beginner
212 Views
I would like to know if you could guys could explain me how to do the
following things:

1) How do I creat a Tip of The Day Dialog box..I want to know how to do the
layout of those Tip of The Day's Dialog Boxes they do out there..I've
created one on my own but it's not as beautiful as those ones.

2) Can i add icons in menu items using quickwin? In many programs at the
menu file there are the options open (that has an icon of an oppened paste
besides), save (that there is an icon of a floppy disk) etc. How do i add
icons like that in my menus using quickwin? And where i can find those
icons on the net?

3) And how do i create a toolbar with the save, open etc icons on it . This toolbar should stay beneath the menu.

Thank u very much,
Ivomar
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
212 Views
Hi Ivomar,

1) "Tip of the day" dialog shouldn't be too hard to add. Just create your dialog and do DlgModal somewhere at the beginning of the Program. "Tip of the day" is not a common windows dialog (such as "Open", "Choose color") etc. -- you have to design your own.

2) Even in Visual Studio, icons are added to menus using Owner-drawn menus, i.e. there is not even a Win32 API (DFWIN) function which does that. The best you can get is using SetMenuItemBitmaps This mechanism has somewhat limited functionality, due
to color mapping (white color from the bitmap gets mapped
to COLOR_3DFACE, so you can't have white displayed), and colors are
a bit OR-ed with menu color, and in disabled state only
white in the original bitmap is transformed into COLOR_3DLIGHT.
SDK recommends using monochrome bitmaps because of that,
but I tried it with 16-color and with a little care in
design it can look pretty nice. And yes, those should be
bitmaps, not icons.

Here's a snip from an actual Win32 app:

 
USE DFWIN 
 
INTEGER,PARAMETER::  iFuncBmp(0:13) =(/IDB_MENU_1_TOP,   & 
                                       IDB_MENU_1_LF,    & 
                                       IDB_MENU_1_EST,   & 
                                       IDB_MENU_1_VREG,  & 
                                       IDB_MENU_1_KON,   & 
                                       IDB_MENU_1_RES,   & 
                                       IDB_MENU_1_KS,    & 
                                       IDB_MENU_1_POUZD, & 
                                       IDB_MENU_1_LA,    & 
                                       IDB_MENU_1_RZ,    & 
                                       IDB_MENU_1_LOK,   & 
                                       IDB_MENU_1_BPT,   & 
                                       0,                & 
                                       IDB_MENU_1_EXIT/) 
INTEGER::                       hInst 
INCLUDE "Resource.fd" 
 
hSubMenu=GetSubMenu(hMenu,0)  !0=First dropdown menu, 1=2nd etc. 
DO i=0,13 
            hBmp=LoadImage(hInst, MAKEINTRESOURCE(iFuncBmp(i)),  & 
                           IMAGE_BITMAP, 0,0, 0) 
            iSt=SetMenuItemBitmaps(hSubMenu,i,MF_BYPOSITION,hBmp,hBmp) 
END DO 


hMenu is handle of the menu. You can get it using hMenu=GetMenu(hFrame), where hFrame=GetHWNDQQ(QWIN$FRAMEWINDOW). hInst is instance handle; you can obtain it using hInst=GetWindowLong(hFrame, GWL_HINSTANCE). IDB_MENU_... are identifiers of 12x12, 16-colors
bitmaps inserted in the resource file (insert/resource/bitmap). It's from
an Win32 app, but it should work in QuickWin also.

3) There are no toolbar-manipulation functions in QuickWin. I actually managed to add one and it worked, but it would require quite a lot of
Win32 "hacking". Basically, you have to find handle of MDI client window, subclass it, create the toolbar using CreateToolbarEx function somewhere
from QW primary thread, and handle WM_COMMAND messages in the subclassed procedure. Sounds complicated, ha? There was a similar question somewhere in the old forum -- I think I have the thread saved somewhere. Feel free to write me at jdujic@uns.ns.ac.yu so I could send you a sample, if you're still interested.

Jugoslav
0 Kudos
Reply