SetArray xBrowser

SetArray xBrowser

Postby oliveiros junior » Tue Dec 12, 2023 3:16 pm

Mr Rao,

I need to do a search in a Browser like the xBrimag3.prg example, but built with Array. When searching the database, I build a new array, and then empty the array - oBrowser:aArrayData := {}, try to reload the array by giving a SetArray - oBrowser:SetArray( aArray ), and then renew obrowser - oBrowser: Refresh(). However, it does not completely renew the browser. The texts are renewed, but not the images.

To give a better example, what is happening is the following:

I have a browser with 3 columns and 20 lines. Each line has an image and below the image description. When I do a search to look for an element that only occurs once in the browser, it returns the description of that element in the first line and column, but it does not renew the image, keeping the first line with the 3 images initially placed.

Is the procedure correct?

Thanks,

Oliveiros Junior
oliveiros junior
 
Posts: 125
Joined: Tue Mar 20, 2007 3:13 pm

Re: SetArray xBrowser

Postby nageswaragunupudi » Wed Dec 13, 2023 4:07 am

I am posting a working sample for switching arrays of images.
Please see if you can use similar logic for your requirement.

Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local oWnd, oBrw, oBar,    oFont, oBold
   local aData, nPath := 1
   local aPath := { "..\bitmaps\alphabmp\", "..\bitmaps\pngs\" }

   aData := Directory( aPath[ nPath ] + "
*.*" )

   DEFINE FONT oFont NAME "
TAHOMA"  SIZE 0,-12
   DEFINE FONT oBold NAME "
VERDANA" SIZE 0,-13 BOLD

   DEFINE WINDOW oWnd TITLE "
Image and Text in same cell"
   oWnd:SetFont( oFont )
   DEFINE BUTTONBAR oBar SIZE 100,32 2007
   DEFINE BUTTON OF oBar PROMPT "
AlphaBmp" CENTER ;
      ACTION ( nPath := 1, aData := Directory( aPath[ nPath ] + "
*.*" ), ;
      oBrw:aArrayData := aData, oBrw:GoTop(), ;
      oBrw:Refresh(), oBrw:SetFocus() ) ;
      WHEN nPath != 1
   DEFINE BUTTON OF oBar PROMPT "
PNG" CENTER ;
      ACTION ( nPath := 2, aData := Directory( aPath[ nPath ] + "
*.*" ), ;
      oBrw:aArrayData := aData, oBrw:GoTop(), ;
      oBrw:Refresh(), oBrw:SetFocus() ) ;
      WHEN nPath != 2

   @ 32,0 XBROWSE oBrw OF oWnd DATASOURCE aData ;
      COLUMNS 1,2,3 COLSIZES 100, 90, 90 ;
      LINES NOBORDER

   WITH OBJECT oBrw
      :nRowHeight := 100

      WITH OBJECT :aCols[ 1 ]
         :bStrImage     := { || aPath[ nPath ] + oBrw:aRow[ 1 ] }
         :oDataFont     := oBold
         :nDataStrAlign := AL_CENTER + AL_BOTTOM
         :nDataBmpAlign := AL_CENTER
         :aImgRect      := { nil, nil, -40, nil }
      END
      //
      :CreateFromCode()
   END
   oWnd:oClient   := oBrw

   oWnd:nHeight   := 700

   ACTIVATE WINDOW oWnd CENTERED
   RELEASE FONT oFont, oBold

return nil


Image
Regards

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

Re: SetArray xBrowser

Postby oliveiros junior » Wed Dec 13, 2023 12:33 pm

Thanks Mr Rao.
oliveiros junior
 
Posts: 125
Joined: Tue Mar 20, 2007 3:13 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 66 guests