TestTitl.prg Sample MDI

TestTitl.prg Sample MDI

Postby Rick Lipkin » Mon Feb 27, 2012 3:43 pm

To All

I have been reviewing the sample TestTitl.prg and noticed that if I add the MDI clause to the Window it disables the ANIMA option ( bounce effect )

Is there a work around for this ?

Also .. just noticed that when using MDI and a program overlays on top of the title .. it erases it .. This behavoir only occurs with MDI.


Thanks
Rick Lipkin

Code: Select all  Expand view  RUN

DEFINE WINDOW oWnd TITLE "Service Assistant Proof of Concept" ;
       BRUSH oBrush1   ;
       MENU BuildMenu() ;
       MDI  // added this and disables animation

   @  0, 0 TITLE oTitle4 size 460, 60 of oWnd SHADOW BOTTOMRIGHT SHADOWSIZE 4
   @   5, 10 TITLEIMG OF oTitle4 BITMAP "C:\Fwh1201\bitmaps\32X32\keys.bmp" SIZE 30, 30 TRANSPARENT ANIMA ;
              action MsgInfo( "Test" )
   @  30, 15 TITLETEXT OF oTitle4 TEXT "Keys"  COLOR CLR_BLACK


   SET MESSAGE OF oWnd     ;
       to "Test" CLOCK 2007

Activate Window oWnd maximized
 


Mdi vanishing Title bar

Image
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TestTitl.prg Sample MDI

Postby ukoenig » Mon Feb 27, 2012 6:51 pm

Rick,

you have to add a MDICHILD with the included TTitle (the same using Buttons), to get it working.
Not possible on a MDIFRAME.

A Solution from Rao :
viewtopic.php?f=3&t=20453&p=111118&hilit=mdi+buttons#p111118

1. Adding a MDICHILD like :
DEFINE WINDOW oWndBtn MDICHILD OF oWndMain FROM 50, 20 TO 520, 190 PIXEL ;
BORDER NONE ;
NOSYSMENU ;
NOICONIZE ;
NOCAPTION


2. capture the Brush-area from the Mainwindow.
STATIC FUNCTION CHILDPAINT( hDC, oWnd )
local aPoint
aPoint := ClientToScreen( WndMain():hWnd, { 0, 0 } )
aPoint := ScreenToClient( oWnd:hWnd, aPoint )
SetBrushOrgEx( hDC, aPoint[ 2 ], aPoint[ 1 ] + WndMain():oBar:nHeight - 1 )
FillRect( hDC, GetClientRect( oWnd:hWnd ), oWnd:oBrush:hBrush )
RETURN NIL


Read about a Solution (Tool-Download) :
viewtopic.php?f=3&t=20544&p=108979&hilit=mdi+buttons#p108970

I added a TTitle to the MDICHILD-Buttons. ANIMA works perfect.

Best Regards
Uwe :lol:
Last edited by ukoenig on Mon Feb 27, 2012 7:22 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: TestTitl.prg Sample MDI

Postby Rick Lipkin » Mon Feb 27, 2012 7:18 pm

Uwe

Thanks for your help .. was thinking of using Vtitle to paint a button bar .. I have tried the ToolBar1.prg sample and I like the control over placement and the placement of the buttons and text .. unfortunately, I did not see in the FiveWin.ch header where Toolbar had any option for color or Gradient :(

Code: Select all  Expand view  RUN

#xcommand DEFINE TOOLBAR <oTlb> ;
             [ <wnd: OF, WINDOW, DIALOG> <oWnd> ] ;
             [ SIZE <nWidth>, <nHeight> ] ;
             [ IMAGELIST <oImg> ] ;
             [ <balloon: BALLOON > ] ;
       => ;
          <oTlb> := TToolBar():New( <oWnd>, [<nWidth>], [<nHeight>], [<oImg>],;
                                   [<.balloon.>] )
 


But did see where IMAGEBITMAP had a color attribute on it

Code: Select all  Expand view  RUN

#xcommand DEFINE IMAGELIST <oImgLst> ;
             [ SIZE <nWidth>, <nHeight> ] ;
       => ;
          <oImgLst> := TImageList():New( [<nWidth>], [<nHeight>] )

#xcommand DEFINE IMGBITMAP [<oBmp>] ;
             [ <resource: RESOURCE, NAME, RESNAME> <cResName> ] ;
             [ <of: OF> <oImageList> ] ;
             [ COLOR <nClrMask> ] ;
       => ;
          <oImageList>:AddMasked( [ <oBmp> := ]TBitmap():Define( <cResName>,,;
             GetWndDefault() ), [<nClrMask>] )

#xcommand DEFINE TBBUTTON ;
             [ OF <oToolBar> ] ;
             [ ACTION <uAction> ] ;
             [ TOOLTIP <cToolTip> ] ;
             [ PROMPT <cPrompt> ] ;
             [ WHEN <uWhen> ] ;
             [ MESSAGE <cMsg> ] ;
       => ;
          <oToolBar>:AddButton( [<{uAction}>], [<cToolTip>], [<cPrompt>],;
                                [<{uWhen}>], [<cMsg>] )


 


I did a quick color test with the Image and it was not what I had expected .. Still testing.

Rick Lipkin

Rick
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TestTitl.prg Sample MDI

Postby ukoenig » Mon Feb 27, 2012 7:36 pm

Rick,

added to sample Toolbar1.prg MDIFRAME

DEFINE TOOLBAR oToolBar OF oWnd SIZE 50, 58 ; // 50, 50 ;
IMAGELIST oImageList BALLOON // tooltips balloon style

DEFINE BRUSH oTBrush COLOR 128 // Red Color
oToolbar:oBrush := oTBrush


2 Gradient-Samples ( vertical, horizontal ) :

Image

DEFINE TOOLBAR oToolBar OF oWnd SIZE 50, 58 ; // 50, 50 ;
IMAGELIST oImageList BALLOON // tooltips balloon style

aGrad := { { 0.5, 16443068, 10899511 }, { 0.5, 10899511, 16443068 } }
hDC = CreateCompatibleDC( oToolbar:GetDC() )
hBmp = CreateCompatibleBitMap( oToolbar:hDC, oToolbar:nWidth, oToolbar:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, oToolbar:nHeight, oToolbar:nWidth, aGrad, .T. )
oTBrush := TBrush():New( ,,,, hBmp )
oTBrush:Cargo := aGrad
SelectObject( hDC, hBmpOld )
ReleaseDC(hDC)

oToolbar:oBrush := oTBrush


Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: TestTitl.prg Sample MDI

Postby Rick Lipkin » Mon Feb 27, 2012 9:25 pm

Uwe

I added your suggestions however my icons are not transparent .. any suggestions ?

Rick

Code: Select all  Expand view  RUN

// Toolbar1.prg


#include "FiveWin.ch"

static oToolBar,xMessage

//--------------------------
Func Main()

Local oWnd, oImageList,oTBrush
Local cFile,aDir,dExe,nStart,cDefa
Local nScr1,nScr2,nYear,cRights,cRdd,xGrad8,aGrad
Local hDc,hBmp,hBmpOld

PUBLIC xLOGIN,xVOL,xREAD,xWRITE,xSUPER

*SetDlgGradient( { { .50, nRGB( 216, 216, 216 ), nRGB( 255, 255, 255 ) } } )

//-- get timestamp on .exe //

cFILE := GetModuleFileName( GetInstance() )
aDIR  := DIRECTORY( cFILE )
dEXE  := aDIR[1] [3]

// where .exe started from is default directory //

nSTART := RAT( "\", cFILE )
cDEFA  := SUBSTR(cFILE,1,nSTART-1)

aDIR   := NIL

SET DEFA to ( cDEFA )

REQUEST DBFCDX
rddsetdefault ( "
DBFCDX" )

nSCR1 := GetSysMetrics(0)
nSCR2 := GetSysMetrics(1)

SET DELETED on
SET CENTURY on
SET 3DLOOK on

nYEAR := ( year( DATE() )-30 )
SET EPOCH to ( nYEAR )

xREAD   := "
"
xWRITE  := "
"
xSUPER  := "
"

xLogin  := UPPER( substr(WNetGetuser()+space(10),1,8) )

cRdd := "
Jet OLEDB:Database"

// here
cRIGHTS := "
(RWS)" //_Rights()

xMESSAGE :=  "
User  "+xLOGIN+"    Rights  "+cRIGHTS+        ;
      "
    Default= "+cDEFA+"      Rdd= "+cRDD+            ;
      "
    Revision  "+DTOC(dEXE)+;
      "
 -r"+str(nSCR1,4)+" x "+STR(nSCR2,4)


DEFINE WINDOW oWnd TITLE "
FWH - Testing Win32 Toolbars" ;
      MENU BuildMenu()

   // First we build an ImageList with all the bitmaps
   DEFINE IMAGELIST oImageList SIZE 32, 32

   DEFINE IMGBITMAP OF oImageList NAME "
new"      COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImageList NAME "
open"     COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImageList NAME "
check"    COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImageList NAME "
search"   COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImageList NAME "
print"    COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImageList NAME "
internet" COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImageList NAME "
keys"     COLOR nRGB( 255, 0, 255 )
   DEFINE IMGBITMAP OF oImageList NAME "
quit"     COLOR nRGB( 255, 0, 255 )

   //   Now we create the toolbar and add the buttons

   DEFINE TOOLBAR oToolBar OF oWnd SIZE 50, 58 ; // 50, 50 ;
          IMAGELIST oImageList BALLOON // tooltips balloon style

   aGrad := { { 0.5, 16443068, 10899511 }, { 0.5, 10899511, 16443068 } }
   hDC = CreateCompatibleDC( oToolbar:GetDC() )
   hBmp = CreateCompatibleBitMap( oToolbar:hDC, oToolbar:nWidth, oToolbar:nHeight )
   hBmpOld = SelectObject( hDC, hBmp )
   GradientFill( hDC, 0, 0, oToolbar:nHeight, oToolbar:nWidth, aGrad, .T. )
   oTBrush := TBrush():New( ,,,, hBmp )
   oTBrush:Cargo := aGrad
   SelectObject( hDC, hBmpOld )
   ReleaseDC(hDC)

   oToolbar:oBrush := oTBrush

   DEFINE TBBUTTON OF oToolBar ;
      ACTION  oToolbar:SetText( 1, "
Hello" ) ; // Modify first button text
      TOOLTIP "
New" ;
      PROMPT  "
&New project" ;
      MESSAGE "
New"

   DEFINE TBBUTTON OF oToolBar ;
      ACTION  oToolBar:SetChecked( 2, .t. ) ; // Set pressed the second button
      TOOLTIP "
Open" ;
      PROMPT  "
Open project" ;
      MESSAGE "
Open"

   DEFINE TBSEPARATOR OF oToolBar

   DEFINE TBMENU OF oToolBar ;
      ACTION  MsgInfo( "
Menu" ) ;
      TOOLTIP "
Menu" ;
      PROMPT  "
Menu" ;
      MENU    BuildPopup()

   DEFINE TBBUTTON OF oToolBar ;
      ACTION  oToolBar:SetChecked( 2, .f. ) ; // MsgInfo( "
Search" ) ;
      TOOLTIP "
Search" ;
      PROMPT  "
Search"

   DEFINE TBBUTTON OF oToolBar ;
      ACTION  MsgInfo( "
Print" ) ;
      TOOLTIP "
Print a report" ;
      PROMPT  "
Print a report"

   DEFINE TBSEPARATOR OF oToolBar

   DEFINE TBBUTTON OF oToolBar ;
      ACTION  MsgInfo( "
Upgrade" ) ;
      TOOLTIP "
Search for new versions" ;
      PROMPT  "
Upgrade"

   DEFINE TBBUTTON OF oToolBar ;
      ACTION MsgInfo( "
Users" ) ;
      TOOLTIP "
Users management" ;
      PROMPT "
Users"

   DEFINE TBSEPARATOR OF oToolBar

   DEFINE TBBUTTON OF oToolBar ;
      ACTION  oWnd:End() ;
      TOOLTIP "
End Application" ;
      PROMPT  "
Exit"

*   DEFINE STATUSBAR OF oWnd PROMPT "
Toolbars test"
SET MESSAGE OF oWnd     ;
    to xMESSAGE CLOCK 2007

ACTIVATE WINDOW oWnd MAXIMIZED

oImageList:End()
oTBrush:End()

return nil

//--------------------------
function BuildMenu()

   local oMenu

   MENU oMenu 2007
      MENUITEM "
&Project"
      MENU
         MENUITEM "
&New..." ACTION MsgInfo( "New" ) MESSAGE "New"
         MENUITEM "
&Open..." ACTION MsgInfo( "Open" ) MESSAGE "Open"
         SEPARATOR
         MENUITEM "
&Exit..." ACTION MsgInfo( "End" ) MESSAGE "Exit"
      ENDMENU

      MENUITEM "
&Edit"
      MENU
         MENUITEM "
&Search..." ACTION MsgInfo( "Search" )
         MENUITEM "
&Print..." ACTION MsgInfo( "Print" )
      ENDMENU

      MENUITEM "
&Utilities"
      MENU
         MENUITEM "
&Disable button..." ACTION oToolBar:EnableButton( 3, .f. )
         MENUITEM "
&Enable button..." ACTION oToolBar:EnableButton( 3, .t. )
      ENDMENU
   ENDMENU

return oMenu

//--------------------------
function BuildPopup()

   local oMenu

   MENU oMenu POPUP
      MENUITEM "
One"   ACTION MsgInfo( "One" )
      MENUITEM "
Two"   ACTION MsgInfo( "Two" )
      MENUITEM "
Three" ACTION MsgInfo( "Three" )
   ENDMENU

return oMenu


// end



Image
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TestTitl.prg Sample MDI

Postby ukoenig » Mon Feb 27, 2012 9:46 pm

Rick,

be sure, that Your Images are Alphablended Bmp's

You can add a Alphachannel using PIXELFORMER

I see You know how to use it :
viewtopic.php?f=3&t=21546&p=114491&hilit=pixelformer#p114491

Best Regards
Uwe :lol:
Last edited by ukoenig on Thu Mar 15, 2012 10:37 am, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: TestTitl.prg Sample MDI

Postby Rick Lipkin » Tue Feb 28, 2012 1:49 pm

Uwe

I am sorting through my icons and how I modify them and compile into my applications. I noticed that the ToolBar class uses only resources and does not utilize FileName to access the bitmaps directly ..

In the TestTitl.prg sample the icons used came out of the fwh\icons folder. I noticed in your screen shot you used the same icons.. Did you modify those to alpha bitmaps or did you use the 'stock' ones from FWH ?

Just curious how you compiled the program and the associated .rc file that contained the icons. I have had much difficulty creating 32 bit alpha blended icons that I could compile into my application. I thought I had a good system using ResEdit because I could add a 32 bit bitmap to the .rc .. then I would save the .rc to .res and link the .res into my application.

Unfortunately, something is broken in that method and the .res does not seem to compile into my .exe with Borland Bcc582.

I have also successfully used Resedit to create a .dll file and link the .dll to my app containing my 32 bit bitmaps .. but having an external .dll is too clumsy and not as elegant as a single monolithic .exe.

Please let me know what icons you used in your sample and if you have modified them, would you mind sending them to me to test in my environment.

I would be most grateful for you comments and help.

Rick Lipkin
r1.1955@live.com
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TestTitl.prg Sample MDI

Postby ukoenig » Tue Feb 28, 2012 4:24 pm

Rick,

the compiled Sample < Toolbar1.prg > with some extra Lines ( Window MDI-Brush included )

Code: Select all  Expand view  RUN

#include "FiveWin.ch"

static oToolBar

function Main()
local oWnd, oImageList, oTBrush
LOCAL nSWidth := GetSysMetrics(0), nSHeight := GetSysMetrics(1)

DEFINE WINDOW oWnd TITLE "FWH - Testing Win32 Toolbars" ;
MENU BuildMenu() MDI

// First we build an ImageList with all the bitmaps
DEFINE IMAGELIST oImageList SIZE 32, 32

DEFINE IMGBITMAP OF oImageList NAME "new"      COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "open"     COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "check"    COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "search"   COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "print"    COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "internet" COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "keys"     COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "quit"     COLOR nRGB( 255, 0, 255 )

   // Now we create the toolbar and add the buttons
   
DEFINE TOOLBAR oToolBar OF oWnd SIZE 50, 58 ; // 50, 50 ;
IMAGELIST oImageList BALLOON // tooltips balloon style

aGrad := { { 0.5, 16443068, 10899511 }, { 0.5, 10899511, 16443068 } }
hDC = CreateCompatibleDC( oToolbar:GetDC() )
hBmp = CreateCompatibleBitMap( oToolbar:hDC, oToolbar:nWidth, oToolbar:nHeight )
hBmpOld = SelectObject( hDC, hBmp )
GradientFill( hDC, 0, 0, oToolbar:nHeight, oToolbar:nWidth, aGrad, .T. )
oTBrush := TBrush():New( ,,,, hBmp )
oTBrush:Cargo  := aGrad
SelectObject( hDC, hBmpOld )
ReleaseDC(hDC)

oToolbar:oBrush := oTBrush

oToolBar:SetTextRows( 2 )
   
DEFINE TBBUTTON OF oToolBar ;
ACTION  oToolbar:SetText( 1, "Hello" ) ; // Modify first button text
TOOLTIP "New" ;
PROMPT  "&New project" ;
MESSAGE "New"
   
DEFINE TBBUTTON OF oToolBar ;
ACTION  oToolBar:SetChecked( 2, .t. ) ; // Set pressed the second button
TOOLTIP "Open" ;
PROMPT  "Open project" ;
MESSAGE "Open"
     
DEFINE TBSEPARATOR OF oToolBar
   
DEFINE TBMENU OF oToolBar ;
ACTION  MsgInfo( "Menu" ) ;
TOOLTIP "Menu" ;
PROMPT  "Menu" ;
MENU    BuildPopup()
   
DEFINE TBBUTTON OF oToolBar ;
ACTION  oToolBar:SetChecked( 2, .f. ) ; // MsgInfo( "Search" ) ;
TOOLTIP "Search" ;
PROMPT  "Search"

DEFINE TBBUTTON OF oToolBar ;
ACTION  MsgInfo( "Print" ) ;
TOOLTIP "Print a report" ;
PROMPT  "Print a report"

DEFINE TBSEPARATOR OF oToolBar
     
DEFINE TBBUTTON OF oToolBar ;
ACTION  MsgInfo( "Upgrade" ) ;
TOOLTIP "Search for new versions" ;
PROMPT  "Upgrade"
     
DEFINE TBBUTTON OF oToolBar ;
ACTION MsgInfo( "Users" ) ;
TOOLTIP "Users management" ;
PROMPT "Users"  

DEFINE TBSEPARATOR OF oToolBar

DEFINE TBBUTTON OF oToolBar ;
ACTION  oWnd:End() ;
TOOLTIP "End Application" ;
PROMPT  "Exit"

DEFINE STATUSBAR OF oWnd PROMPT "Toolbars test"

// change Window-brush :
// 1 = Color
// 2 = Gradient
// 3 = Brush
// 4 = Image
// 5 = Transparent Gradient

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT WND_BRUSH( 2, .T., 16443068, 10899511, 0.1, , ) // 2 = Gradient

oTBrush:End()
oImageList:End()

return nil

// -------------------

function BuildMenu()
local oMenu

MENU oMenu
      MENUITEM "&Project"
      MENU
         MENUITEM "&New..." ACTION MsgInfo( "New" ) MESSAGE "New"
         MENUITEM "&Open..." ACTION MsgInfo( "Open" ) MESSAGE "Open"
         SEPARATOR
         MENUITEM "&Exit..." ACTION MsgInfo( "End" ) MESSAGE "Exit"
      ENDMENU

      MENUITEM "&Edit"
      MENU
         MENUITEM "&Search..." ACTION MsgInfo( "Search" )
         MENUITEM "&Print..." ACTION MsgInfo( "Print" )
      ENDMENU

      MENUITEM "&Utilities"
      MENU
         MENUITEM "&Disable button..." ACTION oToolBar:EnableButton( 3, .f. )
         MENUITEM "&Enable button..." ACTION oToolBar:EnableButton( 3, .t. )
      ENDMENU
ENDMENU

return oMenu

// -----------

function BuildPopup()
local oMenu
   
MENU oMenu POPUP
      MENUITEM "One"   ACTION MsgInfo( "One" )
      MENUITEM "Two"   ACTION MsgInfo( "Two" )
      MENUITEM "Three" ACTION MsgInfo( "Three" )
ENDMENU
   
return oMenu      

procedure AppSys // XBase++ requirement

return

// ----------- Brush on MDI-frame ----------------------------

FUNCTION WND_BRUSH( nPos, lDirect1, nColor1a, nColor1b, nMove1, cBrush1, cImage1)
LOCAL hDC, oWnd, oBrush, hBmp, hBmpOld , nWidth , nHeight, aRect

IF nPos = 1
    DEFINE BRUSH oBrush COLOR nColor1a
    WndMain():oWndClient:SetBrush( oBrush )
ENDIF
IF nPos = 2
    aColors1    := { { nMove1, nColor1a, nColor1b }, { nMove1, nColor1b, nColor1a } }   
    GradientFill( WndMain():oWndClient:GetDC(), 0, 0, WndMain():nHeight(), WndMain():nWidth(), aColors1, lDirect1 )
ENDIF
IF nPos = 5 // transparent Brush
    aColors1    := { { nMove1, nColor1a, nColor1b }, { nMove1, nColor1b, nColor1a } }   
    oWnd := oWndMain:oWndClient
    aRect := GetClientRect( oWnd:hWnd )
    nHeight := If( lDirect1, aRect[ 3 ] - aRect[ 1 ], 1 )
    nWidth := if( lDirect1, 1, aRect[ 4 ] - aRect[ 2 ] )
    hDC1 := CreateCompatibleDC( oWnd:GetDC() )
    hBmp := CreateCompatibleBitMap( oWnd:hDC, nWidth, nHeight )
    BmpOld := SelectObject( hDC1, hBmp )
    GradientFill( hDC1, 0, 0, nHeight, nWidth, aColors1, lDirect1 )
    DeleteObject( oWnd:oBrush:hBrush )
    oBrush := TBrush():New( ,,,, hBmp )
    oBrush:Cargo  := aColors1
    SelectObject( hDC1, hBmpOld )
    oWnd:ReleaseDC()
    oWndBtn:SetBrush( oBrush )
    oWnd:SetBrush( oBrush )
    AEval( oWnd:aWnd, { |o| o:Refresh() } )
ENDIF
IF nPos = 3
    DEFINE BRUSH oBrush FILENAME cBrush
    WndMain():oWndClient:SetBrush( oBrush )
ENDIF
IF nPos = 4
    DEFINE IMAGE oTmp FILENAME cImage1
    oBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, oWndMain:nWidth(), oWndMain:nHeight(), .T. ) )
    WndMain():oWndClient:SetBrush( oBrush )
    oTmp:End()
ENDIF   

RETURN NIL
 


Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: TestTitl.prg Sample MDI

Postby Rick Lipkin » Tue Feb 28, 2012 6:07 pm

Uwe

The Icons are still not transparent .. they are the standard icons in the FWH folder .. Perhaps it is because my work box is XP ??

I have added 24 bit alpha blend icons to the .rc but nothing changes :(

You have gone far and above with your help !

Rick Lipkin

Image
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TestTitl.prg Sample MDI

Postby ukoenig » Tue Feb 28, 2012 7:48 pm

Rick,
can You test, what happens including other Controls and using a BMP-brush.
Are they transparent ?

Please check the used Image-path !
DEFINE BRUSH oTBrush FILENAME ".\bitmaps\blustone.bmp"

Image

Some more lines added :

Code: Select all  Expand view  RUN

#include "FiveWin.ch"

static oToolBar

function Main()
local oWnd, oImageList, oRadio1, oSay1, oFont
LOCAL nSWidth := GetSysMetrics(0), nSHeight := GetSysMetrics(1)

DEFINE WINDOW oWnd TITLE "FWH - Testing Win32 Toolbars" ;
MENU BuildMenu() MDI

// First we build an ImageList with all the bitmaps
DEFINE IMAGELIST oImageList SIZE 32, 32

DEFINE IMGBITMAP OF oImageList NAME "new"      COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "open"     COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "check"    COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "search"   COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "print"    COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "internet" COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "keys"     COLOR nRGB( 255, 0, 255 )
DEFINE IMGBITMAP OF oImageList NAME "quit"     COLOR nRGB( 255, 0, 255 )

   // Now we create the toolbar and add the buttons
   
DEFINE TOOLBAR oToolBar OF oWnd SIZE 50, 200 ; // Width , Height
IMAGELIST oImageList BALLOON // tooltips balloon style

nBtBrush := 3

IF nBtBrush = 1
    DEFINE BRUSH oTBrush COLOR 16443068
ENDIF
IF nBtBrush = 2
    aGrad := { { 0.5, 16443068, 10899511 }, { 0.5, 10899511, 16443068 } }
    hDC = CreateCompatibleDC( oToolbar:GetDC() )
    hBmp = CreateCompatibleBitMap( oToolbar:hDC, oToolbar:nWidth, oToolbar:nHeight )
    hBmpOld = SelectObject( hDC, hBmp )
    GradientFill( hDC, 0, 0, oToolbar:nHeight, oToolbar:nWidth, aGrad, .T. )
    oTBrush := TBrush():New( ,,,, hBmp )
    oTBrush:Cargo  := aGrad
    SelectObject( hDC, hBmpOld )
    ReleaseDC(hDC)
ENDIF
IF nBtBrush = 3
    DEFINE BRUSH oTBrush FILENAME ".\bitmaps\blustone.bmp"
ENDIF
IF nBtBrush = 4
    DEFINE IMAGE oTmp FILENAME ".\bitmaps\olga.jpg"
    oTBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, oToolbar:nWidth,  oToolbar:nHeight, .T. ) )
    oTmp:End()
ENDIF

oToolbar:oBrush := oTBrush

oToolBar:SetTextRows( 2 )
 
oFont  := TFont():New("Arial",,-16,.F.,.T. ,,,,.F. )

nRadio1 := 1
@ 100, 100 RADIO oRadio1 VAR nRadio1 OF oToolbar ;
ITEMS "&One", "&Two", "T&hree" _3D SIZE  100, 20 PIXEL ;
HELPID 100, 101, 102 ;
ON CHANGE MsgBeep()
AEval( oRadio1:aItems, { | oRad | oRad:lTransparent := .T., ;
                                                       oRad:SetFont ( oFont ), ;
                                                      oRad:nClrText := 128 } )

@ 100, 220 SAY oSay1 PROMPT "Transparent Text-test"  OF oToolbar PIXEL ;
FONT oFont ;
SIZE 200, 20 COLOR 128
oSay1:lTransparent := .T.

DEFINE TBBUTTON OF oToolBar ;
ACTION  oToolbar:SetText( 1, "Hello" ) ; // Modify first button text
TOOLTIP "New" ;
PROMPT  "&New project" ;
MESSAGE "New"
   
DEFINE TBBUTTON OF oToolBar ;
ACTION  oToolBar:SetChecked( 2, .t. ) ; // Set pressed the second button
TOOLTIP "Open" ;
PROMPT  "Open project" ;
MESSAGE "Open"
     
DEFINE TBSEPARATOR OF oToolBar
   
DEFINE TBMENU OF oToolBar ;
ACTION  MsgInfo( "Menu" ) ;
TOOLTIP "Menu" ;
PROMPT  "Menu" ;
MENU    BuildPopup()
   
DEFINE TBBUTTON OF oToolBar ;
ACTION  oToolBar:SetChecked( 2, .f. ) ; // MsgInfo( "Search" ) ;
TOOLTIP "Search" ;
PROMPT  "Search"

DEFINE TBBUTTON OF oToolBar ;
ACTION  MsgInfo( "Print" ) ;
TOOLTIP "Print a report" ;
PROMPT  "Print a report"

DEFINE TBSEPARATOR OF oToolBar
     
DEFINE TBBUTTON OF oToolBar ;
ACTION  MsgInfo( "Upgrade" ) ;
TOOLTIP "Search for new versions" ;
PROMPT  "Upgrade"
     
DEFINE TBBUTTON OF oToolBar ;
ACTION MsgInfo( "Users" ) ;
TOOLTIP "Users management" ;
PROMPT "Users"  

DEFINE TBSEPARATOR OF oToolBar

DEFINE TBBUTTON OF oToolBar ;
ACTION  oWnd:End() ;
TOOLTIP "End Application" ;
PROMPT  "Exit"

DEFINE STATUSBAR OF oWnd PROMPT "Toolbars test"

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT WND_BRUSH( 2, .T., 16443068, 10899511, 0.1, , )

oFont:End()
oTBrush:End()
oImageList:End()

return nil

// -------------------

function BuildMenu()
local oMenu

MENU oMenu
      MENUITEM "&Project"
      MENU
         MENUITEM "&New..." ACTION MsgInfo( "New" ) MESSAGE "New"
         MENUITEM "&Open..." ACTION MsgInfo( "Open" ) MESSAGE "Open"
         SEPARATOR
         MENUITEM "&Exit..." ACTION MsgInfo( "End" ) MESSAGE "Exit"
      ENDMENU

      MENUITEM "&Edit"
      MENU
         MENUITEM "&Search..." ACTION MsgInfo( "Search" )
         MENUITEM "&Print..." ACTION MsgInfo( "Print" )
      ENDMENU

      MENUITEM "&Utilities"
      MENU
         MENUITEM "&Disable button..." ACTION oToolBar:EnableButton( 3, .f. )
         MENUITEM "&Enable button..." ACTION oToolBar:EnableButton( 3, .t. )
      ENDMENU
ENDMENU

return oMenu

// -----------

function BuildPopup()
local oMenu
   
MENU oMenu POPUP
      MENUITEM "One"   ACTION MsgInfo( "One" )
      MENUITEM "Two"   ACTION MsgInfo( "Two" )
      MENUITEM "Three" ACTION MsgInfo( "Three" )
ENDMENU
   
return oMenu      

procedure AppSys // XBase++ requirement

return

// ---------------------------------------

FUNCTION WND_BRUSH( nPos, lDirect1, nColor1a, nColor1b, nMove1, cBrush1, cImage1)
LOCAL hDC, oWnd, oBrush, hBmp, hBmpOld , nWidth , nHeight, aRect

IF nPos = 1
    DEFINE BRUSH oBrush COLOR nColor1a
    WndMain():oWndClient:SetBrush( oBrush )
ENDIF
IF nPos = 2
    aColors1    := { { nMove1, nColor1a, nColor1b }, { nMove1, nColor1b, nColor1a } }   
    GradientFill( WndMain():oWndClient:GetDC(), 0, 0, WndMain():nHeight(), WndMain():nWidth(), aColors1, lDirect1 )
ENDIF
IF nPos = 5 // transparent Brush
    aColors1    := { { nMove1, nColor1a, nColor1b }, { nMove1, nColor1b, nColor1a } }   
    oWnd := oWndMain:oWndClient
    aRect := GetClientRect( oWnd:hWnd )
    nHeight := If( lDirect1, aRect[ 3 ] - aRect[ 1 ], 1 )
    nWidth := if( lDirect1, 1, aRect[ 4 ] - aRect[ 2 ] )
    hDC1 := CreateCompatibleDC( oWnd:GetDC() )
    hBmp := CreateCompatibleBitMap( oWnd:hDC, nWidth, nHeight )
    BmpOld := SelectObject( hDC1, hBmp )
    GradientFill( hDC1, 0, 0, nHeight, nWidth, aColors1, lDirect1 )
    DeleteObject( oWnd:oBrush:hBrush )
    oBrush := TBrush():New( ,,,, hBmp )
    oBrush:Cargo  := aColors1
    SelectObject( hDC1, hBmpOld )
    oWnd:ReleaseDC()
    oWndBtn:SetBrush( oBrush )
    oWnd:SetBrush( oBrush )
    AEval( oWnd:aWnd, { |o| o:Refresh() } )
ENDIF
IF nPos = 3
    DEFINE BRUSH oBrush FILENAME cBrush
    WndMain():oWndClient:SetBrush( oBrush )
ENDIF
IF nPos = 4
    DEFINE IMAGE oTmp FILENAME cImage1
    oBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, oWndMain:nWidth(), oWndMain:nHeight(), .T. ) )
    WndMain():oWndClient:SetBrush( oBrush )
    oTmp:End()
ENDIF   

RETURN NIL
 


Best Regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: TestTitl.prg Sample MDI

Postby ukoenig » Wed Feb 29, 2012 1:28 pm

Rick,

another Test ( all Combinations )
using brushed Groups and different TTitles on a Toolbar.

Image

Code: Select all  Expand view  RUN

#include "FiveWin.ch"
#include "ttitle.ch"

static oToolBar

function Main()
local oWnd, oImageList, oRadio1, oSay1, oFont
LOCAL nSWidth := GetSysMetrics(0), nSHeight := GetSysMetrics(1)
LOCAL oInfo, oGroup1, oGroup2, oTBrush

oFont  := TFont():New("Arial",,-16,.F.,.T. ,,,,.F. )

DEFINE WINDOW oWnd TITLE "FWH - Testing Win32 Toolbars" ;
MENU BuildMenu() MDI

DEFINE TOOLBAR oToolBar OF oWnd SIZE 50, 100 // Width , Height

nBtBrush := 2

IF nBtBrush = 1
    DEFINE BRUSH oTBrush COLOR 16443068
ENDIF
IF nBtBrush = 2
    aGrad := { { 0.1, 16443068, 10899511 }, { 0.1, 10899511, 16443068 } }
    hDC = CreateCompatibleDC( oToolbar:GetDC() )
    hBmp = CreateCompatibleBitMap( oToolbar:hDC, oToolbar:nWidth, oToolbar:nHeight )
    hBmpOld = SelectObject( hDC, hBmp )
    GradientFill( hDC, 0, 0, oToolbar:nHeight, oToolbar:nWidth, aGrad, .T. )
    oTBrush := TBrush():New( ,,,, hBmp )
    oTBrush:Cargo  := aGrad
    SelectObject( hDC, hBmpOld )
    ReleaseDC(hDC)
ENDIF
IF nBtBrush = 3
    DEFINE BRUSH oTBrush FILENAME ".\bitmaps\blustone.bmp"
ENDIF
IF nBtBrush = 4
    DEFINE IMAGE oTmp FILENAME ".\bitmaps\olga.jpg"
    oTBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, oToolbar:nWidth,  oToolbar:nHeight, .T. ) )
    oTmp:End()
ENDIF

oToolbar:oBrush := oTBrush

@  0, 0 TITLE oInfo SIZE 300, 105 OF oToolBar NOBORDER  SHADOWSIZE 0
oInfo:aGrdBack := { { 0.1, 16777215,  12171775 },{ 0.1,  12171775, 16777215 } }
@  10, 10 TITLEIMG OF oInfo BITMAP ".\bitmaps\preview.bmp"  SIZE 50, 50 REFLEX TRANSPARENT ANIMA LEVEL 255
@  12,  100  TITLETEXT OF oInfo TEXT "Our Company ...."  FONT oFont COLOR 128  
@  40,  100  TITLETEXT OF oInfo TEXT "1. Infotext ...."  FONT oFont COLOR 0  
@  68,  100  TITLETEXT OF oInfo TEXT "2. Infotext ...."  FONT oFont COLOR 0  

// --------------

@  0, 300 TITLE oGroup1 SIZE 300, 105 OF oToolBar NOBORDER  SHADOWSIZE 0
oGroup1:aGrdBack := {}
DEFINE BRUSH oTBrush  FILENAME ".\bitmaps\marble.bmp"
SET BRUSH OF oGroup1 TO oTBrush
RELEASE BRUSH oTBrush

@ 15, 20 BTNBMP oBtn1 OF oGroup1 ;
SIZE 100, 70 PIXEL ;  // Width, Hight
NOBORDER ;
PROMPT " Button &1" ;
FILENAME ".\bitmaps\Info.bmp" ;
ACTION MsgAlert( "Button 1", "ACTION") ;
FONT oFont ;
TOP
oBtn1:lTransparent := .t.  
oBtn1:cToolTip =  { "Test" + CRLF + "Button 1","BUTTON", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 0, )

@ 15, 120 BTNBMP oBtn1 OF oGroup1 ;
SIZE 100, 70 PIXEL ;  // Width, Hight
NOBORDER ;
PROMPT " &Exit" ;
FILENAME ".\bitmaps\Exit.bmp" ;
ACTION oWnd:End() ;
FONT oFont ;
TOP
oBtn1:lTransparent := .t.  
oBtn1:cToolTip =  { "Exit " + CRLF + "Codetester","EXIT", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 0, )

// --------------

@  0, 600 TITLE oGroup2 SIZE 300, 105 OF oToolBar NOBORDER  SHADOWSIZE 0
oGroup2:aGrdBack := {}
DEFINE BRUSH oTBrush  FILENAME ".\bitmaps\stone.bmp"
SET BRUSH OF oGroup2 TO oTBrush
RELEASE BRUSH oTBrush
DEFINE STATUSBAR OF oWnd PROMPT "Toolbars test"

nRadio1 := 1
@ 8, 50 RADIO oRadio1 VAR nRadio1 OF oGroup2 ;
ITEMS "&One", "&Two", "T&hree" _3D SIZE  100, 20 PIXEL ;
HELPID 100, 101, 102 ;
ON CHANGE MsgBeep()
AEval( oRadio1:aItems, { | oRad | oRad:lTransparent := .T., ;
                                                       oRad:SetFont ( oFont ), ;
                                                      oRad:nClrText := 128 } )

@ 70, 50 SAY oSay1 PROMPT "Transparent Text-test"  OF oGroup2 PIXEL ;
FONT oFont ;
SIZE 200, 20 COLOR 128
oSay1:lTransparent := .T.

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT WND_BRUSH( 2, .T., 16443068, 10899511, 0.1, , )

oFont:End()

RETURN NIL

// ----------------------

FUNCTION SHOWINFO()

RETURN NIL
 


Best Regards
Uwe :idea:
Last edited by ukoenig on Wed Feb 29, 2012 1:59 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: TestTitl.prg Sample MDI

Postby Rick Lipkin » Wed Feb 29, 2012 1:50 pm

Uwe

Thank you for your continued help .. the text is transparent but the Icons are not. I used the first 3 known good alpha bitmaps that I have used in the buttonbar class that are known good transparent icons.

I verified last night I get the same results on Xp as I do W7.

Rick

Image
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TestTitl.prg Sample MDI

Postby ukoenig » Wed Feb 29, 2012 2:04 pm

Rick,

maybe the FWH-release You are using ( could be Changes in Class Toolbar ) ?
You can try, if it works with embedded TTitles ( will give You more Options ) ?

Testing BtnBmp on Toolbar :

Image

@ 15, 900 BTNBMP oBtn3 OF oToolBar ;
SIZE 100, 70 PIXEL ; // Width, Hight
NOBORDER ;
PROMPT " &Exit" ;
FILENAME ".\bitmaps\Exit.bmp" ;
ACTION oWnd:End() ;
FONT oFont ;
TOP
oBtn3:lTransparent := .t.
oBtn3:cToolTip = { "Exit " + CRLF + "Toolbar-test","EXIT", 1, CLR_BLACK, 14089979 }
oBtn3:SetColor( 0, )


Best Regards
Uwe :?:
Last edited by ukoenig on Wed Feb 29, 2012 2:41 pm, edited 4 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: TestTitl.prg Sample MDI

Postby Rick Lipkin » Wed Feb 29, 2012 2:35 pm

Uwe

I am using the latest version of FWH 1201 .. your last test with Vtitle and the Animation works with MDI.

I have no clue why the toolbar class is not showing up with transparent icons like yours :(

Thanks
Rick

Image
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: TestTitl.prg Sample MDI

Postby ukoenig » Wed Feb 29, 2012 2:40 pm

Rick,

try adding a BtnBmp to the Toolbar ( see my Screenshot )
lets see what happens.
Maybe something with
DEFINE IMGBITMAP OF oImageList NAME "new" COLOR nRGB( 255, 0, 255 )

@ 15, 900 BTNBMP oBtn5 OF oToolBar ;
SIZE 100, 55 PIXEL ; // Width, Hight
NOBORDER ;
PROMPT " &Exit" ;
FILENAME ".\bitmaps\Exit.bmp" ;
ACTION oWnd:End() ;
FONT oFont1 ;
TOP
oBtn5:lTransparent := .t.
oBtn5:cToolTip = { "Exit " + CRLF + "Toolbar-test","EXIT", 1, CLR_BLACK, 14089979 }
oBtn5:SetColor( 128, )

Image

// Base
@ 0, 0 TITLE oInfo SIZE 300, 105 OF oToolBar TRANSPARENT NOBORDER BASE
oInfo:aGrdBase := { { 0.1, 16777215, 12171775 },{ 0.1, 12171775, 16777215 } }

// @ 0, 0 TITLE oInfo SIZE 300, 105 OF oToolBar NOBORDER SHADOWSIZE 0
// oInfo:aGrdBack := { { 0.1, 16777215, 12171775 },{ 0.1, 12171775, 16777215 } }

@ 10, 10 TITLEIMG OF oInfo BITMAP ".\bitmaps\preview.bmp" SIZE 50, 50 REFLEX TRANSPARENT ANIMA LEVEL 255

// Base
@ 15, 100 TITLETEXT OF oInfo TEXT "Our Company ...." FONT oFont COLOR 65535
@ 55, 100 TITLETEXT OF oInfo TEXT "1. Infotext ...." FONT oFont COLOR 0
@ 80, 100 TITLETEXT OF oInfo TEXT "2. Infotext ...." FONT oFont COLOR 0

//@ 12, 100 TITLETEXT OF oInfo TEXT "Our Company ...." FONT oFont COLOR 128
//@ 40, 100 TITLETEXT OF oInfo TEXT "1. Infotext ...." FONT oFont COLOR 0
//@ 68, 100 TITLETEXT OF oInfo TEXT "2. Infotext ...." FONT oFont COLOR 0


I got it working, using different Gradients to define Groups :
I had to do some more Tests, because it is not possible to use the build in :
oTitle:aGrdBack := { { 0.1, 16777215, 12171775 },{ 0.1, 12171775, 16777215 } }

Image

Best Regards
Uwe
Last edited by ukoenig on Fri Mar 02, 2012 1:26 am, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 103 guests