FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TWBrowse refiniment
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
TWBrowse confusing display
Posted: Mon Feb 27, 2006 07:02 PM

Here is another item that I find interesting with TWBrowse. If you have a database, set the filter, and gotop( ), even if there are no records, the browse shows an empty record. My clients assume this is a blank ready to be filled in ( I require an Add button be pressed to include a new record ), and they fill in the data, hit Save, and it disappears.

Yes, I can program around this, but I often wonder why anything shows up if there are no records.

Essentially, its the highlight bar frame that displays.

Tim

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: TWBrowse confusing display
Posted: Mon Feb 27, 2006 07:15 PM
I see no blank row in the following sample. Do you?

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrw

    DEFINE DIALOG oDlg;
           SIZE 400, 400

    @ 1, 1 LISTBOX oBrw FIELDS

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    RETURN NIL


EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TWBrowse refiniment
Posted: Wed Mar 01, 2006 05:59 PM
Enrico,

But there is a blank highlighted row when you do this:

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrw

    use test
    index on last to temp for recno()<1
    go top

    DEFINE DIALOG oDlg;
           SIZE 400, 400

    @ 1, 1 LISTBOX oBrw FIELDS alias "test"

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    RETURN NIL
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
TWBrowse refiniment
Posted: Wed Mar 01, 2006 07:11 PM
Try this:

#include "Fivewin.ch" 


FUNCTION MAIN() 

    LOCAL oDlg, oBrw 

    use test 
    index on field -> last to temp for recno()<1 
    go top 

    DEFINE DIALOG oDlg; 
           SIZE 400, 400 

    @ 1, 1 LISTBOX oBrw FIELDS alias "test" 

    oBrw:bLogicLen = { || ( oBrw:cAlias ) -> ( OrdKeyCount() ) }

    ACTIVATE DIALOG oDlg; 
             ON INIT oDlg:SetControl( oBrw ); 
             CENTER 

    RETURN NIL


EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TWBrowse refiniment
Posted: Wed Mar 01, 2006 07:18 PM

Enrico,

Ah, you got me again! That does work properly.

You may remember me stating recently that I often forget to assign bLogicLen. That is why I developed a TWBrowse modification to do it automatically. I hope to get that change included in the stock TWBrowse.

Tim, did you get that? Don't forget to assign bLogicLen.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
TWBrowse refiniment
Posted: Wed Mar 01, 2006 07:30 PM
James Bott wrote:Enrico,

Ah, you got me again!


:-)

James Bott wrote:You may remember me stating recently that I often forget to assign bLogicLen. That is why I developed a TWBrowse modification to do it automatically.


Me too. :-)

EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TWBrowse refiniment
Posted: Wed Mar 01, 2006 07:48 PM
Enrico,

It's back!

It shows when you do a filter containing no records. I think this will require a code change to fix.

This is actually what Tim said.

FUNCTION MAIN()

    LOCAL oDlg, oBrw

    use test
    //index on field -> last to temp for recno()<1
    set filter to recno() < 1
    go top

    DEFINE DIALOG oDlg;
           SIZE 400, 400

    @ 1, 1 LISTBOX oBrw FIELDS alias "test"

    oBrw:bLogicLen = { || ( oBrw:cAlias ) -> ( OrdKeyCount() ) }

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    RETURN NIL
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
TWBrowse refiniment
Posted: Wed Mar 01, 2006 08:44 PM

No, you simply forgot to add

REQUEST DBFCDX

and

RDDSETDEFAULT( "DBFCDX" )

Anyway, it seems to be a bug in DBFNTX. I will report it to the [x]Harbour developer's lists.

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TWBrowse refiniment
Posted: Wed Mar 01, 2006 09:04 PM

Enrico,

I see that it does work OK with CDXs.

I think the problem is with ordKeyNo(). With CDXs and no records in the filter, it reports zero. With NTXs it reports reccount() + 1.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
TWBrowse refiniment
Posted: Wed Mar 01, 2006 09:13 PM
James Bott wrote:Enrico,

I see that it does work OK with CDXs.

I think the problem is with ordKeyNo().


OrdKeyCount()

James Bott wrote:With CDXs and no records in the filter, it reports zero. With NTXs it reports reccount() + 1.


No, it returns exactly reccount().

I already reported the problem to Harbour and xHarbour developer's lists. Let's wait the Przemek's answer...

EMG

Continue the discussion