Background image in XPBMENU() and in DCSTATIC

This forum is for eXpress++ general support.
Message
Author
User avatar
obelix
Posts: 48
Joined: Tue Dec 03, 2013 7:44 am
Location: Villingen-Schwenningen, Black Forest, Germany

Background image in XPBMENU() and in DCSTATIC

#1 Post 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:
quiet old but still young and unskilled in express++

User avatar
Auge_Ohr
Posts: 1409
Joined: Wed Feb 24, 2010 3:44 pm

Re: Background image in XPBMENU() and in DCSTATIC

#2 Post 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 14024 times
OD_Menu.JPG
OD_Menu.JPG (42.33 KiB) Viewed 14024 times
have a nice Xmas :occasion-santa:
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4734
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Background image in XPBMENU() and in DCSTATIC

#3 Post by rdonnay »

I don't quite understand what you are wanting but I suspect that it can be done with owner drawing.
The eXpress train is coming - and it has more cars.

User avatar
obelix
Posts: 48
Joined: Tue Dec 03, 2013 7:44 am
Location: Villingen-Schwenningen, Black Forest, Germany

Re: Background image in XPBMENU() and in DCSTATIC

#4 Post 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
quiet old but still young and unskilled in express++

User avatar
Auge_Ohr
Posts: 1409
Joined: Wed Feb 24, 2010 3:44 pm

Re: Background image in XPBMENU() and in DCSTATIC

#5 Post 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
greetings by OHR
Jimmy

User avatar
obelix
Posts: 48
Joined: Tue Dec 03, 2013 7:44 am
Location: Villingen-Schwenningen, Black Forest, Germany

Re: Background image in XPBMENU() and in DCSTATIC

#6 Post by obelix »

Thank you Jimmy, I'll try it next week an I will give your feedback.
quiet old but still young and unskilled in express++

User avatar
rdonnay
Site Admin
Posts: 4734
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Background image in XPBMENU() and in DCSTATIC

#7 Post 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.
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 479
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: Background image in XPBMENU() and in DCSTATIC

#8 Post 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.
_______________________
Best Regards
Wolfgang

User avatar
PedroAlex
Posts: 231
Joined: Tue Feb 09, 2010 3:06 am

Re: Background image in XPBMENU() and in DCSTATIC

#9 Post by PedroAlex »

Hi Jimmy.

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

Thanks
Pedro
Pedro Alexandre

User avatar
rdonnay
Site Admin
Posts: 4734
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Background image in XPBMENU() and in DCSTATIC

#10 Post 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?
The eXpress train is coming - and it has more cars.

Post Reply