oBrw:nEditTypes := EDIT_GET
oBrw:lCanPaste := .t.
oBrw:nMarqStyle := MARQSTYLE_HIGHLROWRC // or higher
oBrw:Copy()
oBrw:GoLeftMost()
oBrw:Paste()
aCopy := oBrw:Values
oBrw:Lock()
oBrw:Values := aCopy
oBrw:Unlock( .t. )
#include "fivewin.ch"
function Main()
local oDlg, oBar, oBrw, oFont, nCol
USE CUSTOMER SHARED
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL FONT oFont
DEFINE BUTTONBAR oBar SIZE 80,32 2010
@ 50,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" AUTOCOLS LINES NOBORDER
WITH OBJECT oBrw
:nEditTypes := EDIT_GET
:lCanPaste := .t.
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:bClrRowFocus := { || { CLR_BLACK, RGB( 230,230,230 ) } }
:bClrSelFocus := { || { CLR_WHITE, CLR_BLUE } }
:AddVar( "LCOPIED", .f. )
:bPopUp := { |oCol| PopMenu( oCol ) }
//
:CreateFromCode()
END
DEFINE BUTTON OF oBar PROMPT "Copy" ACTION ( ;
oBrw:Copy(), oBrw:lCopied := .t., oBar:AEvalWhen(), ;
oBrw:SetFocus() )
DEFINE BUTTON OF oBar PROMPT "Paste" ACTION ( ;
nCol := oBrw:nColSel, ;
oBrw:GoLeftMost(), oBrw:Paste(), oBrw:lCopied := .f., ;
oBrw:nColSel := nCol, ;
oBar:AEvalWhen(), oBrw:SetFocus() ) ;
WHEN oBrw:lCopied
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
function PopMenu( oCol )
local oBrw := oCol:oBrw
local nCol
local oPop
MENU oPop POPUP 2010
MENUITEM "Copy" ACTION ( oBrw:Copy(), oBrw:lCopied := .t., ;
oBrw:oWnd:oBar:AEvalWhen() )
MENUITEM "Paste" WHEN oBrw:lCopied ACTION ( ;
nCol := oBrw:nColSel, ;
oBrw:GoLeftMost(), oBrw:Paste(), oBrw:nColSel := nCol, ;
oBrw:lCopied := .f., ;
oBrw:oWnd:oBar:AEvalWhen(), oBrw:SetFocus() )
ENDMENU
return oPop
#include "fivewin.ch"
function Main()
local oDlg, oBar, oBrw, oFont, nCol
USE CUSTOMER SHARED VIA "DBFCDX"
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL FONT oFont
DEFINE BUTTONBAR oBar SIZE 80,32 2010
@ 50,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" AUTOCOLS LINES NOBORDER
WITH OBJECT oBrw
:nEditTypes := EDIT_GET
:lCanPaste := .t.
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:bClrRowFocus := { || { CLR_BLACK, RGB( 230,230,230 ) } }
:bClrSelFocus := { || { CLR_WHITE, CLR_BLUE } }
:AddVar( "ACOPY", nil )
:bPopUp := { |oCol| PopMenu( oCol ) }
//
:CreateFromCode()
END
DEFINE BUTTON OF oBar PROMPT "Copy" ACTION ( ;
oBrw:aCopy := oBrw:Values, oBar:AEvalWhen(), ;
oBrw:SetFocus() )
DEFINE BUTTON OF oBar PROMPT "Paste" ACTION ( ;
oBrw:Lock(), oBrw:Values := oBrw:aCopy, oBrw:Unlock( .t. ), ;
oBrw:aCopy := nil, ;
oBar:AEvalWhen(), oBrw:RefreshCurrent(), oBrw:SetFocus() ) ;
WHEN !Empty( oBrw:aCopy )
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
function PopMenu( oCol )
local oBrw := oCol:oBrw
local nCol
local oPop
MENU oPop POPUP 2010
MENUITEM "Copy" ACTION ( ;
oBrw:aCopy := oBrw:Values, oBrw:oWnd:oBar:AEvalWhen(), ;
oBrw:SetFocus() )
MENUITEM "Paste" WHEN !Empty( oBrw:aCopy ) ACTION ( ;
oBrw:Lock(), oBrw:Values := oBrw:aCopy, oBrw:Unlock( .t. ), ;
oBrw:aCopy := nil, ;
oBrw:oWnd:oBar:AEvalWhen(), oBrw:RefreshCurrent(), oBrw:SetFocus() )
ENDMENU
return oPop
#include "fivewin.ch"
function Main()
local oDlg, oBar, oBrw, oFont, oCur
USE CUSTOMER SHARED VIA "DBFCDX"
DEFINE CURSOR oCur DRAG
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL FONT oFont RESIZABLE
@ 50,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" AUTOCOLS CELL LINES NOBORDER
WITH OBJECT oBrw
:nEditTypes := EDIT_GET
:oDragCursor := oCur
:bDragBegin := { |r,c,f| SetDropInfo( oBrw:Values ) }
:bDropOver := < |u,r,c,f|
oBrw:SetPos( r, c, .t. )
oBrw:Lock()
oBrw:Values := u
oBrw:Unlock( .t. )
oBrw:RefreshCurrent()
return nil
>
//
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
nageswaragunupudi wrote:METHOD-3:
USING DRAG AND DROP
Sample:
- Code: Select all Expand view
#include "fivewin.ch"
function Main()
local oDlg, oBar, oBrw, oFont, oCur
USE CUSTOMER SHARED VIA "DBFCDX"
DEFINE CURSOR oCur DRAG
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL FONT oFont RESIZABLE
@ 50,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" AUTOCOLS CELL LINES NOBORDER
WITH OBJECT oBrw
:nEditTypes := EDIT_GET
:oDragCursor := oCur
:bDragBegin := { |r,c,f| SetDropInfo( oBrw:Values ) }
:bDropOver := < |u,r,c,f|
oBrw:SetPos( r, c, .t. )
oBrw:Lock()
oBrw:Values := u
oBrw:Unlock( .t. )
oBrw:RefreshCurrent()
return nil
>
//
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
#include "fivewin.ch"
Function Main()
Test("00001")
Test("00002")
retur nil
function Test(codcep)
local oDlg, oBar, oBrw, oFont
local aData:= {}
//adata demo
aAdd( aData, {codcep, 1.5,11,9,2 } )
aAdd( aData, {codcep, 5.5,5,5,2.5,0.8 } )
aAdd( aData, {codcep, 6.3,8,5,0.8 } )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL FONT oFont RESIZABLE
@10,10 say "Computo:" +CodCep SIZE 120,20 pixel OF oDlg
@ 50,20 XBROWSE oBrw OF oDlg ;
COLUMNS 2,3,4,5;
HEADERS "Riga","Colonna","Larghezza","Altezza" ;
COLSIZES 60,60,60,60 ;
ARRAY aData ;
SIZE -20,-20 PIXEL STYLE FLAT NOBORDER
WITH OBJECT oBrw
:SetMultiSelectCol()
:lRecordSelector := .t.
:bRecSelHeader := { || " Num. " }
:bRecSelData := { |o| Int( o:BookMark ) }
:nRecSelWidth := "999"
:nEditTypes := EDIT_GET
:lCanPaste := .t.
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:bClrRowFocus := { || { CLR_BLACK, RGB( 230,230,230 ) } }
:bClrSelFocus := { || { CLR_WHITE, CLR_BLUE } }
:AddVar( "ACOPY", nil )
:bPopUp := { |oCol| PopMenu( oCol ) }
//
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
function PopMenu( oCol )
local oBrw := oCol:oBrw
local nCol
local oPop
MENU oPop POPUP 2010
MENUITEM "Copy" ACTION ( ;
oBrw:aCopy := oBrw:Values, ;
oBrw:SetFocus() )
MENUITEM "Paste" WHEN !Empty( oBrw:aCopy ) ACTION ( ;
oBrw:Lock(), oBrw:Values := oBrw:aCopy, oBrw:Unlock( .t. ), ;
oBrw:aCopy := nil, ;
oBrw:RefreshCurrent(), oBrw:SetFocus() )
ENDMENU
return oPop
Otto wrote:Silvio,
Interesting, I just worked on the same problem in mod harbour. Actually, the solution is exactly the same as with Fivewin. You copy the row as an array (object) and insert it in the 2nd browser.
Although it is not welcome here, I post. I think we all have to prepare for the future, and the future is on the web. Unless we only have 6 months left until retirement.
But you should not be selfish either. Many of us want to stay in the market for longer.
Best regards,
Otto
BTW, do you know the FIVEWIN functions for mod harbour? For example: MH_ArrayToHTML() , H_ValToHTML( ) from Mr. RAo?
Similar to xbrowser.
aCopy := oBrw:aRow
aCopy[ 1 ] := codsep
oBrw:aArrayData[ oBrw:nArrayAt ] := aCopy
nageswaragunupudi wrote:do not use oBrw:aCopy
Keep a variable aCopy
For copying
- Code: Select all Expand view
aCopy := oBrw:aRow
For pasting
- Code: Select all Expand view
aCopy[ 1 ] := codsep
oBrw:aArrayData[ oBrw:nArrayAt ] := aCopy
#include "fivewin.ch"
static aCopy
Function Main()
Test("00001")
Test("00002")
retur nil
function Test(codcep)
local oDlg, oBar, oBrw, oFont
local aData:= {}
//adata demo
aAdd( aData, {codcep, 1.5,11,9,2 } )
aAdd( aData, {codcep, 5.5,5,5,2.5,0.8 } )
aAdd( aData, {codcep, 6.3,8,5,0.8 } )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL FONT oFont RESIZABLE
@10,10 say "Computo:" +CodCep SIZE 120,20 pixel OF oDlg
@ 50,20 XBROWSE oBrw OF oDlg ;
COLUMNS 2,3,4,5;
HEADERS "Riga","Colonna","Larghezza","Altezza" ;
COLSIZES 60,60,60,60 ;
ARRAY aData ;
SIZE -20,-20 PIXEL STYLE FLAT NOBORDER
WITH OBJECT oBrw
:SetMultiSelectCol()
:lRecordSelector := .t.
:bRecSelHeader := { || " Num. " }
:bRecSelData := { |o| Int( o:BookMark ) }
:nRecSelWidth := "999"
:nEditTypes := EDIT_GET
:lCanPaste := .t.
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:bClrRowFocus := { || { CLR_BLACK, RGB( 230,230,230 ) } }
:bClrSelFocus := { || { CLR_WHITE, CLR_BLUE } }
:bPopUp := { |oCol| PopMenu( oCol, oBrw:aArrayData[ oBrw:nArrayAt ][1] ) }
//
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
function PopMenu( oCol, codsep )
local oBrw := oCol:oBrw
local nCol
local oPop
MENU oPop POPUP 2010
MENUITEM "Copy" WHEN acopy=NIL ACTION ( aCopy := oBrw:aRow,;
oBrw:SetFocus() )
MENUITEM "Paste" ACTION ( ;
oBrw:Lock(), ;
aCopy[ 1 ] := codsep ,;
aadd( oBrw:aArrayData,aCopy ),; // oBrw:aArrayData[ oBrw:nArrayAt ] := aCopy ,;
oBrw:Unlock( .t. ), ;
oBrw:RefreshCurrent(),aCopy:= {}, oBrw:SetFocus() )
ENDMENU
return oPop
MENUITEM "Paste" WHEN acopy!=NIL ACTION ( ;
oBrw:Lock(), ;
aCopy[ 1 ] := codsep ,;
aadd( oBrw:aArrayData,aCopy ),; // oBrw:aArrayData[ oBrw:nArrayAt ] := aCopy ,;
oBrw:Unlock( .t. ), ;
oBrw:RefreshCurrent(), oBrw:SetFocus(), acopy:=NIL )
Otto wrote:Silvio,
try this:
- Code: Select all Expand view
MENUITEM "Paste" WHEN acopy!=NIL ACTION ( ;
oBrw:Lock(), ;
aCopy[ 1 ] := codsep ,;
aadd( oBrw:aArrayData,aCopy ),; // oBrw:aArrayData[ oBrw:nArrayAt ] := aCopy ,;
oBrw:Unlock( .t. ), ;
oBrw:RefreshCurrent(), oBrw:SetFocus(), acopy:=NIL )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 48 guests