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

Re: Background image in XPBMENU() and in DCSTATIC

#11 Post by obelix »

Hi Roger,
I would like to keep the xpbMenu(), we discussed already in the forum
http://bb.donnay-software.com/donnay/vi ... f=2&t=1373 because its working fine,
but it woud be ok to use DCMENU if this could offer me a logo in the backgroud.
I look for it only in the menu, similar to the background in XDEMO, but using a jpg or bmp picture

Peter
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

#12 Post by rdonnay »

You didn't answer my question. How can we be sure that the menu text is readable if there is a logo in the background?

I have already put about 2 hours into this trying to figure out a way to do it without major code changes.
I am very hesitant to write hours of code with the possibility of breaking it just to satisfy the desire of one person.

Maybe the best thing is for you to write your own owner-drawing system using SUBCLASS, like Tom Liehr does with the browse system.
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

#13 Post by obelix »

Roger,
thank you for spending your time to my problem. I surely don't want you to make a great effort for a peripheral problem if nobody else is interested in having an only optical upvaluation of his programm.
Im trying to answer to your question:
If I have a menubar in the upper line of a menu window and below this menu a picture (i.e. a logo) and the pulldown items will overlap this picture on exploding, I cannot see that the items are hard to read. You can recognize it in Jimmy's reply to this topic.
My expectation in this posting was to find in your really impressive library a chance to realize this idea. I thin I will try to learn more about the owner draw to find the solution to my problem beginning with OWNERDRW.prg in the xppw32 samples.
Last edited by obelix on Sun Dec 28, 2014 3:06 pm, edited 1 time in total.
quiet old but still young and unskilled in express++

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

#14 Post by obelix »

Roger,
thank you for spending your time to my problem. I surely don't want you to make a great effort for a peripheral problem if nobody else is interested in having an only optical upvaluation of his programm.
Im trying to answer to your question:
If I have a menubar in the upper line of a menu window and below this menu a picture (i.e. a logo) and the pulldown items will overlap this picture on exploding, I cannot see that the items are hard to read. You can recognize it in Jimmy's reply to this topic.
My expectation in this posting was to find in your really impressive library a chance to realize this idea. I thin I will try to learn more about the owner draw to find the solution to my problem beginning with OWNERDRW.prg in the xppw32 samples.
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

#15 Post by rdonnay »

If I have a menubar in the upper line of a menu window and below this menu a picture (i.e. a logo) and the pulldown items will overlap this picture on exploding, I cannot see that the items are hard to read. You can recognize it in Jimmy's reply to this topic.
That is completely different that what I understood you want and what Jimmy was showing in his sample.

This will not be easy to do because of the way the presentation space of menu items is given to the owner drawing system.

Apparently, you and Jimmy are communicating better than you and I, so I recommend that you work with him on this.
Do I understand that he has already given you a solution which satisfies you?
The eXpress train is coming - and it has more cars.

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

Re: Background image in XPBMENU() and in DCSTATIC

#16 Post by Auge_Ohr »

hi,
comercial wrote:Can you post the prg sample of "OD_Menu.JPG"
This menu have a nice gradient style.
the Gradient is made this Way

use c:\ALASKA\XPPW32\Source\samples\basics\OWNERDRW\MENUS.PRG
locate in METHOD XbpImageMenu:DrawItem( oPS, aInfo )

Code: Select all

line 392
aItem := ::getItem( aInfo[1] )
write before line 392

Code: Select all

IF nFill = GRA_FILL
   aAttrs := ARRAY( GRA_AA_COUNT )
   aAttrs[ GRA_AA_COLOR ] := SPBG_MENU()
   aAttrs[ GRA_AA_BACKCOLOR ] := IF( EMPTY( nRGB ), SPBG_MENU(), nRGB )
   aPrev := GraSetAttrArea( oPS, aAttrs )

   IF IsThemeActive( .F. ) == .T.
      GraGradientBox( oPS, { nGraWide, aItemBG[ 2 ] },;
                       { aItemBG[ 3 ], aItemBG[ 4 ] + 1 }, 0, NIL )
   ELSE
      GraGradientBox( oPS, { aItemBG[ 1 ], aItemBG[ 2 ] },;
                           { aItemBG[ 3 ], aItemBG[ 4 ] }, 0, NIL )
   ENDIF
   GraSetColor( oPS, aPrev[ 1 ], aPrev[ 2 ] )
ENDIF
my GraGradientBox() is different to Alaska v1.9.355 Version, it work also with v1.9.331 and on "WIN9X" OS()
see #IF XPPVER > 01900331

Code: Select all

FUNCTION GraGradientBox( oPS, aStart, aEnd, nMode, xSpec, nDirection )
#define GRADIENT_FILL_RECT_H     0
#define MENU_BARTEXT       GRA_CLR_BLACK

LOCAL cOS       := OS( OS_PRODUCT )
LOCAL nHDC      := 0
LOCAL nCookie
LOCAL aPos1, aPos2
LOCAL aVertex
LOCAL aGRect
LOCAL aRGBStart
LOCAL aRGBEnd
LOCAL aAttrs
LOCAL nVertLen
LOCAL nGRectLen

STATIC cTemplate

   DEFAULT nDirection TO 0                                  // 0=horiz, 1=vert, 2=triangle

   UNUSED( nMode )
   UNUSED( xSpec )

   aAttrs := GraSetAttrArea( oPS )
   IF GraIsRGBColor( aAttrs[ GRA_AA_COLOR     ] ) == .F. .OR. ;
      GraIsRGBColor( aAttrs[ GRA_AA_BACKCOLOR ] ) == .F.
      RETURN .F.
   ENDIF

#IF XPPVER > 01900331
   // use Alaska GraGradient() since 1.9.355 
   DO CASE
      CASE nDirection == 0
         GraGradient( oPS, aStart, { aEnd }, { SPBG_MENU(), SPBG_WHITE(), MENU_BARTEXT }, nDirection )
      CASE nDirection == 1
         GraGradient( oPS, aStart, { aEnd }, { SPBG_WHITE(), SPBG_MENU(), MENU_BARTEXT }, nDirection )
      CASE nDirection == 2
         GraGradient( oPS, aStart, { aEnd }, { SPBG_MENU(), MENU_BARTEXT, SPBG_WHITE() }, nDirection )
   ENDCASE

#ELSE
   aRGBStart := GraGetRGBIntensity( aAttrs[ GRA_AA_COLOR ] )
   aRGBEnd   := GraGetRGBIntensity( aAttrs[ GRA_AA_BACKCOLOR ] )
   AEVAL( aRGBStart, { | x | INT( x := 65280 * x / 255 ) },,, .T. )
   AEVAL( aRGBEnd  , { | x | INT( x := 65280 * x / 255 ) },,, .T. )

   aPos1 := oPS:MapPoint( aStart, .T., .T. )
   aPos2 := oPS:MapPoint( aEnd, .T., .T. )

   aVertex := L2BIN( aPos1[ 1 ] + 1 ) + ;
                     L2BIN( aPos1[ 2 ] + 1 ) + ;
                     W2Bin( aRGBStart[ 1 ] ) + ;
                     W2Bin( aRGBStart[ 2 ] ) + ;
                     W2Bin( aRGBStart[ 3 ] ) + ;
                     W2Bin( 0 ) + ;
                     L2BIN( aPos2[ 1 ] + 1 ) + ;
                     L2BIN( aPos2[ 2 ] + 1 ) + ;
                     W2Bin( aRGBEnd[ 1 ] ) + ;
                     W2Bin( aRGBEnd[ 2 ] ) + ;
                     W2Bin( aRGBEnd[ 3 ] ) + ;
                     W2Bin( 0 )

   aGRect := L2BIN( 0 ) + ;
                    L2BIN( 1 )

   nCookie := oPS:LockHDC( 2, @nHDC )
   IF nCookie == 0
      RETURN .F.
   ENDIF

   IF OS( OS_FAMILY ) == "WIN9X"
      //
      // only horizontal
      //
      DLLCall( "MSIMG32.DLL", DLL_STDCALL, "GradientFill", nHDC, ;
               @ aVertex, 2, @aGRect, 1, GRADIENT_FILL_RECT_H )
   ELSE
      IF cTemplate == NIL
         cTemplate := DLLPrepareCall( "gdi32.dll", DLL_OSAPI, "GdiGradientFill" )
      ENDIF

      nVertLen  := LEN( aVertex ) / 16
      nGRectLen := LEN( aGRect ) / ( 4 * IIF( nDirection > 1, 3, 2 ) )

      DLLExecuteCall( cTemplate  , ;
                      nHdc       , ;
                      @aVertex   , ;
                      nVertLen   , ;
                      @aGRect    , ;
                      nGRectLen  , ;
                      nDirection )

   ENDIF

   oPS:UnlockHDC( nCookie, nHDC )

#ENDIF

RETURN .T.
***Note : SPBG_*() Function (and nRGB) hold Color which can be change "on-fly"
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

#17 Post by rdonnay »

A GRADIENT is not what was requested. I understood that a LOGO was requested.
I have no problems with a gradient. That makes sense to me.
The eXpress train is coming - and it has more cars.

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

Re: Background image in XPBMENU() and in DCSTATIC

#18 Post by Auge_Ohr »

rdonnay wrote:A GRADIENT is not what was requested. I understood that a LOGO was requested.
I have no problems with a gradient. That makes sense to me.
YES ... "Obelix" ask for Logo.

"Comercial" ask for that Gradient and i want to show where to enhance original c:\ALASKA\XPPW32\Source\samples\basics\OWNERDRW\MENUS.PRG
greetings by OHR
Jimmy

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

Re: Background image in XPBMENU() and in DCSTATIC

#19 Post by PedroAlex »

Auge_Ohr wrote:
rdonnay wrote:A GRADIENT is not what was requested. I understood that a LOGO was requested.
I have no problems with a gradient. That makes sense to me.
YES ... "Obelix" ask for Logo.

"Comercial" ask for that Gradient and i want to show where to enhance original c:\ALASKA\XPPW32\Source\samples\basics\OWNERDRW\MENUS.PRG


Jimmy.

Many Thanks.
I'll try it next year :-)

I wish everyone a happy new year

Pedro
Pedro Alexandre

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

#20 Post by obelix »

Thank you for all postings to my question. I will try to find a way next week on studying your purposals.
A Happy New Year to everybody.
quiet old but still young and unskilled in express++

Post Reply