FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xbrowse question?
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
xbrowse question?
Posted: Wed Jun 21, 2017 02:14 AM
Dear All,

I try to create small program to see the index expression. It has 3 columns in array but it shows 4 columns in the xbrowse as picture.

What is the matter?
Code (fw): Select all Collapse
#include 'fivewin.ch'

Function main( cTable )
local lStart, aIndexKey, aIndex 
local oDlg, oBrw, oBtn, oSay, oFont
local cPath, aDBF, n, x

Default cTable := ''

REQUEST DBFCDX, DBFFPT

cTable += iif(upper(right(cTable,4))='.DBF','','*.DBF')

cPath := curdrive()+':\'+curdir()+'\'
aDBF := Directory(cPath+cTable)

if !empty(aDBF)
   lStart := .T.
else 
   MsgWait('Table : '+cTable+' does not exist',,1)
   lStart := .F.
end

if lStart
   aIndexKey := {}
   for n := 1 to len(aDBF)
       cTable := left(aDBF[n][1],len(aDBF[n][1])-4)
       if file(cPath+cTable+'.CDX')
          DbUseArea( .T., 'DBFCDX', cTable, 'TMP', .T., .T. )
          DbSetIndex( cTable )
          aIndex := IndexInfo(cTable)
          TMP->(DbCloseArea())
          for x := 1 to len(aIndex)
              aadd( aIndexKey, { aIndex[x][1], aIndex[x][2], aIndex[x][3] } )
          next 
       end
   next

DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14 

DEFINE DIALOG oDlg FROM 0, 0 TO 500, 900 TITLE 'Index Table' PIXEL FONT oFont
   oDlg:lHelpIcon := .F.

   @  2, 2 XBROWSE oBrw ARRAY aIndexKey ;
           COLUMNS 1, 2, 3 ;
           HEADERS 'Table', 'Tag', 'Expression' ;
           COLSIZES 100, 100, 543 ;
           SIZE 447, 247 ;
           PIXEL ;
           oDlg 
           
   oBrw:nMarqueeStyle      := MARQSTYLE_HIGHLROW
   oBrw:nRowDividerStyle   := LINESTYLE_LIGHTGRAY
   oBrw:nColDividerStyle   := LINESTYLE_LIGHTGRAY
   oBrw:nHeaderHeight      := 26
   oBrw:nRowHeight         := 24
   oBrw:lHScroll           := .F.
   oBrw:lVScroll           := .T.
   oBrw:nStretchCol        := STRETCHCOL_LAST
   oBrw:lAllowRowSizing    := .F.

   oBrw:CreateFromCode()           
           
   oDlg:oClient := oBrw 

ACTIVATE DIALOG oDlg CENTER

oFont:End()
end
return nil

*---------------------------*
Function IndexInfo(cTable)
local aOrders := {}
local j, n

n := OrdCount()
FOR j:=1 TO n
     aadd( aOrders, { iif(j=1,cTable,''), OrdName(j) , UPPER(OrdKey(j)) } )
NEXT

Thank you in advance for any help and suggestion.
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xbrowse question?
Posted: Wed Jun 21, 2017 02:24 AM
In the definition of xbrowse please see this part of the code:
Code (fw): Select all Collapse
          PIXEL ;
           oDlg

Please change it as
Code (fw): Select all Collapse
          PIXEL ;
           OF oDlg       // add OF before oDlg
Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: xbrowse question?
Posted: Wed Jun 21, 2017 02:28 AM

Dear Mr.Rao,

Thank you so much and apologize for stupid question.

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion