Page 1 of 1

On Window, In order: Menu, BtnBar, Tabs, Browse, Status

Posted: Fri May 28, 2010 3:54 am
by arpipeline
I am having difficulty making a tab control behave properly. I have an SDI window with a menu, button bar, browse and status bar. I want to wedge a tab control between the button bar and browse so that users can click a tab and change the state of the browse data.

Like so stacked:
Button Bar
Tabs
Browse
Status

When using oBtnBar:oBottom := oTabs, the tabs are inset and cover the bitmaps - same problem with oBrowse:oBottom := oTabs.

Even if I decide to put the tabs at the bottom of the window below the browse ( oWnd:oBottom := oTabs ), causes the tabs to cover the status bar of the window.

How do I handle this so that everything is stacked properly, and resizes properly when the main window is resized.

TIA,

Andy

Re: On Window, In order: Menu, BtnBar, Tabs, Browse, Status

Posted: Sat May 29, 2010 12:27 am
by nageswaragunupudi
Please see xbrswap1.prg in the fwh\samples folder

Re: On Window, In order: Menu, BtnBar, Tabs, Browse, Status

Posted: Sat May 29, 2010 3:27 am
by arpipeline
Thanks, but I don't have the file in my samples folder. I am using FW 9.04.

Andy

Re: On Window, In order: Menu, BtnBar, Tabs, Browse, Status

Posted: Sat May 29, 2010 12:09 pm
by nageswaragunupudi
Sample code:

Code: Select all

#include "FiveWin.Ch"
#include "xbrowse.ch"

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

function Main()

   local oWnd, oPanel, oBar, oTabs
   local aBrw[ 2 ]
   local aData1 := { {1,2,3},{4,5,6},{7,8,9} }
   local aData2 := { {'AA','BB','CC','DD'},{'EE','FF','GG','HH'}, ;
                     {'II','JJ','KK','LL'},{'MM','NN','OO','PP'}}

   aData2 := { {10,20,30},{40,50,60},{70,80,90} }


   DEFINE WINDOW oWnd
   DEFINE BUTTONBAR oBar OF oWnd  2007
   SET MESSAGE OF oWnd to '' 2007

   oPanel   := TPanel():New( ,,,, oWnd )
   oWnd:oClient := oPanel

   @ 0,0 XBROWSE aBrw[ 1 ] OF oPanel ;
      HEADERS 'One', 'Two', 'Three' ;
      ARRAY aData1 AUTOCOLS CELL LINES FOOTERS

   aBrw[ 1 ]:CreateFromCode()

   @ 0,0 XBROWSE aBrw[ 2 ] OF oPanel ;
      HEADERS 'AAAA', 'BBBB', 'CCCC' ;
      ARRAY aData2 AUTOCOLS CELL LINES

   aBrw[ 2 ]:CreateFromCode()
   aBrw[ 2 ]:Hide()

   oPanel:oClient := aBrw[ 1 ]

   @ 400,0 TABS oTabs PROMPTS 'First', 'Second' OF oPanel ;
      ON CHANGE ChangeBrw( nOption, nOldOption, aBrw )

   oPanel:oBottom := oTabs

   ACTIVATE WINDOW oWnd

return ( 0 )

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

static function ChangeBrw( nNew, nOld, aBrw )

   aBrw[ nOld ]:Hide()
   aBrw[ nNew ]:oWnd:oClient := aBrw[ nNew ]
   aBrw[ nNew ]:Enable()
   aBrw[ nNew ]:Show()
   aBrw[ nNew ]:oWnd:Resize()

return nil

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

Re: On Window, In order: Menu, BtnBar, Tabs, Browse, Status

Posted: Sat May 29, 2010 4:54 pm
by arpipeline
Thank you! A panel was the ticket - I was trying to do everything at the window level.

Andy