xBrowse-background can be stretched ? => SOLVED

xBrowse-background can be stretched ? => SOLVED

Postby ukoenig » Tue Dec 02, 2008 8:17 pm

Hello,

some month ago, we have been talking about xBrowse-backgrounds.
xBrowse shows the used bitmaps TILED.

Is this problem solved in the new FWH-release ?

Regards
Uwe :lol:
Last edited by ukoenig on Wed Dec 10, 2008 11:13 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

Postby Silvio » Tue Dec 02, 2008 10:54 pm

with sbrowse 6 we can
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Daniel Garcia-Gil » Thu Dec 04, 2008 6:23 am

ukoenig...

i did a little trick...

modify xbrowse class

1-. put in define place..
Code: Select all  Expand view
#define SRCCOPY      0x00CC0020


2-. put at end_of_file but before #pragma BEGINDUMP
Code: Select all  Expand view
DLL32 FUNCTION CreateCompatibleBitmap( hDC AS LONG, nWidth AS LONG, nHeight AS LONG ) AS LONG ;
      PASCAL FROM "CreateCompatibleBitmap" LIB "gdi32.dll"


3.- 2 new data
Code: Select all  Expand view
DATA cBmpAdjBrush     // BMP file/resource
DATA lBrushed      AS LOGICAL INIT .F. // used internally for check brush


4.- and last step... the trick!
method paint put after variable declare this line
Code: Select all  Expand view
local hBmpDC, hDCComp, hOldBitMap, hBmp, hBmpNew

if ::cBmpAdjBrush != NIL .and. !::lBrushed
  ::lBrushed := .t.   
  ::lTransparent := .t.    
  if valtype( ::cBmpAdjBrush ) == "C"
    if '.' $ ::cBmpAdjBrush
      if upper( right( ::cBmpAdjBrush, 3 ) ) == "BMP"
        if file( ::cBmpAdjBrush )
          hBmp := ReadBitmap( 0, ::cBmpAdjBrush )
        else
          msgstop( "File " + ::cBmpAdjBrush + " not Found","Fivewin: Class TXBrowse" )
          return( 0 )
        endif
      else
        msgstop( "Bad BMP File format","Fivewin: Class TXBrowse" )
        return( 0 )
      endif
    else
      if ( hBmp := LoadBitmap( GetResources(), ::cBmpAdjBrush ) ) == 0
        msgstop( "Resource " + ::cBmpAdjBrush + " No Found", "Fivewin: Class TXBrowse" )
        return( 0 )
      endif
    endif
  else
    msgstop( "Only BMP File or Resource","Fivewin: Class TXBrowse" )
    return( 0 )
  endif
  PalBmpDraw( ::hDC, 0, 0, hBmp,, (::nRight - ::nLeft), ( ::nBottom - ::nTop ) )
  ::lBrushed    := .t.
  hDCComp       := CreateCDC( ::hDC )
  hBmpNew         := CreateCompatibleBitMap( ::hDC, ::oWnd:nWidth, ::oWnd:nHeight )
  holdBitMap    := selectobject( hdccomp, hBmpNew )
  BitBlt( hDCComp, 0, 0, ::oWnd:nWidth, ::oWnd:nHeight, ::hDC, 0, 0, SRCCOPY )
  selectobject( hBmpNew, hOldBitMap )
  ::lTransparent := .t.
  ::Refresh()
  ::oBrush:hBrush:=CreatePatternBrush( hBmpNew )
  DeleteObject( hBmp )
endif



example
oBrw:cBmpAdjBrush := "C:\FWH\BITMAPS\back.bmp"
oBrw:SetBackGround("C:\FWH\BITMAPS\back.bmp" )

always write both lines oBrw:cBmpAdjBrush and oBrw:SetBackGround() remember you can use resources too
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Postby Silvio » Thu Dec 04, 2008 9:07 am

Application
===========
Path and name: C:\work\LIB_32\xbrowse\xbrowse.Exe (32 bits)
Size: 1,641,472 bytes
Time from start: 0 hours 0 mins 21 secs
Error occurred at: 12/04/08, 10:08:26
Error description: Error BASE/1004 Message not found: TXBROWSE:SETBACKGROUND

Stack Calls
===========
Called from: tobject.prg => TXBROWSE:ERROR(172)
Called from: tobject.prg => TXBROWSE:MSGNOTFOUND(205)
Called from: tobject.prg => TXBROWSE:SETBACKGROUND(0)
Called from: testxbr2.prg => AUTOEDIT(66)
Called from: testxbr2.prg => (b)BUILDMENU(39)
Called from: MENU.PRG => TMENU:COMMAND(0)
Called from: WINDOW.PRG => TWINDOW:COMMAND(0)
Called from: MDIFRAME.PRG => TMDIFRAME:COMMAND(0)
Called from: => TMDIFRAME:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: testxbr2.prg => MAIN(24)
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Silvio » Thu Dec 04, 2008 9:13 am

Image


I 'm using only
oBrw:cBmpAdjBrush :="BACK.bmp"
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

New Function ?

Postby ukoenig » Thu Dec 04, 2008 10:07 am

Hello Silvio,

I think, < oLbx:cBmpAdjBrush > is added ( new ) in FWH-version 8.10
I work with FWH 8.09 and get a error ?

oLbx:cBmpAdjBrush :="BLUESTONE.bmp"

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

Postby Daniel Garcia-Gil » Thu Dec 04, 2008 2:46 pm

if you use oBrw:cBmpAdjBrush :="BACK.bmp" without oBrw:SetBackGround() i think will have trouble with paint...
please, stay alert with it
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

New => cBmpAdjBrush ?

Postby ukoenig » Thu Dec 04, 2008 7:21 pm

Hello,

It is a compile-error not function-error.
< cBmpAdjBrush > doesn't exist.

oLbx:cBmpAdjBrush

I think it is new.

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

Postby Daniel Garcia-Gil » Thu Dec 04, 2008 7:28 pm

yes is new data, made for me... you need modify class txbroswe
please review my post
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Stretch BMP to xBrowse Data-area

Postby ukoenig » Thu Dec 04, 2008 8:54 pm

Hello,

I added the lines to xBrowse.prg. The compile runs without error.

With the extra lines :
oLbx1:cBmpAdjBrush := "view.bmp"
oLbx1:SetBackGround("view.bmp" )
I get a black background inside the browser.

I tested without < oLbx1:SetBackGround >.
The BMP-background is shown, but not adjusted to the
Data-area of the browser.

I changed Your line :

* PalBmpDraw( ::hDC, 0, 0, hBmp,, (::nRight - ::nLeft), ( ::nBottom - ::nTop ) )

in :

PalBmpDraw( ::hDC, 0, 0, hBmp,, ::BrwWidth(), ::BrwHeight() )

That works perfect now !
If You change this, the BMP is adjusted to the xbrowse data-area.

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

Postby Daniel Garcia-Gil » Thu Dec 04, 2008 9:41 pm

thank a lot... little detail
the idea is good... i happy it work for you.... i did burn my brain :wink:

change too...
hBmpNew := CreateCompatibleBitMap( ::hDC, ::BrwWidth(), ::BrwHeight() )
BitBlt( hDCComp, 0, 0, ::BrwWidth(),::BrwHeight(), ::hDC, 0, 0, SRCCOPY )
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

xBrowse-background

Postby ukoenig » Thu Dec 04, 2008 9:58 pm

Hello MC,

Thanks a lot.

The Testfiles : EXE, RC, TESTFOLDER.prg
http://www.pflegeplus.com/fw_downloads/testbrowse.zip

A sample :

Image

Like You can see, the balls are adjusted to the browser.

Another sample :
I used the Background-tools, created a gradient and saved it as bitmap.

Image

Now it is very simple :

Adjusted background :
oLbx1:cBmpAdjBrush := "3D.bmp" // It is 24-Bit

Tiled Background :
oLbx1:SetBackGround("view.bmp" )

A small thing I noticed after some tests :

Two Browsers in Folder-page 1
oLbx1:cBmpAdjBrush := "Gradient1.bmp"
oLbx2:cBmpAdjBrush := "3Dball.bmp"
oLbx1 shows < 3Dball.bmp > background as well.

Inside the second folder-page
oLbx3:cBmpAdjBrush := "Gradient1.bmp"

I open the dialog.
Folder-page one shows < 3Dball.bmp >
I change to folder-page 2
The browser shows < Gradient1.bmp >

Going back to folder-page 1
oLbx1 and oLbx2 changed from < 3Dball.bmp > to < Gradient1.bmp >
It seems, allways the last selected BMP is activated.

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

Bitmap-size

Postby ukoenig » Fri Dec 05, 2008 6:07 pm

Hello Daniel,
A fine adjustment, to fit the bitmap to the xbrowse-data-area.
( Adjustment to the record-selector-width, header and footer )
I noticed it, because the ball wasn't centered.

Complete adjustment :
Image

Code: Select all  Expand view
PalBmpDraw(::hDC,::HeaderHeight(),RECORDSELECTOR_WIDTH, hBmp,, ;
::BrwWidth()- RECORDSELECTOR_WIDTH,::BrwHeight() -::FooterHeight() )
::lBrushed := .t.
hDCComp := CreateCDC(::hDC )
hBmpNew := CreateCompatibleBitMap(::hDC,::BrwWidth(),::BrwHeight()-::FooterHeight())
holdBitMap := selectobject(hdccomp,hBmpNew)
BitBlt( hDCComp,::HeaderHeight(),RECORDSELECTOR_WIDTH,::BrwWidth(), ;
::BrwHeight(),::hDC,::HeaderHeight(),RECORDSELECTOR_WIDTH, SRCCOPY )


Regards
Uwe :lol:
Last edited by ukoenig on Fri Dec 05, 2008 7:20 pm, edited 6 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

Postby Daniel Garcia-Gil » Fri Dec 05, 2008 6:16 pm

good idea...
for more easy reader dont use "25" use RECORDSELECTOR_WIDTH
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Adjustment

Postby ukoenig » Fri Dec 05, 2008 6:48 pm

Hello Daniel,
some more adjustments.

Code: Select all  Expand view
PalBmpDraw(::hDC,::HeaderHeight(),RECORDSELECTOR_WIDTH, hBmp,, ;
::BrwWidth()- RECORDSELECTOR_WIDTH,::BrwHeight() -::FooterHeight() )
::lBrushed := .t.
hDCComp := CreateCDC(::hDC )
hBmpNew := CreateCompatibleBitMap(::hDC,::BrwWidth(),::BrwHeight()-::FooterHeight())
holdBitMap := selectobject(hdccomp,hBmpNew)
BitBlt( hDCComp,::HeaderHeight(),RECORDSELECTOR_WIDTH,::BrwWidth(), ;
::BrwHeight(),::hDC,::HeaderHeight(),RECORDSELECTOR_WIDTH, SRCCOPY )


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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 24 guests