Possible to run 2 or 3 browser synchronously ?

Possible to run 2 or 3 browser synchronously ?

Postby ukoenig » Mon Jul 24, 2017 2:52 pm

Hello,

is it possible to show the same cell-/row-position of browser 1 in browser 2 ?
I explain :
Browser 1 shows the 12 month-values of 2017
Browser 2 shows the 12 month-values of 2016 using the same structure.
I have to check the values of 2017 in relation to 2016
Selecting something in browser 1, next I have to move to browser 2 to check the same month and cell-value.
It would be nice if changing the position in browser 1, browser 2 would move to the same position ( row / Col ).

Image

Sample :
Moving with the right arrow to the last column ( 27 ) and showing the totals of a month

Image

REDEFINE BTNBMP oBtn9 OF oFld:aDialogs[ 2 ] ;
ID 340 PIXEL ;
BORDER ;
FILENAME c_Pfad1 + "Rechts.Bmp" ;
ACTION ( oBrw2:SelectCol( 21, .T. ), oBrw2:Refresh(), ; // works
oBrw3:SelectCol( 21, .T. ), oBrw3:Refresh() ) ; // doesn't work
RIGHT
oBtn9:cToolTip = { "Spalten" + CRLF + "Ende","LISTE", 1, CLR_BLACK, 14089979 }
oBtn9:SetColor( 0, )
oBtn9:lTransparent := .T.

tested to move to the column of browser 2 the same column like browser 1
but doesn't work

WITH OBJECT oBrw2
:bChange := { || nCPos := oBrw2:SelectedCol():nCreationOrder, ;
oBrw3:SelectCol( nCPos, .T. ), oBrw3:Refresh() } // move to column-pos of browser 1 doesn*t work
END

regards
Uwe :?:
Last edited by ukoenig on Wed Oct 09, 2019 2:15 pm, edited 6 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Possible to run 2 browser synchronously ?

Postby James Bott » Mon Jul 24, 2017 5:12 pm

Uwe,

Can you just move oBrw3 to a different column and refresh it?

Did you use the oBrw3...of oDlg clause?

Just random ideas.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Possible to run 2 browser synchronously ?

Postby gkuhnert » Mon Jul 24, 2017 6:54 pm

Uwe,

this is a bit tricky, but this might work:

Code: Select all  Expand view
    oBrw1:bChange := {|| oBrw2:PostMsg( WM_KEYDOWN )}
    oBrw2:bChange := {|| oBrw1:PostMsg( WM_KEYDOWN )}
    oBrw1:lColChangeNotify := .t.
    oBrw2:lColChangeNotify := .t.
    oBrw1:OnKeyDown := {|| oBrw1:SelectCol(oBrw2:SelectedCol():nCreationOrder), oBrw1:Refresh()}
    oBrw2:OnKeyDown := {|| oBrw2:SelectCol(oBrw1:SelectedCol():nCreationOrder), oBrw2:Refresh()}
 


I'm still grateful to Antonio for giving me the tip of using PostMsg!!!
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Possible to run 2 browser synchronously ?

Postby ukoenig » Tue Jul 25, 2017 10:16 am

thank You very much

Gilbert,
Your solution works fine but only inside the visible area at startup.
Moving to other fields there is a problem

The test for download
I used customer.dbf as customer1.dbf and customer2.dbf ( same contens ) for the test

http://www.pflegeplus.com/DOWNLOADS/Sync.zip

works at startup on visible fields and selects row and col on second browser

Image

The record-position works but the column of browser 2 doesn't move

Image

regards
Uwe :?:
Last edited by ukoenig on Tue Jul 25, 2017 11:17 am, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Possible to run 2 browser synchronously ?

Postby gkuhnert » Tue Jul 25, 2017 11:14 am

Uwe,

sorry, I neglected one of your parameters from the example, this works with me (forgot the .t.):
Code: Select all  Expand view
oBrw1:OnKeyDown := {|| oBrw1:SelectCol(oBrw2:SelectedCol():nCreationOrder, .t.), oBrw1:Refresh()}
oBrw2:OnKeyDown := {|| oBrw2:SelectCol(oBrw1:SelectedCol():nCreationOrder, .t.), oBrw2:Refresh()}


But the view isn't exactly the same, as scrolling isn't synchronously.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Possible to run 2 browser synchronously ? ( Test-download )

Postby ukoenig » Tue Jul 25, 2017 11:34 am

Gilbert,

much better ( sample updated ).

But the view isn't exactly the same, as scrolling isn't synchronously.


As long the field is the same it is ok ( no need to search for the position in browser 2 anymore )
The solution is needed to check statistic-values between different years.

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Possible to run 2 browser synchronously ? ( Test-download )

Postby nageswaragunupudi » Thu Jul 27, 2017 1:17 pm

Please try this.
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oBrw1, oBrw2

   USE CUSTOMER NEW ALIAS CUST1 SHARED
   USE CUSTOMER NEW ALIAS CUST2 SHARED

   DEFINE DIALOG oDlg SIZE 800,800 PIXEL TRUEPIXEL ;
      TITLE "TWIN BROWSES"

   @  20,20 XBROWSE oBrw1 SIZE -20,380 PIXEL OF oDlg ;
      DATASOURCE "CUST1" AUTOCOLS ;
      CELL LINES NOBORDER

   @ 400,20 XBROWSE oBrw2 SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUST2" AUTOCOLS ;
      CELL LINES NOBORDER

   oBrw1:lColChangeNotify  := .t.
   oBrw1:bGotFocus   := { || SyncBrowses( oBrw1, oBrw2 ) }
   oBrw1:bChange     := { || If( oBrw1:lFocused, SyncBrowses( oBrw1, oBrw2 ), nil ) }

   oBrw2:lColChangeNotify  := .t.
   oBrw2:bGotFocus   := { || SyncBrowses( oBrw2, oBrw1 ) }
   oBrw2:bChange     := { || If( oBrw2:lFocused, SyncBrowses( oBrw2, oBrw1 ), nil ) }

   oBrw1:CreateFromCode()
   oBrw2:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED

return nil

//----------------------------------------------------------------------------//

function SyncBrowses( oBrw1, oBrw2 )

   WITH OBJECT oBrw2
      :BookMark      := oBrw1:BookMark
      :nRowSel       := oBrw1:nRowSel
      :nColSel       := oBrw1:nColSel
      :nColOffset    := oBrw1:nColOffset
      //
      :Refresh()
   END

return nil
 

Navigation in either browse is replicated in the other browse.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Possible to run 2 browser synchronously ? ( Test-download )

Postby ukoenig » Fri Jul 28, 2017 8:26 am

Mr. Rao,

thank You very much for the sample.
It works fine and keeps the row- and col-positions.

regards
Uwe :D
Last edited by ukoenig on Wed Oct 09, 2019 1:57 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Possible to run 2 browser synchronously ? ( Test-download )

Postby ukoenig » Sat Jul 29, 2017 7:04 pm

I added this sample to my sample-collector with some more options / tests.
1. Moving to browser top, left, bottom and right on button-action.
2. added a seekbar to browser 1 and 2
The sample displays 2 browser from resources

I noticed that the seekbar on browser 2 is not displayed.
Typing something in browser 2, the seek works

Image

...
...
DBSELECTAREA( "CUST1" )
DBSETORDER("CUST2")
CUST1->(DBGOTOP())

REDEFINE SAY oSay1 ID 105 PROMPT "CUST1.dbf -> set synchron to CUST2.dbf" OF oDlgMain FONT oMedium
oSay1:lTransparent := .T.

REDEFINE XBROWSE oBrw1 ID 110 OF oDlgMain ;
ALIAS 'CUST1' CELL LINES AUTOCOLS FONT oSFont COLOR 0, 14417848

oBrw1:lSeekBar := .t.
oBrw1:bClrEdits := { || { CLR_HRED, CLR_YELLOW } }

WITH OBJECT oBrw1
:bRecSelData := { || CUST1->(ORDKEYNO()) }
:bRecSelHeader := { |brw| "No." }
:bRecSelFooter := { |brw| brw:nLen }
:nRecSelWidth := 50
END

DBSELECTAREA( "CUST2" )
DBSETORDER("S_CUST")
CUST2->(DBGOTOP())

REDEFINE SAY oSay2 ID 115 PROMPT "CUST2.dbf -> set synchron to CUST1.dbf" OF oDlgMain FONT oMedium
oSay2:lTransparent := .T.

REDEFINE XBROWSE oBrw2 ID 120 OF oDlgMain ;
ALIAS 'CUST2' CELL LINES AUTOCOLS FONT oSFont COLOR 0, 14211327

oBrw2:lSeekBar := .t.
oBrw2:bClrEdits := { || { CLR_HRED, CLR_YELLOW } }


WITH OBJECT oBrw2
:bRecSelData := { || CUST2->(ORDKEYNO()) }
:bRecSelHeader := { |brw| "No." }
:bRecSelFooter := { |brw| brw:nLen }
:nRecSelWidth := 50
END

oBrw1:lColChangeNotify := .t.
oBrw1:bGotFocus := { || SyncBrowses( oBrw1, oBrw2 ) }
oBrw1:bChange := { || If( oBrw1:lFocused, SyncBrowses( oBrw1, oBrw2 ), nil ) }

oBrw2:lColChangeNotify := .t.
oBrw2:bGotFocus := { || SyncBrowses( oBrw2, oBrw1 ) }
oBrw2:bChange := { || If( oBrw2:lFocused, SyncBrowses( oBrw2, oBrw1 ), nil ) }

...
...

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Possible to run 2 browser synchronously ? ( Test-download )

Postby ukoenig » Wed Oct 09, 2019 1:45 pm

Mr. Rao,

my new project is a little bit more complicated
I have a file splitted in 3 browser-sections ( each section = 1 browser )
Browser 3 shows a horizontal scrollbar
NO vertical synchronous needed !!!

The file is splitted in 3 sections
each section is filtered to group and section

oProj := TDatabase():Open( , "PROJECT", "DBFCDX", .T. )
oProj:CreateIndex( "PROJECT", "PROJ1", "Group + Section + Position", .F. )
oProj:Close()
oProj1 := TDatabase():Open( , "PROJECT", "DBFCDX", .T. )
oProj1:SetOrder( "PROJ1", "PROJECT" )
oProj2 := TDatabase():Open( , "PROJECT", "DBFCDX", .T. )
oProj2:SetOrder( "PROJ1", "PROJECT" )
oProj3 := TDatabase():Open( , "PROJECT", "DBFCDX", .T. )
oProj3:SetOrder( "PROJ1", "PROJECT" )

is it possible to show all 3 browsers horizontal synchronous using the logic from above ?
the scrollbar belongs to all three browser

each browser is filtered like

oProj1:ORDSCOPE(0, NIL ) // reset
oProj1:ORDSCOPE(1, NIL ) // reset
oProj1:ORDSCOPE(0, "A1" ) // set top scope B1, C1 = group + section
oProj1:ORDSCOPE(1, "A5" ) // set bottom scope B5, C5
oProj1:GoTop()

3 Groups, 5 sections and 7 positions each section
with the radios You can select / display a full section without seek

Image

the same is used to collect and connect to useful topics from the forum
splitted in different groups total < 3 x 5 x 7 > ( 5 can be extended )

Image

best regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Possible to run 2 or 3 browser synchronously ?

Postby ukoenig » Fri Oct 11, 2019 7:14 pm

tested and works

to cover all possible combinations of 3 browser :

Code: Select all  Expand view
oBrw1:lColChangeNotify  := .t.
oBrw1:bGotFocus         := { || Sync( 1, oBrw1, oBrw2, oBrw3 ) }
oBrw1:bChange           := { || If( oBrw1:lFocused, Sync( 1, oBrw1, oBrw2, oBrw3 ), nil ) }

oBrw2:lColChangeNotify  := .t.
oBrw2:bGotFocus         := { || Sync( 2, oBrw1, oBrw2, oBrw3 ) }
oBrw2:bChange           := { || If( oBrw2:lFocused, Sync( 2, oBrw1, oBrw2, oBrw3 ), nil ) }

oBrw3:lColChangeNotify  := .t.
oBrw3:bGotFocus         := { || Sync( 3, oBrw1, oBrw2, oBrw3 ) }
oBrw3:bChange           := { || If( oBrw3:lFocused, Sync( 3, oBrw1, oBrw2, oBrw3 ), nil ) }

//----------------------  

FUNCTION SYNC( nBrw, oSBrw1, oSBrw2, oSBrw3 )

IF nBrw = 1
    oSBrw2:nColSel      := oSBrw1:nColSel
    oSBrw2:nColOffset   := oSBrw1:nColOffset
    oSBrw2:Refresh()
    oSBrw3:nColSel      := oSBrw1:nColSel
    oSBrw3:nColOffset   := oSBrw1:nColOffset
    oSBrw3:Refresh()
ELSEIF nBrw = 2
      oSBrw1:nColSel        := oSBrw2:nColSel
      oSBrw1:nColOffset     := oSBrw2:nColOffset
      oSBrw1:Refresh()
      oSBrw3:nColSel        := oSBrw2:nColSel
      oSBrw3:nColOffset     := oSBrw2:nColOffset
      oSBrw3:Refresh()
ELSEIF nBrw = 3
       oSBrw1:nColSel       := oSBrw3:nColSel
       oSBrw1:nColOffset        := oSBrw3:nColOffset
       oSBrw1:Refresh()
      oSBrw2:nColSel        := oSBrw3:nColSel
      oSBrw2:nColOffset     := oSBrw3:nColOffset
      oSBrw2:Refresh()
ENDIF

RETURN NIL


regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 86 guests