TsBrowse loosing scope

TsBrowse loosing scope

Postby Detlef Hoefner » Sun Jul 13, 2008 2:22 pm

Hi all,

im using Manuel's TsBrowse in version 6.13 ( The one modified by James Bott.)
I know that there's a newer version but i prefer the smaller one :wink:
But there is a serious problem with this browse.

When using a scope with dbfntx and you click into a window of an other application and come back to your own application then you can scroll in your TsBrowse beyond the scope which was set before.

Can onyone confirm this error or better, give help how to avoid this?

Thanks and regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Detlef Hoefner » Sun Jul 13, 2008 3:08 pm

I just found out that even with dbfcdx it's the same behaviour.

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby James Bott » Sun Jul 13, 2008 6:09 pm

Detlef,

Did you remember to set the alias of the browse?

Are you using TSBrowse's SELECT command to set the scope or the RDD's ordSetScope() function? [Note: Did you know that NTXs also support ordSetScope() now?]

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Detlef Hoefner » Sun Jul 13, 2008 8:09 pm

James,

thanks for jumping in.
I did not use the select command of TsBrowse but the RDD's ordSetScope() function.
Here is my Module.
Code: Select all  Expand view  RUN
   DbSelectArea( "bp" )
   bp->( OrdSetFocus( "bpopen" ) )  // it's a conditional index ( for xFlag == .t.  )

   bp->( ordScope( 0, bs->bestnr ) )
   bp->( ordScope( 1, bs->bestnr ) )

   REDEFINE BROWSE oBrw GRID ALIAS "bp" ID 20 OF oDlg

         ADD COLUMN TO oBrw;
         HEADER "Name" ;
         SIZE 70;
         DATA bp->name;
         ALIGN DT_LEFT

     ... Add some more columns



If i remain 'inside my app' the scope remains active.
But when clicking into a window of an other app like explorer or excel and i come back to my dialog, then i can scroll beyond the scope.
It looks like tsBrowse forgot the scope after loosing focus.

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Kleyber » Sun Jul 13, 2008 8:51 pm

Hi Detlef,

I use the same version of TSbrowse as you, but I don`t have this problem, but I`m just curious... Is there any ON PAINT in your ACTIVATE DIALOG or something that makes the scope be set to NIL?

Regards,

Kleyber
Kleyber Derick

FWH / xHb / xDevStudio / SQLLIB
User avatar
Kleyber
 
Posts: 581
Joined: Tue Oct 11, 2005 11:28 am
Location: São Luiz, Brasil

Postby James Bott » Sun Jul 13, 2008 9:06 pm

Detlef,

Since you are using ordSetScope() it would seem that the problem is not with TSBrowse as it has no control over the RDD's ordSetScope() method.

Can you provide a small self contained example of the problem?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Detlef Hoefner » Sun Jul 13, 2008 9:17 pm

Kleyber,

many thanks for your idea.
But i don't have any ON PAINT events coded.
Just an ON INIT obrw:SetFocus().

Thats all.

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Detlef Hoefner » Sun Jul 13, 2008 9:20 pm

James,

i'm just trying to extract the trouble module as a self containing sample.

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Re: TsBrowse loosing scope

Postby mmercado » Sun Jul 13, 2008 11:47 pm

Detlef Hoefner wrote:When using a scope with dbfntx and you click into a window of an other application and come back to your own application then you can scroll in your TsBrowse beyond the scope which was set before.
Hi Detlef:

Don't you have a bGotFocus or bLostFocus codeblock that is changing the order or the scope?

Anyway try this:
Code: Select all  Expand view  RUN
oBrw:lNoResetPos := .F.
Regards.

Manuel Mercado
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Postby Detlef Hoefner » Mon Jul 14, 2008 7:22 am

Hi all,

i still don't succeed to isolate my module as a self contained program to demonstrate the error.
If i do so it's working ok.

But at the moment i call my module sequent to my entry screen it's doing the error i described.
In the meanwhile i found out that the index is changing without any call to change it. :(
I set an index tag and after leaving my dialog and coming back the function OrdName() tells me the name of the very first tag in the index list.
So i don't wonder about the lost scope because the index is different.

I keep on searching.
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Detlef Hoefner » Mon Jul 14, 2008 3:08 pm

Hi All,

i finally got it ! :)
I don't really understand the reason but i know the reason.

There are 2 dialogs.
The first one has a master browse and a slave browse.
If you go through the master browse an array will be built and put to the slave browser as data source. The slave index is set to 1.

When you press the GO button a new dialog opens with a browse for slave records. But this time the index is set to 2.

If you click outside the program and come back, the slave index is now the first one because in the background the data fetching happened and put the index back.

I don't like this behaviour :?
Yes, i can avoid it by saving the index and recno in the data fetch module.
But i never thought before that controls of a dialog in the background can work against me.

Here finally a self contained example for this incl. prg and rc files.
http://www.d-hoefner.de/files/brwtest.zip

Thanks for all support.
Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby James Bott » Mon Jul 14, 2008 3:55 pm

Detlef,

I suspect that this is the problem.

Code: Select all  Expand view  RUN
  REDEFINE BROWSE oBrwBoss ALIAS "boss"  ID 10 OF oDlg;
      ON CHANGE (;
                  aData := aGetData( boss->master ),;
                  oBrwSlave:SetArray( aData ),;
                  oBrwSlave:Reset(),;
                  oBrwSlave:GoTop(),;
                  oBrwBoss:Setfocus();
                )


If a browse has another window drawn over it, then it gets focus again, the browse is repainted completely. I suspect than bChange is getting called when it is repainted. This should be easy enough to test, just add a msgbeep() to aGetData(), then try the window switching.

I suggest that in any function when you change the state of a database you should restore it at the end. So in aGetData() save and restore the index order and you problem will probably be solved. I would also save and restore the current record pointer.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Detlef Hoefner » Mon Jul 14, 2008 4:17 pm

James,

you are right.
I already changed my code to save the record number and the activer index order when fetching data in my function.

The crux as that i wasted 2 days searching the culprit for this behaviour.
I never thought that a browse in a modal dialog could work in the background. Repainting the screen content is ok but not doing 'hidden' database work.

I first thought TsBrowse was the culprit, sorry Manuel, but with TxBrowse it's the same.
I never stop learning. :?

Thanks and regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby James Bott » Mon Jul 14, 2008 4:27 pm

Detlef,

The crux as that i wasted 2 days searching the culprit for this behaviour.
I never thought that a browse in a modal dialog could work in the background. Repainting the screen content is ok but not doing 'hidden' database work.


I feel for you. I spent way more than 2 days on a similar problem with the browse getting repainted--that is why I haven't forgotten.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Browse

Postby TimStone » Wed Jul 16, 2008 9:32 pm

I wonder if data objects, ie. TData, would have the same problem.

With all the stuff I do with that browse, using tData, I don't seem to have that type of problem.
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: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 74 guests

cron