the first xbrowse have datasource from a dbf
the second have a array empty
when I drag from the first to second it not make anything ( and it not make error)
the first xbrowse (oBrw1) have image at first columns the same into second xbrowse ( oBrw2)
I wish also when I drag into second xbrowse If there is allready the same record it must add to quantity ( 4th column)
I need it for create a multiple service example :
the service two bed are two record bed
- Code: Select all Expand view RUN
#include "Fivewin.ch"
#define pict_money_Euro "€ 999,999.99"
function InsertMultiple()
local oDlg, oBrw1, oBrw2, oCur
local aData:={}
local aget[9]
Local cCodice //incremental
Local cName := space(30)
Local nPrice := 0
Local cImage := space(60)
Local nUnit := 0
Local lA4 :=.f.
Local lPos :=.f.
/* cCodice :=SE->Id
cName :=SE->name
nPrice :=SE->price
cImage :=SE->image
nUnit :=SE->unit
lA4 :=SE->a4
lPos :=SE->pos*/
//take only the services not multiple to make selection
use servizi alias SE
set filter to se->multiple=.F.
go top
aBrowse := {{"IMAGE",i18n("Tipo"),nil,50 },;
{ "NAME",i18n("Descrizione"),nil,290 },;
{ "PRICE",i18n("Importo"), pict_money_Euro,80 }}
cImage :=""
cDefaImage:="noImage.png"
DEFINE CURSOR oCur DRAG
DEFINE DIALOG oDlg SIZE 878, 480 PIXEL; // SIZE 878, 570
Title "Inserimento Servizi Multipli " ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME )
@ 1, 12 SAY "Servizi singoli " size 100, 12 OF oDlg
@ 2,2 XBROWSE oBrw1 OF oDlg ;
COLUMNS aBrowse CELL LINES NOBORDER ;
DATASOURCE "SE" SIZE 200, 90 STYLE 2015
WITH OBJECT oBrw1
:nRowHeight := 30
WITH OBJECT oBrw1:aCols[ 1]
:lBmpStretch := .F.
:lBmpTransparent := .T.
:nwidth := 30
:bStrImage := {|| se->IMAGE }
END
:oDragCursor := oCur
:bDragBegin := { |r,c,f| SetDropInfo( oBrw1:SelectedCol():Value ) }
:CreateFromCode()
END
// second Browse
@ 1, 52 SAY "Servizi selezionati " size 100, 12 OF oDlg
@ 2,28 XBROWSE oBrw2 OF oDlg;
COLUMNS 1, 2, 3, 4 ;
HEADERS "Tipo","Descrizione","Prezzo","Quantità" ;
COLSIZES 30,80,60,60 ;
ARRAY aData SIZE 200, 90 NOBORDER STYLE 2015
WITH OBJECT oBrw2
:nRowHeight := 30
WITH OBJECT oBrw2:aCols[ 1]
:lBmpStretch := .F.
:lBmpTransparent := .T.
:nwidth := 30
:bStrImage := {|| oBrw2:aArrayData[ oBrw2:narrayat][1] }
END
* :bDropOver := { |u,r,c,f| DropOver( u,r,c, oBrw1, oBrw2 ) }
:bDropOver := { |uInfo,r,c,f,aPt| oBrw2:SetPos( aPt[ 1 ], aPt[ 2 ], .t. ), ;
oBrw2:SelectedCol():VarPut( uInfo ) }
:CreateFromCode()
END
@ 124,10 Say "Nome del servizio :" SIZE 90,10 PIXEL OF oDlg
@ 122,75 GET aGet[2] VAR cName OF oDlg SIZE 95,10 PIXEL
@ 138,10 Say "Prezzo :" SIZE 50,10 PIXEL OF oDlg
@ 136,135 GET aGet[3] VAR nPrice OF oDlg SIZE 35,10 PIXEL RIGHT
@ 154,10 CHECKBOX aGet[6] VAR lA4 Prompt "Visibile nella stampa A4" SIZE 150,10 PIXEL OF oDlg
@ 172,10 CHECKBOX aGet[7] VAR lPos Prompt "Visibile nella stampa Pos" SIZE 150,10 PIXEL OF oDlg
@ 122,200 Say "Immagine :" SIZE 50,10 PIXEL OF oDlg
@ 130,275 Button "Carica" SIZE 30,10 PIXEL OF oDlg ;
ACTION (cFile:= GetImage( cImage ),aGet[4]:SetSource( cFile ))
@ 136,220 XIMAGE aGet[4] SOURCE IF(empty(cImage),cDefaImage,cImage) SIZE 50, 50 OF oDlg
@ 200, ScreenWidth() / 15 + 200 FLATBTN PROMPT "Ok" ;
SIZE 50, 20 ACTION ( lOk := .T., oDlg:End() )
@ 200, ScreenWidth() / 15 + 270 FLATBTN PROMPT "Cancel" ;
SIZE 50, 20 ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
return nil
//------------------------------------------------------------------------//
function DropOver( uInfo, nRow, nCol, oBrw1, oBrw2 )
local aPoint
aPoint := ClientToScreen( oBrw1:hWnd, { nRow, nCol } )
aPoint := ScreenToClient( oBrw2:hWnd, aPoint )
oBrw2:SetPos( aPoint[ 1 ], aPoint[ 2 ], .t. )
oBrw2:SelectedCol():VarPut( uInfo )
return nil
function GetImage( oImage )
local gcFile := cGetFile( "Bitmap (*.bmp)| *.bmp|" + ;
"JPEG (*.jpg)| *.jpg|" + ;
"PNG (*.png)| *.png|" ;
,"Please select a image file", 4 )
if ! Empty( gcFile ) .and. File( gcFile )
endif
return gcFile