FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Ribbon Gallery
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Ribbon Gallery
Posted: Tue Jan 19, 2010 08:30 PM
Fantastic !!!!
Thanks to Rao Nages and DAniel we have a Ribbon Gallery

Code (fw): Select all Collapse
#include "fivewin.ch"
#include "ribbon.ch"
#include "xbrowse.ch"


 // TEST  RIBBON GALLERY




function main()
   local oRBar
   local oWnd, oMenu, oBrw
   local oGr, oGr1



DEFINE WINDOW oWnd from 1,1 to 400,600 pixel MDI


   menu oMenu Popup

      menuitem "Test1"
      menuitem "Test2"
      menuitem "Test3"

   endmenu

   DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "test", "test"

   ADD GROUP oGr RIBBON oRBar TO OPTION 1 PROMPT "Ribbon Gallery" width 150

    Ribbon_gallery( oGr,'C:\FWH\bitmaps\*.bmp','C:\FWH\bitmaps\',oGr:nWidth -5,oGr:nHeight - oGr:nHeight/7 - 2)


   ACTIVATE WINDOW oWnd  MAXIMIZED

   return nil



 Function  Ribbon_gallery( oGroup,cfiles,cCarpeta ,SizeHeight,SizeWidth)
   local aDir := Directory(cfiles )
   local abmp
   local n, r, c,oBrw
   aBmp  := Array( Int( Len( aDir ) / 5 ) + 1, 5 )
   r := 1
   c := 1
   for n := 1 to Len( aDir )
      aBmp[ r, c ] := cCarpeta + aDir[ n, 1 ]
      if ++c > 5
         c  := 1
         r++
      endif
   next n

    @ 0,0 XBROWSE oBrw  of oGroup size  SizeHeight,SizeWidth  pixel ;
      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()

  RETURN NIL








the code run ok
but sometimes there is this error

Code (fw): Select all Collapse
pplication
===========
   Path and name: C:\work\errori\test_gal\test2.Exe (32 bits)
   Size: 1,919,488 bytes
   Time from start: 0 hours 0 mins 17 secs 
   Error occurred at: 01/19/10, 21:29:24
   Error description: Error BASE/1111  Argument error: LEN
   Args:
     [   1] = U   

Stack Calls
===========
   Called from:  => LEN(0)
   Called from: .\source\classes\IMAGE.PRG => FILOADFROMMEMORY(232)
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA(8627)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT(1333)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY(990)
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1439)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(10158)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3347)
   Called from:  => DIALOGBOXINDIRECT(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
   Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG(343)
   Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS(27)
   Called from:  => LEN(0)
   Called from: .\source\classes\IMAGE.PRG => FILOADFROMMEMORY(232)
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA(8627)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT(1333)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY(990)
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1439)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(10158)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3347)
   Called from:  => DIALOGBOXINDIRECT(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
   Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG(343)
   Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS(27)
   Called from:  => LEN(0)
   Called from: .\source\classes\IMAGE.PRG => FILOADFROMMEMORY(232)
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA(8627)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT(1333)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY(990)
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1439)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(10158)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3347)
   Called from:  => WINRUN(0)
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(966)
   Called from: test2.prg => MAIN(36)
Best Regards, Saludos



Falconi Silvio
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Ribbon Gallery
Posted: Tue Jan 19, 2010 08:37 PM

please modify according the edited sample i posted in the other posting

Regards



G. N. Rao.

Hyderabad, India
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Ribbon Gallery
Posted: Tue Jan 19, 2010 08:38 PM

yes I saw it NOW
thanksssss

Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Ribbon Gallery
Posted: Tue Jan 19, 2010 08:39 PM
Now Run OK

Code (fw): Select all Collapse
#include "fivewin.ch"
#include "ribbon.ch"
#include "xbrowse.ch"


 // TEST  RIBBON GALLERY




function main()
   local oRBar
   local oWnd, oMenu, oBrw
   local oGr, oGr1



DEFINE WINDOW oWnd from 1,1 to 400,600 pixel MDI


   menu oMenu Popup

      menuitem "Test1"
      menuitem "Test2"
      menuitem "Test3"

   endmenu

   DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "test", "test"

   ADD GROUP oGr RIBBON oRBar TO OPTION 1 PROMPT "Ribbon Gallery" width 150

    Ribbon_gallery( oGr,'C:\FWH\bitmaps\*.bmp','C:\FWH\bitmaps',oGr:nWidth -5,oGr:nHeight - oGr:nHeight/7 - 2)


   ACTIVATE WINDOW oWnd  MAXIMIZED

   return nil



 Function  Ribbon_gallery( oGroup,cfiles,cCarpeta ,SizeHeight,SizeWidth)
   local aDir := Directory(cfiles )
   local abmp
   local n, r, c,oBrw
   aBmp  := Array( Int( Len( aDir ) / 5 ) + 1, 5 )
   r := 1
   c := 1
   for n := 1 to Len( aDir )
      aBmp[ r, c ] := cCarpeta+"\" + aDir[ n, 1 ]
      if ++c > 5
         c  := 1
         r++
      endif
   next n
     if c <= 5
      AFill( ATail( aBmp ), '', c )
   endif

    @ 0,0 XBROWSE oBrw  of oGroup size  SizeHeight,SizeWidth  pixel ;
      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()

  RETURN NIL
Best Regards, Saludos



Falconi Silvio
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Ribbon Gallery
Posted: Tue Jan 19, 2010 08:40 PM

good

Regards



G. N. Rao.

Hyderabad, India
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Ribbon Gallery
Posted: Tue Jan 19, 2010 11:33 PM
Nages,
I found a strange error
If I create 4 group of a ribbonbar and load 4 different folder run only the first : strange

look this pleease

Code (fw): Select all Collapse
#include "fivewin.ch"
#include "ribbon.ch"
#include "xbrowse.ch"


 // TEST  RIBBON GALLERY




function main()
   local oRBar
   local oWnd, oMenu
   local oGr, oGr1,oGr2,oGr3
   local olbx1,olbx2,olbx3,olbx4


DEFINE WINDOW oWnd from 1,1 to 400,600 pixel MDI


   menu oMenu Popup

      menuitem "Test1"
      menuitem "Test2"
      menuitem "Test3"

   endmenu

   DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "test","Simbols"

     ADD GROUP oGr RIBBON oRBar TO OPTION 2 PROMPT "test1" width 250
     Ribbon_gallery( oGr,'\test1\*.bmp','\test1',oGr:nWidth -5,oGr:nHeight - oGr:nHeight/7 - 2,olbx1,5,40)

     ADD GROUP oGr1 RIBBON oRBar TO OPTION 2 PROMPT "test2" width  250
     Ribbon_gallery( oGr1,'\test2\*.bmp','\test2',oGr1:nWidth -5,oGr1:nHeight - oGr1:nHeight/7 - 2,olbx2,5,40)

     ADD GROUP oGr2 RIBBON oRBar TO OPTION 2 PROMPT "test3" width  250
     Ribbon_gallery( oGr2,'\test3\*.bmp','\test3',oGr2:nWidth -5,oGr2:nHeight - oGr2:nHeight/7 - 2,olbx3,5,40)

     ADD GROUP oGr3 RIBBON oRBar TO OPTION 2 PROMPT "test4" width  250
     Ribbon_gallery( oGr3,'\test4\*.bmp','\test4',oGr3:nWidth -5,oGr3:nHeight - oGr3:nHeight/7 - 2,olbx4,5,40)

   ACTIVATE WINDOW oWnd  MAXIMIZED

   return nil



Function  Ribbon_gallery( oGroup,cfiles,cCarpeta ,SizeHeight,SizeWidth,oBrw,numxrow,nRowHeight)

    /*
   oGroup                   group of ribbon
   cfiles                   files to open
   cCarpeta                 folder where are the files
   SizeHeight,SizeWidth     sizes
   oBrw                     Xbrowse object
   numxrow                  numbers of bitmaps for row
   nRowHeight               height of rows of xbrowse
   */


   local aDir := Directory(cfiles )
   local abmp
   local n, r, c
   aBmp  := Array( Int( Len( aDir ) / numxrow ) + 1, numxrow )
   r := 1
   c := 1
   for n := 1 to Len( aDir )
      aBmp[ r, c ] := cCarpeta+"\" + aDir[ n, 1 ]
      if ++c > numxrow
         c  := 1
         r++
      endif
   next n
     if c <= numxrow
      AFill( ATail( aBmp ), '', c )
   endif
    @ 0,0 XBROWSE oBrw  of oGroup size  SizeHeight,SizeWidth  pixel ;
      AUTOCOLS ARRAY aBmp COLOR CLR_BLACK,RGB( 143, 172, 230 )
    WITH OBJECT oBrw
      :lRecordSelector  := .f.
      :lHeader          := .f.
      :lHScroll         := .f.
      :nRowHeight       := nRowHeight
   END
   AEval( oBrw:aCols, { |o| o:cDataType := 'F', o:nWidth := nRowHeight } )
   oBrw:CreateFromCode()
  RETURN NIL


and I copied some files (only bmp) from c:\fwh\bitmaps\ in each folders ( test1,test2,test3,test4)
Best Regards, Saludos



Falconi Silvio
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Ribbon Gallery
Posted: Wed Jan 20, 2010 12:02 AM
Hello silvio


i don't see any trouble, is fine and very good

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Ribbon Gallery
Posted: Wed Jan 20, 2010 12:32 AM


strange!!!!!!!!!!!!!!

my code
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "ribbon.ch"
#include "xbrowse.ch"


 // TEST  RIBBON GALLERY




function main()
   local oRBar
   local oWnd, oMenu
   local oGr, oGr1,oGr2,oGr3
   local olbx1,olbx2,olbx3,olbx4


DEFINE WINDOW oWnd from 1,1 to 400,600 pixel MDI


   menu oMenu Popup

      menuitem "Test1"
      menuitem "Test2"
      menuitem "Test3"

   endmenu

   DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "test","Simbols"

     ADD GROUP oGr RIBBON oRBar TO OPTION 2 PROMPT "test1" width 250
     Ribbon_gallery( oGr,'\test1\*.bmp','\test1',oGr:nWidth -5,oGr:nHeight - oGr:nHeight/7 - 2,olbx1,5,40)

     ADD GROUP oGr1 RIBBON oRBar TO OPTION 2 PROMPT "test2" width  250
     Ribbon_gallery( oGr1,'\test2\*.bmp','\test2',oGr1:nWidth -5,oGr1:nHeight - oGr1:nHeight/7 - 2,olbx2,5,40)

     ADD GROUP oGr2 RIBBON oRBar TO OPTION 2 PROMPT "test3" width  250
     Ribbon_gallery( oGr2,'\test3\*.bmp','\test3',oGr2:nWidth -5,oGr2:nHeight - oGr2:nHeight/7 - 2,olbx3,5,40)

     ADD GROUP oGr3 RIBBON oRBar TO OPTION 2 PROMPT "test4" width  250
     Ribbon_gallery( oGr3,'\test4\*.bmp','\test4',oGr3:nWidth -5,oGr3:nHeight - oGr3:nHeight/7 - 2,olbx4,5,40)

   ACTIVATE WINDOW oWnd  MAXIMIZED

   return nil



Function  Ribbon_gallery( oGroup,cfiles,cCarpeta ,SizeHeight,SizeWidth,oBrw,numxrow,nRowHeight)

    /*
   oGroup                   group of ribbon
   cfiles                   files to open
   cCarpeta                 folder where are the files
   SizeHeight,SizeWidth     sizes
   oBrw                     Xbrowse object
   numxrow                  numbers of bitmaps for row
   nRowHeight               height of rows of xbrowse
   */


   local aDir := Directory(cfiles )
   local abmp
   local n, r, c
   aBmp  := Array( Int( Len( aDir ) / numxrow ) + 1, numxrow )
   r := 1
   c := 1
   for n := 1 to Len( aDir )
      aBmp[ r, c ] := cCarpeta+"\" + aDir[ n, 1 ]
      if ++c > numxrow
         c  := 1
         r++
      endif
   next n
     if c <= numxrow
      AFill( ATail( aBmp ), '', c )
   endif
    @ 0,0 XBROWSE oBrw  of oGroup size  SizeHeight,SizeWidth  pixel ;
      AUTOCOLS ARRAY aBmp COLOR CLR_BLACK,RGB( 143, 172, 230 )
    WITH OBJECT oBrw
      :lRecordSelector  := .f.
      :lHeader          := .f.
      :lHScroll         := .f.
      :nRowHeight       := nRowHeight
   END
   AEval( oBrw:aCols, { |o| o:cDataType := 'F', o:nWidth := nRowHeight } )
   oBrw:CreateFromCode()
  RETURN NIL
Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Ribbon Gallery
Posted: Wed Jan 20, 2010 12:39 AM

perhaps I found the error

I forget the "." near to "\"
sorry

Best Regards, Saludos



Falconi Silvio

Continue the discussion