Page 1 of 2

Background image in XPBMENU() and in DCSTATIC

Posted: Thu Dec 25, 2014 6:59 am
by obelix
Hi everybody,
I would like to to fill a window painted by XPBMENU() with an image in the background
and in a DCSTATIC window too.
Merry Christmas to alle Users
:text-merryxmas: :text-happynewyear:

Re: Background image in XPBMENU() and in DCSTATIC

Posted: Thu Dec 25, 2014 8:45 am
by Auge_Ohr
hi,
obelix wrote:I would like to to fill a window painted by XPBMENU() with an image in the background
and in a DCSTATIC window too.
you canĀ“t modify normal XbpMenu() while "painting" is done by OS()

you can use Ownerdraw Menu to use Icon+Text+Gradient (Red Area)
you can use Ownerdraw MenuBar to "paint" Text or Gradient or Image (Green Area)
OD_Wendel_Menu.JPG
OD_Wendel_Menu.JPG (13.6 KiB) Viewed 15115 times
OD_Menu.JPG
OD_Menu.JPG (42.33 KiB) Viewed 15115 times
have a nice Xmas :occasion-santa:

Re: Background image in XPBMENU() and in DCSTATIC

Posted: Fri Dec 26, 2014 8:45 am
by rdonnay
I don't quite understand what you are wanting but I suspect that it can be done with owner drawing.

Re: Background image in XPBMENU() and in DCSTATIC

Posted: Fri Dec 26, 2014 2:14 pm
by obelix
Hi Jimmy and Roger,
It just like the example, Jimmy demonstrated. Can you give me a little help for doing it with owner drawing or an example in xdemo or in the samples?
Thanks

Peter

Re: Background image in XPBMENU() and in DCSTATIC

Posted: Fri Dec 26, 2014 6:41 pm
by Auge_Ohr
obelix wrote:It just like the example, Jimmy demonstrated.
use Source from C:\ALASKA\XPPW32\Source\samples\basics\OWNERDRW

in Demo Sample C:\ALASKA\XPPW32\Source\samples\basics\OWNERDRW\OWNERDRW.prg you will find this Code

Code: Select all

   oMbar := oDlg:menuBar()
   oMbar:measureItem := {|nItem,aDims,self| MeasureMenubarItem(oDlg,self,nItem,aDims) }
   oMbar:drawItem    := {|oPS,aInfo,self  | DrawMenubarItem(oDlg,self,oPS,aInfo) }
to use a Image as Logo in Menubar we have to modify it this Way

Code: Select all

PROCEDURE AppMenu( oMain )
LOCAL oMenuBar := oMain:menuBar()
LOCAL oLogo := XbpBitmap():new():create()

   oLogo:load(,201)
   oMenuBar:measureItem := {|nItem,aDims,oSelf| MeasureMenubarItem(oMain,oSelf,nItem,aDims) }
   oMenuBar:drawItem    := {|oPS,aInfo,oSelf  | DrawMenubarItem(oMain,oSelf,oPS,aInfo,oLogo) }
now modify in C:\ALASKA\XPPW32\Source\samples\basics\OWNERDRW\MENUS.PRG

Code: Select all

CLASS MyMenu FROM XbpMenu
...

FUNCTION DrawMenubarItem( oDlg, oMbar, oPS, aInfo, oLogo )  // add oLogo
...
LOCAL nMax    := oMbar:numItems()
LOCAL nGraWide := oPS:SetPageSize()[1][1]

   IF BAND( aInfo[ 2 ], XBP_DRAWACTION_DRAWALL ) != 0 .AND. aInfo[ 1 ] = nMax
      oLogo:draw( oPS, { aInfo[4][3], aInfo[4][2], nGraWide, aInfo[4][4] },,,GRA_BLT_BBO_IGNORE )
   ENDIF

Re: Background image in XPBMENU() and in DCSTATIC

Posted: Sat Dec 27, 2014 6:21 am
by obelix
Thank you Jimmy, I'll try it next week an I will give your feedback.

Re: Background image in XPBMENU() and in DCSTATIC

Posted: Sat Dec 27, 2014 9:01 am
by rdonnay
If you must have this, it would be best if I just added it as a feature to dcmenu, especially since it alrEady supports owner drawing.

Re: Background image in XPBMENU() and in DCSTATIC

Posted: Sun Dec 28, 2014 5:04 am
by Wolfgang Ciriack
Hi Roger,
if you change the menu ownerdrawing, can you add a ITEMHEIGHT <pixel> and a ICONSIZE <pixel>, so that the height of an item is calculated by the fontsize + itemheight ? Would be a nice feature for ownerdrawing menus.

Re: Background image in XPBMENU() and in DCSTATIC

Posted: Sun Dec 28, 2014 9:25 am
by PedroAlex
Hi Jimmy.

Can you post the prg sample of "OD_Menu.JPG"
This menu have a nice gradient style.

Thanks
Pedro

Re: Background image in XPBMENU() and in DCSTATIC

Posted: Sun Dec 28, 2014 9:35 am
by rdonnay
I am still not understanding what you want.

If a logo graphic is used as a background, then the menu items may be hard to read.

Why do you need this?