Multiple TXBrowse() Windows for related data tables

Multiple TXBrowse() Windows for related data tables

Postby PatrickWeisser » Fri Mar 30, 2007 11:59 am

Hello everyone. Does anyone know of any examples of TXBrowse() being used to display two tables held in a one-to-many relationship? The main problem is getting the parent TXBrowse() to send a refresh message to the second TXBrowse() window when the record position of the parent browse changes. It would be nice if I could set a code block notification in the Parent browse that would fire whenever the parent record pointer moves, and send a message to the child browse to completely refresh. In the class help file for TXBrowse() the closest thing I see to this is the :bSkip block which would certainly be notified when a parent record move is made because it would have to actually implement it. Is there a way to get notification of record position change without having to write a custom skip block for the parent browse? Thanks!
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby Kleyber » Fri Mar 30, 2007 4:17 pm

Patrick,

I use this way:

Code: Select all  Expand view
   oBrwVen                  := TXBrowse():New( oDlg1 )
   oBrwVen:nMarqueeStyle    := MARQSTYLE_HIGHLROW
   oBrwVen:nColDividerStyle := LINESTYLE_LIGHTGRAY
   oBrwVen:nRowDividerStyle := LINESTYLE_LIGHTGRAY
   oBrwVen:bSeek            := {|c| DbSeek( Upper( c ) ) }
   oBrwVen:bChange := {||VEI->(OrdScope(0,cNLoja+VEN->nupd)),VEI->(OrdScope(1,cNLoja+VEN->nupd)),VEI->(DbGoTop()),oBrwVen2:GoTop(),oBrwVen2:Refresh()}

   oCol := oBrwVen:AddCol()
      oCol:cHeader       := "Venda"
      oCol:bStrData      := { || VEN->nupd  }
      oCol:nDataStrAlign := AL_LEFT
      oCol:nHeadStrAlign := AL_LEFT
      oCol:nWidth        := 71
      oCol:bLClickHeader := {|| Checa_Indices(1,1,oBrwVen,"VEN") }
      oCol:AddBmpFile( "BLANK.BMP", .T. )
      oCol:AddBmpFile( "CLIP.BMP", .T. )
      oCol:nHeadBmpNo := 1

....
....
   oBrwVen2                  := TXBrowse():New( oDlg1 )
   oBrwVen2:nMarqueeStyle    := MARQSTYLE_HIGHLROW
   oBrwVen2:nColDividerStyle := LINESTYLE_LIGHTGRAY
   oBrwVen2:nRowDividerStyle := LINESTYLE_LIGHTGRAY

   oCol := oBrwVen2:AddCol()
      oCol:cHeader       := "Venda"
      oCol:bStrData      := { || VEN->nupd  }
      oCol:nDataStrAlign := AL_LEFT
      oCol:nHeadStrAlign := AL_LEFT
      oCol:nWidth        := 71
      oCol:bLClickHeader := {|| Checa_Indices(1,1,oBrwVen,"VEN") }
      oCol:AddBmpFile( "BLANK.BMP", .T. )
      oCol:AddBmpFile( "CLIP.BMP", .T. )
      oCol:nHeadBmpNo := 1
....
....


Hope this helps
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 PatrickWeisser » Fri Mar 30, 2007 9:48 pm

Hello Kleyber. That's work very well, thank you so much! The big thing I needed to know about was the :bChange block (I didn't see it in the available methods of the TXBrowse() documentation.

One thing, how do you handle the case of their being no related records in the Vei table for the current Ven record? In my test, the Vei table remains on the related records for the previous Ven record. Is there a way to have the child Vei browse simply show no records in that case? I tried setting oBrwVen2:nDataLines to zero in that case but that didn't clear the browse display. Thanks!
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Refresh Browse

Postby Colin Haig » Sat Mar 31, 2007 12:22 am

Patrick

I use a scope for the related records - and on the bChange clear the
scope and set another scope for the next set records and if no records match then I hide the browse oLbx:Hide().

Colin
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Postby PatrickWeisser » Sat Mar 31, 2007 1:20 am

Thanks Colin that certainly works, but if the user is scrolling though records in the parent table, it creates a flashing effect as the child browse is refreshed and changes to grey with no grid lines for those parent records for which no related records exist in the child table. I'll use that for now, but eventually I'd like to find a way to keep the column titles and grid lines, just have no data showing when there are no related records.

:Hide is another TXBrowse() method that I don't see in the TXBrowse class definition in the FiveWin documentation, so I'm sure glad you guys know about it. Hopefully the FiveWin .chm files will be updated again soon.

-Patrick
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby Antonio Linares » Sat Mar 31, 2007 9:43 am

Patrick,

Class TXBrowse inherits from Class TControl which inherits from Class TWindow. So there are DATAs and Methods that you don't see in Class TXBrowse source code as they are declared in those parent classes, i.e. Hide()

The docs are quite updated :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby PatrickWeisser » Sat Mar 31, 2007 5:48 pm

Antonio,

Actually my copy of the fwclass.chm file does not have a :Hide() method in the TControl class (the closest thing is a HideDots() method). Also, the formatting of the fwclass.chm file seems very strange compared with the very nice and orderly formatting of the other help files such as fwfun.chm where Syntax, Returns, Comments, etc. are nicely separated. So I'm wondering if my copy of fwclass.chm might possible be damaged. I'm attaching an image of how it looks on my screen.

Image[/img]
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby Enrico Maria Giordano » Sat Mar 31, 2007 5:51 pm

From TWindow docs:

Hide Hide window Syntax: TWindow:Hide() \\ Purpose: Hides the window, and brings another one to the top.


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby PatrickWeisser » Sat Mar 31, 2007 6:28 pm

Hey Enrico,

What's the actual name of the file that's in? Maybe I'm missing something. The chm files I have are:

Directory of C:\FWH\MANUAL

11/02/2003 06:41 AM 567,167 fivewin.chm
03/02/2006 08:57 AM 522,563 fwclass.chm
02/03/2005 10:32 AM 185,193 fwcmd.chm
03/02/2006 09:03 AM 1,008,766 fwfun.chm

The hlp files I have are are quite old, so I thought the chm files are complete replacements for them. But the ones I have are:

Directory of C:\FWH\MANUAL

12/19/2001 12:14 PM 55,293 fiveodbc.hlp
11/19/2002 07:14 PM 345,862 fwclass.hlp
11/19/2002 07:27 PM 269,883 fwcmd.hlp
11/19/2002 07:02 PM 616,700 fwfun.hlp
07/04/2001 06:45 PM 213,338 fwprog.hlp

Thanks - Patrick
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby Enrico Maria Giordano » Sat Mar 31, 2007 6:41 pm

It is in fwclass.chm. It wont's come up with a search but it is there.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 63 guests