` Printed Icetips Article

Icetips Article



Par2: Multiple files on multiple browse tabs using Name()
1998-08-31 -- Lew Strock
 
Where MyFile uses GLO:MyFile for its Name() and you want to display
different physical files on each tab of a browse:

CODE SNIP	for the tab changing files for browsing in a listbox

    ThisWindow.TakeNewSelection
	|
    OF ?CurrentTab
      ! change to another file as directed by tabs
      ACCESS:MyFile.Close
        Case Choice(?CurrentTab)
          Of 1 !Score
             GLO:MyFile = 'C:\c1.dat'
          Of 2 !Penalty
             GLO:MyFile = 'C:\c2.dat'
          Of 3 !Bonus
             GLO:MyFile = 'C:\c3.dat'
          Of 4 !Tie Breaker
             GLO:MyFile = 'C:\c4.dat'
        End
      ACCESS:MyFile.Open
      ACCESS:MyFile.UseFile
      BRW1.ResetFromFile()
      ! End of "Control Event Handling"
    END

This worked as expected.  BUT, using Edit in Place ...

I found that after getting the tabs to switch files  for the browser's listbox 
there was another problem.  All related to event driven design.  

If a choice to insert  or change a record was made, a mouseclick on a tab
other than the one related to the current file would  give the "new" tab focus.  
But, nothing else would happen.

So a "NEW' tab would appear as the active BUT showing  the "OLD" listbox 
records.  Not good.

A "solution" was found.

CODE SNIP	to get a browse engaged in insert or change
		activity to focus entirely on a NEW tab selection

ThisWindow.TakeFieldEvent
	|
   CASE Field()
	|
       OF ?CurrentTab
       	|
          CASE EVENT()
	  OF EVENT:TabChanging
	        ThisWindow.TakeNewSelection	! the TRICK
	|

The trick gives to desired result. I don't know if it's the right solution though. 
But, it works.



Printed November 21, 2024, 11:59 am
This article has been viewed/printed 35195 times.