1. Bitmaps on MenuItems

Hello all,

I thought I would leave this one alone for awhile
to give my noodle a rest but when I came back to it, Im still
in wonder.

Here is a small fragment of code that should place bitmaps
on menuitems but it doesnt.

LoadImage is not included in this snippet because it is tested elsewhere
to be fine code.

<snip/>

hpopup = c_func(xCreatePopupMenu,{})

mnuclass = allocate(SIZEOF_MENUITEMINFO)

     poke4(mnuclass + mifSize, SIZEOF_MENUITEMINFO)
     poke4(mnuclass + mifMask, or_all({MIIM_TYPE,MIIM_ID,MIIM_BITMAP}))
     poke4(mnuclass + mifType, MF_STRING)
     poke4(mnuclass + mifState, 0)
     poke4(mnuclass + miwID, IDM_LONGFORM)

     poke4(mnuclass + mihsubmenu, NULL)
     poke4(mnuclass + mihbmpChecked, NULL)
     poke4(mnuclass + mihbmpUnchecked, NULL)

     mnustr = alloc_string("&Format\tF7")
     poke4(mnuclass + midwTypeData, mnustr)
     poke4(mnuclass + mihbmpItem, LoadImage("format.bmp", IMAGE_BITMAP))

     junk = c_func(xInsertMenuItem,{hpopup, 0, 1, mnuclass})

</snip>

According to MS-SDK InsertMenuItem will work in this case instead of
useing SetMenuItemInfo because I am initially setting the menu up.

Has anyone tried to do something similar that might be able to
shed light on my little problem?

I had a suspicion about * or_all({MIIM_TYPE,MIIM_ID,MIIM_BITMAP})
and mixing these types so, I did try to set MIIM_BITMAP alone and it didnt
change a thing.

With this code the text will disappears from the menuitem
or, the item completely disappears.

If you need more to go on (I think I covered most of it),
let me know and I can send this to you.

Euman
euman at bellsouth.net

new topic     » topic index » view message » categorize

2. Re: Bitmaps on MenuItems

> Prior message first
 
> Hello all,
> 
> I thought I would leave this one alone for awhile
> to give my noodle a rest but when I came back to it, Im still
> in wonder.
> 
> Here is a small fragment of code that should place bitmaps
> on menuitems but it doesnt.
> 
> LoadImage is not included in this snippet because it is tested elsewhere
> to be fine code.
> 
> <snip/>
> 
> hpopup = c_func(xCreatePopupMenu,{})
> 
> mnuclass = allocate(SIZEOF_MENUITEMINFO)
> 
>      poke4(mnuclass + mifSize, SIZEOF_MENUITEMINFO)
>      poke4(mnuclass + mifMask, or_all({MIIM_TYPE,MIIM_ID,MIIM_BITMAP}))
>      poke4(mnuclass + mifType, MF_STRING)
>      poke4(mnuclass + mifState, 0)
>      poke4(mnuclass + miwID, IDM_LONGFORM)
> 
>      poke4(mnuclass + mihsubmenu, NULL)
>      poke4(mnuclass + mihbmpChecked, NULL)
>      poke4(mnuclass + mihbmpUnchecked, NULL)
> 
>      mnustr = alloc_string("&Format\tF7")
>      poke4(mnuclass + midwTypeData, mnustr)
>      poke4(mnuclass + mihbmpItem, LoadImage("format.bmp", IMAGE_BITMAP))
> 
>      junk = c_func(xInsertMenuItem,{hpopup, 0, 1, mnuclass})
> 
> </snip>
> 
> According to MS-SDK InsertMenuItem will work in this case instead of
> useing SetMenuItemInfo because I am initially setting the menu up.
> 
> Has anyone tried to do something similar that might be able to
> shed light on my little problem?
> 
> I had a suspicion about * or_all({MIIM_TYPE,MIIM_ID,MIIM_BITMAP})
> and mixing these types so, I did try to set MIIM_BITMAP alone and it didnt
> change a thing.
> 
> With this code the text will disappears from the menuitem
> or, the item completely disappears.
> 
> If you need more to go on (I think I covered most of it),
> let me know and I can send this to you.
> 
> Euman
> euman at bellsouth.net
> 

Hello again all,

I figured this one out!!!

for some strange reason MIIM_DATA has to be set as well
as all of the others to work

or_all({MIIM_TYPE,MIIM_ID,MIIM_BITMAP,MIIM_DATA})

and the constant values must be set accordingly

    MIIM_ID = 2,
    MIIM_SUBMENU = 4,
    MIIM_TYPE = 16,
    MIIM_DATA = 32,
    MIIM_BITMAP = 128


Yippie, Euphoria now has bitmap menu's

I plan on submitting my fast scroller again soon
that will show how to do this, set fonts, and print bitmaps & text.

Latter,

Euman
euman at bellsouth.net

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu