FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Database - 17.07 - Problems
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 02:22 PM

Diego,

Thanks for contributing. It seems I need to look at xBrowse.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 40
Joined: Fri Aug 22, 2014 06:21 AM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 02:36 PM

James,
I have an application where the problem occurs, but when I try to extract an example that presents the problem, the problem is not there. As soon as possible, i will place a test.

Posts: 40
Joined: Fri Aug 22, 2014 06:21 AM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 04:41 PM
Ok, this is the example to test.
Dialog 1 has a TDatabase object in the browse, dialogue 2 uses a DBF directly, but the essential thing is the btmbmp with oDBF:Gotop() and oDBF:Gobottom().
Without the action of the Btnbmp (which contain oDBF:GoTop() or oDBF:GoBottom()) Everything is ok even with fwh 17.07

Code (fw): Select all Collapse
// ---------------------------------------------//
function TEST
    local oDlg

    DEFINE DIALOG oDlg PIXEL SIZE 200,200 TITLE "Test"

    @ 10, 10 BUTTON "DIALOG 1" OF oDlg PIXEL SIZE 35,15 ACTION DLG1()
    @ 40, 10 BUTTON "DIALOG 2" OF oDlg PIXEL SIZE 35,15 ACTION DLG2()

    ACTIVATE DIALOG oDlg CENTERED
return nil

function DLG1
    local oDlg, oBrw, oDBF

    USE C:\FWH\SAMPLES\CUSTOMER NEW
    INDEX ON FIELD->FIRST TAG FIRST
    INDEX ON FIELD->LAST TAG LAST
    CLOSE CUSTOMER

    oDBF := TDATABASE():Open( nil,"C:\FWH\SAMPLES\CUSTOMER", "DBFCDX" )
    oDBF:SetOrder( "FIRST" )

    DEFINE DIALOG oDlg PIXEL SIZE 600,495 TITLE "DLG1"

   @ 0,0 XBROWSE oBrw SIZE -50,-2 PIXEL OF oDlg ;
    ALIAS ( oDBF:cALIAS ) CELL LINES NOBORDER AUTOSORT AUTOCOLS ;

   oBrw:CreateFromCode()

   @ 10, 250 BtnBmp of oDlg RESOURCE "CLOSE16" ;
    PIXEL TOP NOBORDER 2007 SIZE 35,25 ;
    PROMPT "&E n d" ACTION oDlg:End()

    @ 45, 250 BTNBMP OF oDlg PROMPT "First" ;
        SIZE 35,25 RESOURCE "GOTOP16" PIXEL TOP NOBORDER 2007 ;
        ACTION ( oDBF:GOTOP(), oBrw:Refresh(), oBrw:SetFocus() )

    @ 80, 250 BTNBMP OF oDlg PROMPT "Last" ;
        SIZE 35,25 RESOURCE "GOBOT16" PIXEL TOP NOBORDER 2007 ;
        ACTION ( oDBF:GOBOTTOM(), oBrw:Refresh(), oBrw:SetFocus() )

    ACTIVATE DIALOG oDlg CENTER

    oDBF:End()

return nil

function DLG2
    local oDlg, oBrw

    USE C:\FWH\SAMPLES\CLIENTS NEW
    INDEX ON FIELD->NAME TAG NAME
    INDEX ON FIELD->ADRESS TAG ADRESS
    SET TAG TO NAME
    GO TOP

    DEFINE DIALOG oDlg PIXEL SIZE 600,495 TITLE "DLG2"

   @ 0,0 XBROWSE oBrw SIZE -5,-2 PIXEL OF oDlg ;
    ALIAS ( "CLIENTS" ) CELL LINES NOBORDER AUTOSORT AUTOCOLS ;

   oBrw:CreateFromCode()

    ACTIVATE DIALOG oDlg CENTER

    CLOSE CLIENTS

return nil
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 04:51 PM

Hi,

Error happens in Twbrowse too.

thanks

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 05:18 PM

Diego,

You forgot to set the default RDD:

REQUEST DBFCDX
rddsetdefault( "DBFCDX" )

If you add those lines it works fine.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 40
Joined: Fri Aug 22, 2014 06:21 AM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 05:32 PM

Hmmm, I have tested into another my application where those set are present...

Posts: 40
Joined: Fri Aug 22, 2014 06:21 AM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 05:41 PM

I confirm that, even by performing the only TEST function with the sets indicated by James, the problem arises. You must open dialog 1, close it, open dialog 2 and, when closed, here is the error.

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 05:44 PM
Diego,

I had to make a few changes to get your sample working (commented lines were erroring out). It was also set to use TDatabase() not TData() which I changed.

I am not seeing any errors using this code.

James

Code (fw): Select all Collapse
/*
Language : Fivewin/xHarbour
Updated  : 
Notes    : Code provided by Diego Decandia 
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=34468&p=204989#p204985">viewtopic.php?f=3&t=34468&p=204989#p204985</a><!-- l -->

*/

#include "fivewin.ch"

Function Main()
   REQUEST DBFCDX
   rddsetdefault( "DBFCDX" )
   
   Test()

Return nil

// ---------------------------------------------//
function TEST
    local oDlg

    DEFINE DIALOG oDlg PIXEL SIZE 200,200 TITLE "Test"

    @ 10, 10 BUTTON "DIALOG 1" OF oDlg PIXEL SIZE 35,15 ACTION DLG1()
    @ 40, 10 BUTTON "DIALOG 2" OF oDlg PIXEL SIZE 35,15 ACTION DLG2()

    ACTIVATE DIALOG oDlg CENTERED
return nil

function DLG1
    local oDlg, oBrw, oDBF

    USE C:\FWH\SAMPLES\CUSTOMER NEW
    INDEX ON FIELD->FIRST TAG FIRST
    INDEX ON FIELD->LAST TAG LAST
    CLOSE CUSTOMER
    
    oDBF := TDATA():New( nil,"C:\FWH\SAMPLES\CUSTOMER", "DBFCDX" )
    oDBF:use()
        
    msgInfo(if(oDBF:used(),"Customer.dbf is open","Customer.dbf is not open"))
    
    //oDBF:SetOrder( "FIRST" )
    
    DEFINE DIALOG oDlg PIXEL SIZE 600,495 TITLE "DLG1"

   @ 0,0 XBROWSE oBrw SIZE -50,-2 PIXEL OF oDlg ;
    ALIAS ( oDBF:cALIAS ) CELL LINES NOBORDER AUTOSORT AUTOCOLS ;

   oBrw:CreateFromCode()

   @ 10, 250 BtnBmp of oDlg RESOURCE "CLOSE16" ;
    PIXEL TOP NOBORDER 2007 SIZE 35,25 ;
    PROMPT "&E n d" ACTION oDlg:End()

    @ 45, 250 BTNBMP OF oDlg PROMPT "First" ;
        SIZE 35,25 RESOURCE "GOTOP16" PIXEL TOP NOBORDER 2007 ;
        ACTION ( oDBF:GOTOP(), oBrw:Refresh(), oBrw:SetFocus() )

    @ 80, 250 BTNBMP OF oDlg PROMPT "Last" ;
        SIZE 35,25 RESOURCE "GOBOT16" PIXEL TOP NOBORDER 2007 ;
        ACTION ( oDBF:GOBOTTOM(), oBrw:Refresh(), oBrw:SetFocus() )

    ACTIVATE DIALOG oDlg CENTER

    oDBF:End()

return nil

function DLG2
    local oDlg, oBrw

    USE C:\FWH\SAMPLES\CLIENTS NEW
    INDEX ON FIELD->NAME TAG NAME
    INDEX ON FIELD->ADRESS TAG ADRESS
    //SET TAG TO NAME
    GO TOP

    DEFINE DIALOG oDlg PIXEL SIZE 600,495 TITLE "DLG2"

   @ 0,0 XBROWSE oBrw SIZE -5,-2 PIXEL OF oDlg ;
    ALIAS ( "CLIENTS" ) CELL LINES NOBORDER AUTOSORT AUTOCOLS ;

   oBrw:CreateFromCode()

    ACTIVATE DIALOG oDlg CENTER

    //CLOSE CLIENTS
    use

return nil
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 05:47 PM
Diego,

You must open dialog 1, close it, open dialog 2 and, when closed, here is the error.


Apparently, the syntax:

CLOSE CLIENTS is not valid. If you change it to just USE then it works fine. Try the test code in my previous message.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 40
Joined: Fri Aug 22, 2014 06:21 AM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 05:55 PM

It is true, even putting close all, no error. So it is not good to use <close ' Alias '>.??

Posts: 40
Joined: Fri Aug 22, 2014 06:21 AM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 06:21 PM

In any way, if I use DLG2 first, close clients works.

If I use DLG1 and then DLG2, close clients does not work.

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 08:32 PM
James Bott wrote:CLOSE CLIENTS is not valid.


CLOSE <alias> is perfectly valid. The problem has to be elsewhere.

EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 09:30 PM

Enrico,

Thanks for the clarification--I should have looked it up. I had never used that syntax before. And when I changed it to USE it started working fine.

It is rather irrelevant in this situation because we are trying to track down an error occurring with TDatabase/TData so using standard database syntax clouds the issue.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 40
Joined: Fri Aug 22, 2014 06:21 AM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 09:38 PM

If in dialog 2, before close clients, you put
MsgInfo (Alias ())
You see that the DBF file is already closed.
Who closed it?

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Database - 17.07 - Problems
Posted: Fri Aug 25, 2017 09:58 PM

Diego,

I am not seeing that but I am using FWH 16.02 with TDatabase from 17.07 and xHarbour

I assume you are using 17.07? If so, then there must be a problem that is not in the TDatabase class. It could even be a xHarbour or Harbour issue.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10