Hello Antonio,
can you please provide a button for clipboard.
Thanks in advance
Otto
function TxtStruct( oBrw )
local cCode := "local aFields := { ", n, bClipboard
if Empty( oBrw:oRs )
for n = 1 to FCount()
if n > 1
cCode += Space( 27 )
endif
cCode += '{ "' + FieldName( n ) + '", "' + ;
FieldType( n ) + '", ' + ;
AllTrim( Str( FieldLen( n ) ) ) + ", " + ;
AllTrim( Str( FieldDec( n ) ) ) + " },;" + CRLF
next
else
for n = 1 to oBrw:oRS:Fields:Count
if n > 1
cCode += Space( 27 )
endif
cCode += '{ "' + oBrw:oRS:Fields[ n - 1 ]:Name + '", "' + ;
FWAdoFieldType( oBrw:oRs, n ) + '", ' + ;
AllTrim( Str( FWAdoFieldSize( oBrw:oRs, n ) ) ) + ", " + ;
AllTrim( Str( FWAdoFieldDec( oBrw:oRs, n ) ) ) + ;
" },;" + CRLF
next
endif
cCode = SubStr( cCode, 1, Len( cCode ) - 4 ) + " }" + CRLF + CRLF
if Empty( oBrw:oRs )
cCode += 'DbCreate( "myfile.dbf", aFields, "' + RddName() + '" )'
endif
bClipboard = { | oDlg | AddClipboardButton( oDlg, cCode ), cCode }
MemoEdit( bClipboard, FWString( "Code" ) )
return nil
//----------------------------------------------------------------------------//
function CopyToClipboard( cText )
local oClip := TClipBoard():New()
if oClip:Open()
oClip:SetText( cText )
oClip:Close()
endif
oClip:End()
return nil
//----------------------------------------------------------------------------//
function AddClipboardButton( oDlg, cText )
local oBtn
@ 238, 6 BUTTON oBtn PROMPT FWString( "Copy to clipboard" ) ;
OF oDlg SIZE 140, 28 PIXEL ;
ACTION ( CopyToClipboard( cText ),;
MsgInfo( FWString( "Code copied to the clipboard" ) ) )
return nil
//----------------------------------------------------------------------------//
bClipboard = { | oDlg | AddClipboardButton( oDlg ), cCode }
MemoEdit( bClipboard, FWString( "Code" ) )
return nil
//----------------------------------------------------------------------------//
function CopyToClipboard( cText )
local oClip := TClipBoard():New()
if oClip:Open()
oClip:SetText( cText )
oClip:Close()
endif
oClip:End()
return nil
//----------------------------------------------------------------------------//
function AddClipboardButton( oDlg, cText )
local oBtn
@ 238, 6 BUTTON oBtn PROMPT FWString( "Copy to clipboard" ) ;
OF oDlg SIZE 140, 28 PIXEL ;
ACTION ( CopyToClipboard( oDlg:aControls[ 1 ]:GetText() ),;
MsgInfo( FWString( "Code copied to the clipboard" ) ) )
return nil
//----------------------------------------------------------------------------//
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: cnavarro and 48 guests