Show all bmps

Show all bmps

Postby MdaSolution » 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:oLeft:= 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
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: Show all bmps

Postby nageswaragunupudi » Tue Jan 19, 2010 3:53 pm

Please try this interesting sample;
Code: Select all  Expand view

#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
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Show all bmps

Postby nageswaragunupudi » Tue Jan 19, 2010 4:46 pm

Here is a sample to show all bitmaps with 5 bitmaps in each row, using xbrowse.
Code: Select all  Expand view

#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:
Image
Last edited by nageswaragunupudi on Tue Jan 19, 2010 5:45 pm, edited 4 times in total.
Regards

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

Re: Show all bmps

Postby Silvio » Tue Jan 19, 2010 4: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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Show all bmps

Postby MdaSolution » Tue Jan 19, 2010 5: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
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: Show all bmps

Postby nageswaragunupudi » Tue Jan 19, 2010 5: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
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Show all bmps

Postby nageswaragunupudi » Tue Jan 19, 2010 5: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
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Show all bmps

Postby MdaSolution » Tue Jan 19, 2010 7: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
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: Show all bmps

Postby MdaSolution » Tue Jan 19, 2010 8:06 pm

I try with the first sample
Code: Select all  Expand view
#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
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: Show all bmps

Postby nageswaragunupudi » Tue Jan 19, 2010 8: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
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 46 guests