TWBrowse refiniment

TWBrowse confusing display

Postby TimStone » Mon Feb 27, 2006 7: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
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: TWBrowse confusing display

Postby Enrico Maria Giordano » Mon Feb 27, 2006 7:15 pm

I see no blank row in the following sample. Do you?

Code: Select all  Expand view  RUN
#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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Wed Mar 01, 2006 5:59 pm

Enrico,

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

Code: Select all  Expand view  RUN
#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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Wed Mar 01, 2006 7:11 pm

Try this:

Code: Select all  Expand view  RUN
#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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Wed Mar 01, 2006 7: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Wed Mar 01, 2006 7:30 pm

James Bott wrote:Enrico,

Ah, you got me again!


:D

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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Wed Mar 01, 2006 7: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.

Code: Select all  Expand view  RUN
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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Wed Mar 01, 2006 8: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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Wed Mar 01, 2006 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Wed Mar 01, 2006 9: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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 56 guests