by Otto » Thu Nov 22, 2007 10:13 pm
Hello Antonio,
could you please show the right way how to detect the drop folder?
I tried with this function but I always get different results depending on the length of the folder caption.
Regards,
Otto
while nCol > (nPos + (nTabSize := GetTextWidth( 0, Right(oFld:aPrompts[n],len(oFld:aPrompts[n])-1), oFld:oFont) + iif(n=1,5,5)) ) .and. n < Len(oFld:aPrompts)
nPos += nTabSize
n++
end
*******************Test.prg
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oDlg, oFld
LOCAL oBrw1
LOCAL oBrw2
local oCursor
DEFINE CURSOR oCursor HAND
USE fivetest New
DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
FROM 5, 5 TO 40, 150
@ 0.5, 10 FOLDER oFld PROMPT "&xBase Test drag position how to find", "&And OOP", "&Power" ;
OF oDlg SIZE 160, 90
@ 1, 1 LISTBOX oBrw1 FIELDs (fivetest->first) ;
HEADERS "Name" ;
FIELDSIZES 140 ;
SIZE 140, 60 ;
OF oFld:aDialogs[ 1 ]
@ 1, 10 LISTBOX oBrw2 FIELDs (fivetest->first) ;
HEADERS "Name" ;
FIELDSIZES 140 ;
SIZE 140, 60 ;
OF oFld:aDialogs[ 2 ]
oBrw1:oDragCursor := oCursor
oBrw2:oDragCursor := oCursor
oFld:bDropOver = { |uDropInfo,nRow,nCol,nKeyFlags|ShowPos( nRow, nCol, oFld ) }
ACTIVATE DIALOG oDlg CENTERED
return nil
//----------------------------------------------------------------------------//
func ShowPos( nRow, nCol, oFld )
local nFolioNo
local cChk, n, cOrgChk
local nAmt
LOCAL cBezeichnung := ""
local nSatzNr := recno()
local aPoint
nFolioNo := oFld:nOption
cOrgChk := str(oFld:nOption)
cChk := ''
if nRow > 32000
nRow = - ( 65535 - nRow )
endif
if nCol > 32000
nCol = - ( 65535 - nCol )
endif
aPoint = { nRow, nCol }
aPoint = ClientToScreen( GetFocus(), aPoint )
ScreenToClient( oFld:hWnd, aPoint )
cChk := str(TabChk( aPoint[ 2 ],oFld ),1)
return
*---------------------*
Function TabChk( nCol,oFld )
local n := 1, nPos := 0
local nTabSize := 0
while nCol > (nPos + (nTabSize := GetTextWidth( 0, Right(oFld:aPrompts[n],len(oFld:aPrompts[n])-1), oFld:oFont) + iif(n=1,5,5)) ) .and. n < Len(oFld:aPrompts)
msginfo(str(nCol)+ " " +str(n) +" "+oFld:aPrompts[n] + str(GetTextWidth( 0, Right(oFld:aPrompts[n],len(oFld:aPrompts[n])-1), oFld:oFont))+" - "+str(nPos) )
nPos += nTabSize
n++
end
msginfo("Drop to "+oFld:aPrompts[n])
return n
************************************************************