FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse Multi-Line select
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
xBrowse Multi-Line select
Posted: Tue Aug 28, 2012 05:11 PM
To All

I have looked at the multi-line select option in the sample TestxBrw.prg and I see where you add the line .. oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROWMS


Code (fw): Select all Collapse
STATIC FUNCTION MultiSelect( oWnd )

   local oChild, oBrw

   DEFINE WINDOW oChild TITLE "MultiSelect browse" MDICHILD OF oWnd

   oBrw := TXBrowse():New( oWnd )
   oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROWMS

   oBrw:SetRDD()
   oBrw:CreateFromCode()

   oChild:oClient := oBrw

   ACTIVATE WINDOW oChild ON INIT oBrw:SetFocus()

RETURN NIL


What I would like to be able to do is trap those multiple rows and on a button click run those hi-lited rows through a program that imports them ( like a do while loop ) ..

The button click has a single action line program ( _transfer() )I would like to run for as many rows that are selected.

Here is a screen shot of what I am trying to do..


then on the transfer button click be able to cycle through this code multiple times
Code (fw): Select all Collapse
 REDEFINE BTNBMP oBtn2 ID 161 PROMPT "Transfer" CENTER ;
                of oInvt 2007 ;
                ACTION ( _Transfer( oRsInvt,oWnd,oLbxMain,oRsInvDetail,;
                          oWndChildD,oRsInv,@lTaxable,oTaxable,oFontB,oFontBig,nRepairNumber,;
                          oLabor,oParts,oMisc,oTax,oTotal,nAssignedTo,cLoc,nTaxNumber,;
                          oOther,oSubtotal))



Any help and advice would be appreciated!

Rick Lipkin
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: xBrowse Multi-Line select
Posted: Tue Aug 28, 2012 07:10 PM

Dear Rick, maybe this little code can give you an idea or guidance.

It works on two identical dbf files.

local n, nn, aProducts:=oBrw:aSelected //MULTISELECT

    FOR nn:=1 to len(aProducts)
          Sourc->(dbgoto(aProducts[nn]))
          Dest->(dbAppend())
          FOR n := 1 to Sourc->(Fcount())
             Dest->( FieldPut( n, Sourc->(FieldGet(n)) ) ) 
          NEXT
    NEXT

Regards

Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xBrowse Multi-Line select
Posted: Tue Aug 28, 2012 07:49 PM
Francisco

I believe you are on the right track with ..

Code (fw): Select all Collapse
aCols := oLbx:aSelected
xbrowse( aCols )


Just looking at the results of the array .. I see a number which with .dbf apparently represents Recno() .. Unfortunitly I am using MS Access ( w ADO ) and Recno() is not a legitimate value.



Any idea what these row values represent ?

Thanks
Rick Lipkin
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xBrowse Multi-Line select
Posted: Tue Aug 28, 2012 09:13 PM
To All

After doing some tests it appears the array value for aCols[i] is actually the 'bookmark' value..

Code (fw): Select all Collapse
aCols := oLbx:aSelected
xbrowse( aCols )

msginfo( oLbx:BookMark() )

For i = 1 to Len(aCols)
    oLbx:BookMark(aCols[1])
    msginfo( oRsInvt:Fields("d"):Value )
Next


Issuing the BookMark() method takes you to that record and you can then extract the value of that row... and in my case I can issue my _Transfer() function in the For\Next loop.

Rick Lipkin

Continue the discussion