Show all bmps
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Show all bmps
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 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
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 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
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Show all bmps
Please try this interesting sample;
We see all bitmaps in the browse. This can be extended to show all bitmaps in any manner we like.
Code: Select all
#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
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Show all bmps
Here is a sample to show all bitmaps with 5 bitmaps in each row, using xbrowse.
Screen Shot:
Code: Select all
#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
Last edited by nageswaragunupudi on Tue Jan 19, 2010 5:45 pm, edited 4 times in total.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Show all bmps
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
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
Falconi Silvio
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: Show all bmps
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
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
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Show all bmps
Yes. png, jpg, etc all valid image files.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
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Show all bmps
>>
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
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
G. N. Rao.
Hyderabad, India
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: Show all bmps
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
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
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: Show all bmps
I try with the first sample
If I click on scroll button to see the last bmp it make error 9003 "Too Many recoursive handle calls"
Code: Select all
#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
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Show all bmps
i have edited the sample i posted earlier.
please copy the changes i made.
particularly the code after the loop.
please copy the changes i made.
particularly the code after the loop.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India