xBrowse images ( JPG, PNG, BMP, ... )

xBrowse images ( JPG, PNG, BMP, ... )

Postby Daniel Garcia-Gil » Wed Mar 25, 2009 4:19 am

Hello...
i comeback with new change to xbrowse, i will wait for suggestions and opinions
it 's a prototipe, i do not show code yet

we can show images on cell without added array, no need methods
METHOD AddResource( cRes )
METHOD AddBmpFile( cFile )
METHOD AddBmpHandle( hBmp )

New DATA bStrImage // String data codeblock (returns a string with imagen name)
New nEditType
#define TYPE_IMAGE -1
we can select the image in 2 ways using the bStrImage data or putting the image name in the cell, this cell in not editable, only show image

it is a sample
The first column contains the Image, do click rigth button mouse open a popmenu, the second column we can select image with cGetFile()

http://www.sitasoft.com/fivewin/test/xbimg.rar

Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"

REQUEST DBFCDX

static hLib

function main()

   local oDlg
   local oBrw
   local nI
   local hBitMap1, hBitMap2, hBitMap3, hBitMap4
   local aArray:={}
   
   for nI = 1 to 5
      aadd( aArray, { "", space( 255 ) } )
   next


   DEFINE DIALOG oDlg title "TEST" size 800,600

   @ 0,0 XBROWSE oBrw OF oDlg columns {1,2};
      Array aArray sizes {100,300} LINES CELL autocols

   oBrw:nMarqueeStyle              := 1
   oBrw:nRowHeight                 := 33
   oBrw:lAdjustLastCol             := .t.
       
   oBrw:aCols[ 1 ]:nEditType       := TYPE_IMAGE
   oBrw:aCols[ 1 ]:lBmpStretch     := .t.
   oBrw:aCols[ 1 ]:lBmpTransparent := .t.
   oBrw:aCols[ 1 ]:bStrImage      := {|oCol, oBrw| oBrw:aRow[ 2 ] }
   oBrw:aCols[ 1 ]:nDataBmpAlign   := AL_CENTER
   oBrw:aCols[ 1 ]:bPopUp          := { |o| ColMenu( o ) }
   
   oBrw:aCols[ 2 ]:nEditType       := EDIT_BUTTON
   oBrw:aCols[ 2 ]:bEditBlock      := {|nRow, nCol, oCol| oCol:Value := cGetFile( "*.*", "Select a file" )  }
   
   oDlg:oClient                    := oBrw
   
   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED ON INIT oDlg:Resize()


return nil

static function ColMenu( ocol )

   local oPop

   MENU oPop POPUP 2007
      MENUITEM "Left Align" WHEN oCol:nDataBmpAlign > 0 ;
         ACTION ( oCol:nDataBmpAlign:= AL_LEFT, oCol:oBrw:Refresh() )
      MENUITEM "Center Align" WHEN oCol:nDataBmpAlign != AL_CENTER ;
         ACTION ( oCol:nDataBmpAlign := AL_CENTER, oCol:oBrw:Refresh() )
      MENUITEM "Right Align" WHEN oCol:nDataBmpAlign != AL_RIGHT ;
         ACTION ( oCol:nDataBmpAlign := AL_RIGHT , oCol:oBrw:Refresh() )

      MenuAddItem( "Transparent", ,oCol:lBmpTransparent, .t., ;
         { |oItem| oCol:lBmpTransparent := !oCol:lBmpTransparent, ;
            oItem:SetCheck( oCol:lBmpTransparent ), ;
            oCol:oBrw:refresh() } )

      MenuAddItem( "Stretch", ,oCol:lBmpStretch, .t., ;
         { |oItem| oCol:lBmpStretch := !oCol:lBmpStretch, ;
            oItem:SetCheck( oCol:lBmpStretch ), ;
            oCol:oBrw:refresh() } )



   ENDMENU

return oPop

//----------------------------------------------------------------------------//
 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: xBrowse images ( JPG, PNG, BMP, ... )

Postby Otto » Wed Mar 25, 2009 6:47 am

Hello Daniel,
thank you for this nice extensions.
I did some tests.

This is really impressive.
Best regards,
Otto
Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6113
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse images ( JPG, PNG, BMP, ... )

Postby nageswaragunupudi » Wed Mar 25, 2009 6:50 am

Excellant improvement to XBrowse. Hope to get this in 9.03
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 69 guests