FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TsBrowse loosing scope
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
TsBrowse loosing scope
Posted: Sun Jul 13, 2008 02: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

Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
TsBrowse loosing scope
Posted: Sun Jul 13, 2008 03:08 PM

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

Regards,
Detlef

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TsBrowse loosing scope
Posted: Sun Jul 13, 2008 06: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
TsBrowse loosing scope
Posted: Sun Jul 13, 2008 08: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.
   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
Posts: 581
Joined: Tue Oct 11, 2005 11:28 AM
TsBrowse loosing scope
Posted: Sun Jul 13, 2008 08:51 PM

Hi Detlef,

I use the same version of TSbrowse as you, but I dont have this problem, but Im 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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TsBrowse loosing scope
Posted: Sun Jul 13, 2008 09: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
TsBrowse loosing scope
Posted: Sun Jul 13, 2008 09: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

Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
TsBrowse loosing scope
Posted: Sun Jul 13, 2008 09:20 PM

James,

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

Regards,
Detlef

Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
Re: TsBrowse loosing scope
Posted: 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:
oBrw:lNoResetPos := .F.
Regards.

Manuel Mercado
manuelmercado at prodigy dot net dot mx
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
TsBrowse loosing scope
Posted: Mon Jul 14, 2008 07: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

Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
TsBrowse loosing scope
Posted: Mon Jul 14, 2008 03: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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TsBrowse loosing scope
Posted: Mon Jul 14, 2008 03:55 PM
Detlef,

I suspect that this is the problem.

  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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
TsBrowse loosing scope
Posted: Mon Jul 14, 2008 04: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

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TsBrowse loosing scope
Posted: Mon Jul 14, 2008 04: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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Browse
Posted: Wed Jul 16, 2008 09: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