FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Show all bmps
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Show all bmps
Posted: Tue Jan 19, 2010 11:29 AM
Can I show all bmp are in a folder into a Panel ?
sample



nMargenLeft :=200

DEFINE WINDOW oWndChild MDICHILD of oWnd;
TITLE "New Test" ;
VSCROLL

oPanel := TPanel():New( 0, 0, 1000, nMargenLeft, oWndChild )
oPanel:SetColor(0,RGB(143,172,230))
oWndChild:= oPanel


-> Show all bitmaps

aDir = Directory( "c:\fwh\bitmaps\*.bmp" )
nrow:= 0
nCol:= 0
FOR i = 1 TO LEN( aDir )
@ nrow, nCol BUTTON oBtn[i] File aDir[ i, F_NAME ] SIZE 22, 22 PIXEL OF oPanel
nrow:=+1
NEXT i
...

I wish have five bitmaps for each row...


How I can make it please
FWH .. BC582.. xharbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Show all bmps
Posted: Tue Jan 19, 2010 03:53 PM
Please try this interesting sample;
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "xbrowse.ch"

function main()

   local abmp := {}

   AEval( Directory( 'c:\fwh\bitmaps\*.bmp' ), { |a| AAdd( abmp, 'c:\fwh\bitmaps\' + a[ 1 ] ) } )

   XBROWSER aBmp SETUP oBrw:aCols[ 1 ]:cDataType := 'F'

return nil


We see all bitmaps in the browse. This can be extended to show all bitmaps in any manner we like.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Show all bmps
Posted: Tue Jan 19, 2010 04:46 PM
Here is a sample to show all bitmaps with 5 bitmaps in each row, using xbrowse.
Code (fw): Select all Collapse
#include "FiveWin.Ch"
#include "xbrowse.ch"

function main()
   local cPath := 'c:\fwh\bitmaps\'
   local aDir := Directory( cPath + '*.bmp' )
   local abmp
   local n, r, c
   local oWnd, oBrw, oBar

   aBmp  := Array( Int( Len( aDir ) / 5 ) + 1, 5 )
   r := 1
   c := 1
   for n := 1 to Len( aDir )
      aBmp[ r, c ] := cPath + aDir[ n, 1 ]
      if ++c > 5
         c  := 1
         r++
      endif
   next n
   if c <= 5
      AFill( ATail( aBmp ), '', c )
   endif

   DEFINE WINDOW oWnd
   DEFINE BUTTONBAR oBar OF oWnd 2007
   SET MESSAGE OF oWnd TO '' 2007

   @ 0,0 XBROWSE oBrw SIZE 240,1000 PIXEL OF ownd ;
      AUTOCOLS ARRAY aBmp COLOR CLR_BLACK,RGB( 143, 172, 230 )

   WITH OBJECT oBrw
      :lRecordSelector  := .f.
      :lHeader          := .f.
      :lHScroll         := .f.
      :nRowHeight       := 40
   END
   AEval( oBrw:aCols, { |o| o:cDataType := 'F', o:nWidth := 40 } )

   oBrw:CreateFromCode()
   oWnd:oLeft     := oBrw
   ACTIVATE WINDOW oWnd

return nil


Screen Shot:
Regards



G. N. Rao.

Hyderabad, India
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Show all bmps
Posted: Tue Jan 19, 2010 04:54 PM

Nas ,
nice sample
Do U think we can load also the other format graphics sample png, jpg ....
It can be use for a Ribbon Gallery control

Best Regards, Saludos



Falconi Silvio
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: Show all bmps
Posted: Tue Jan 19, 2010 05:05 PM

Mr Rao,

Itry the test number 1 and number two

they are compiled but I cannot see the bitmaps

I tried to insert my folder of Images ".\images*.bmp" and I cannot see any bmps

there is something of wrong or I not understand How make it

FWH .. BC582.. xharbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Show all bmps
Posted: Tue Jan 19, 2010 05:37 PM
Silvio wrote:Nas ,
nice sample
Do U think we can load also the other format graphics sample png, jpg ....
It can be use for a Ribbon Gallery control

Yes. png, jpg, etc all valid image files.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Show all bmps
Posted: Tue Jan 19, 2010 05:38 PM

>>
I tried to insert my folder of Images ".\images*.bmp" and I cannot see any bmps
>>
Please try giving absolute path. Please make sure the path is properly evaluated.
The sample has to work.

I noticed a small problem in the way the code is shown in the forums.
The last backslash is not displaed.
I wrote 'c:\fwh\bitmaps\'
but it shows as 'c:\fwh\bitmaps'
In your code please make the appropriate changes

Regards



G. N. Rao.

Hyderabad, India
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: Show all bmps
Posted: Tue Jan 19, 2010 07:59 PM
Sorry Mr Rao
I forget the slash "\" now run ok on c:\fwh\bitmaps\ thank you so much

I tried with other folders

I have a folder on the folder of my application called ".\pat\ "
I isert it but it not run
FWH .. BC582.. xharbour
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: Show all bmps
Posted: Tue Jan 19, 2010 08:06 PM
I try with the first sample
Code (fw): Select all Collapse
#include "FiveWin.Ch"
#include "xbrowse.ch"

function main()

   local aDir := Directory( 'C:\FWH\bitmaps\*.bmp' )
   local abmp
   local n, r, c
   local oWnd, oBrw, oBar

   aBmp  := Array( Int( Len( aDir ) / 5 ) + 1, 5 )
   r := 1
   c := 1
   for n := 1 to Len( aDir )
      aBmp[ r, c ] := 'C:\FWH\bitmaps\' + aDir[ n, 1 ]
      if ++c > 5
         c  := 1
         r++
      endif
   next n

   DEFINE WINDOW oWnd
   DEFINE BUTTONBAR oBar OF oWnd 2007
   SET MESSAGE OF oWnd TO '' 2007

   @ 0,0 XBROWSE oBrw SIZE 240,1000 PIXEL OF ownd ;
      AUTOCOLS ARRAY aBmp COLOR CLR_BLACK,RGB( 143, 172, 230 )

   WITH OBJECT oBrw
      :lRecordSelector  := .f.
      :lHeader          := .f.
      :lHScroll         := .f.
      :nRowHeight       := 40
   END
   AEval( oBrw:aCols, { |o| o:cDataType := 'F', o:nWidth := 40 } )

   oBrw:CreateFromCode()
   oWnd:oLeft     := oBrw
   ACTIVATE WINDOW oWnd

   return nil





If I click on scroll button to see the last bmp it make error 9003 "Too Many recoursive handle calls"
FWH .. BC582.. xharbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Show all bmps
Posted: Tue Jan 19, 2010 08:36 PM

i have edited the sample i posted earlier.
please copy the changes i made.
particularly the code after the loop.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion