Page 1 of 1

LISTBOX ALIAS

Posted: Sun Jun 06, 2010 7:27 am
by Otto
I have a listbox where I show the data.
I close the database and then I send the dbf-file back to the server.

In case that something goes wrong the user should return to the previous status.

select rechnung
use

oLbxRG:lCloseArea() // if I use lCloseArea the msginfo is ok otherwise I get an error

But then I find no way how to "oLbxRG:lOpenArea()" - how to rebind the oLbxRg again

lret := MEMOWRIT2(cSrc, cDSt )

lret := .f. //procl for testing a network error

if lret = .f.

Msginfo1 ( "N e t z w e r k f e h l e r" )


USE ( CurDir() + "\RECHNUNG" ) VIA "DBFCDX" NEW ALIAS RECHNUNG
oLbxRG:cAlias := "RECHNUNG"

endif


Best regards,
Otto

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 7:51 am
by Antonio Linares
Otto,

Class TWBrowse Method lCloseArea() calls DbCloseArea(), so after calling it you may need to USE the DBF again if you need to manage it again

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 7:58 am
by Otto
Hello Antonio,
I tried to do this but with no result:

if lret = .f.
USE ( CurDir() + "\RECHNUNG" ) VIA "DBFCDX" NEW ALIAS RECHNUNG
oLbxRG:cAlias := "RECHNUNG"
oLbxRG:show()
oLbxRG:gotop()
oLbxRG:refresh()
endif

Best regards,
Otto

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 8:05 am
by Antonio Linares
Otto,

Why do you close the DBF and try to open it again from the same browse ?

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 8:16 am
by Otto
Antonio,
doesn't PPC open the dbf-exclusivly?
I will check if I can copy a opened dbf back to the server.
Best regards,
Otto

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 8:33 am
by Antonio Linares
Otto,

> doesn't PPC open the dbf-exclusivly?

I have not checked it myself

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 8:34 am
by Otto
Antonio,
It I try to copy the opened dbf i get a dbf on the server with 0 byte.
Best regards,
Otto

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 8:44 am
by Antonio Linares
Otto,

Have you tried to copy it before USE ing it ?

How do you copy it ? What source code do you use ?

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 8:47 am
by Otto
Antonio,
If the file is not opend all is working.
This is the code I use:
Best regards,
Otto

Code: Select all

#pragma BEGINDUMP

#include <hbapi.h>
#include <hbapiitm.h>
#include "hbapifs.h"
#include <aygshell.h>

#include <windows.h>



HB_FUNC( MEMOWRIT2 )

{
PHB_ITEM pFileName = hb_param( 1, HB_IT_STRING );
   PHB_ITEM pString = hb_param( 2, HB_IT_STRING );
BOOL bWriteEof = FALSE; /* write Eof !, by default is .T. */
BOOL bRetVal = FALSE;

   if( hb_parinfo(0) == 3                       && ISLOG( 3 ) )
bWriteEof = hb_parl( 3 );

   if( pFileName                                && pString )
{
FHANDLE fhnd = hb_fsCreate( ( BYTE * ) hb_itemGetCPtr( pFileName ), FC_NORMAL );

   if( fhnd != FS_ERROR )
{
ULONG ulSize = hb_itemGetCLen( pString );

   bRetVal = ( hb_fsWriteLarge( fhnd, ( BYTE * ) hb_itemGetCPtr( pString ), ulSize ) == ulSize );

/* NOTE: CA-Clipper will add the EOF even if the write failed. [vszakats] */
/* NOTE: CA-Clipper will not return .F. when the EOF could not be written. [vszakats] */
#if ! defined(OS_UNIX_COMPATIBLE)
{
if( bWriteEof ) /* if true, then write EOF */
{
BYTE byEOF = HB_CHAR_EOF;

   hb_fsWrite( fhnd, &byEOF, sizeof( BYTE ) );
   }
}
#endif

hb_fsClose( fhnd );
   }
}

hb_retl( bRetVal );
   }

HB_FUNC( DLGFULLSCREEN )
{
   SHINITDLGINFO shidi;

   memset( &shidi, 0, sizeof( SHINITDLGINFO ) );

   shidi.dwMask  = SHIDIM_FLAGS;
   shidi.hDlg    = ( HWND ) hb_parnl( 1 );
   shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;

   SHInitDialog( &shidi );
}

HB_FUNC( NUMSERIETARJETA )
{
BY_HANDLE_FILE_INFORMATION bHinfo;

memset( &bHinfo, 0 , sizeof(bHinfo) );

GetFileInformationByHandle( (HANDLE) hb_parnl(1), &bHinfo );
hb_retnl( bHinfo.dwVolumeSerialNumber );

}

#pragma ENDDUMP

//----------------------------------------------------------------------------//
 

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 8:54 am
by Antonio Linares
Otto,

have you tried to USE the DBF in shared mode ?

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 9:38 am
by Otto
Antonio,
thank you. SHARED works. But I am uncertain if SHARED is ready for use with PPC.
There are some posts in this forum which report of problems.
Would you suggest to use it?
Best regards,
Otto

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 9:53 am
by Antonio Linares
Otto,

The FWPPC build that we published in march this year it is based on march Harbour and imo shared should work fine.

We were using a much more older Harbour previously so hence the shared complains. Anyhow, you tests will have the final word :-)

Re: LISTBOX ALIAS

Posted: Sun Jun 06, 2010 10:01 am
by Otto
Antonio,
thank you.
I shall install the new version of PPC and do more tests.
Best regards,
Otto

Re: LISTBOX ALIAS

Posted: Mon Jun 07, 2010 6:40 am
by Richard Chidiak
Otto

Shared mode works OK with fwppc, my app uses it since quite a while

PS : i am using an old version of fwppc

Hth

Richard

Re: LISTBOX ALIAS

Posted: Mon Jun 07, 2010 11:42 am
by Otto
Hello Richard,
thank you for the information.
Best regards,
Otto
PS: Oh, a new photo!