xBrowse Multi-Line select

xBrowse Multi-Line select

Postby Rick Lipkin » Tue Aug 28, 2012 5: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: Select all  Expand view

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..
Image

then on the transfer button click be able to cycle through this code multiple times
Code: Select all  Expand view

 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))
 

Image

Any help and advice would be appreciated!

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse Multi-Line select

Postby FranciscoA » Tue Aug 28, 2012 7: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
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: xBrowse Multi-Line select

Postby Rick Lipkin » Tue Aug 28, 2012 7:49 pm

Francisco

I believe you are on the right track with ..

Code: Select all  Expand view

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.

Image

Any idea what these row values represent ?

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse Multi-Line select

Postby Rick Lipkin » Tue Aug 28, 2012 9:13 pm

To All

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

Code: Select all  Expand view

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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

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