How to resize oPanel

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

How to resize oPanel

Post by Otto »

The new TABs are really nice. Thank you Antonio for the great work.

I tried with a TAB and Panels with a BUTTONBAR on each.
Changing the TAB I hide one Panel and show the other one.
But how can I resize the Panel’s width if I change the windows width.
I tried like this: ON RESIZE ( oPanel:nRight=oWnd:nWidth() ) of the window
but the Panel remains.

Thanks in advance
Otto

Image

#include "FiveWin.ch"

static oWnd

function Main()

local oBar,oBar2, oPopup, oBtn , oTabs2,oPanel,oPanel2

SetBalloon( .T. ) // Balloon shape required for tooltips

DEFINE WINDOW oWnd TITLE "Office 2007"

@ 8, 0 TABS oTabs2 PROMPTS "&One", "&Two", "T&hree", "&Four" OF oWnd;
BITMAPS "..\bitmaps\16x16\people.bmp", "..\bitmaps\16x16\open2.bmp",;
"..\bitmaps\16x16\print.bmp", "..\bitmaps\16x16\zoom2.bmp" ;
ACTION f_tab(oTabs2:nOption,oPanel,oPanel2)
oWnd:oTop = oTabs2

oPanel := TPanel():New( 18, 0, 75, oWnd:nWidth(), oWnd )
DEFINE BUTTONBAR oBar OF oPanel SIZE 60, 60 2007
DEFINE BUTTON OF oBar ACTION Print() ;
RESOURCE "attach" PROMPT "Attach" TOOLTIP "Attach"
DEFINE BUTTON OF oBar ACTION MsgInfo( "calendar" ) ;
RESOURCE "calendar" PROMPT "Calendar" WHEN .F. TOOLTIP "Calendar"

MENU oPopup POPUP
MENUITEM "One" ACTION MsgInfo( 1 )
MENUITEM "Two" ACTION MsgInfo( 2 )
ENDMENU

DEFINE BUTTON oBtn OF oBar ACTION oBtn:ShowPopup() ;
RESOURCE "people" PROMPT "Clients" GROUP ;
MENU oPopup TOOLTIP "Clients"

DEFINE BUTTON OF oBar ACTION Test() ;
RESOURCE "print" PROMPT "Print" TOOLTIP "Print"

oPanel2 := TPanel():New( 18, 0, 75, oWnd:nWidth(), oWnd )
DEFINE BUTTONBAR oBar2 OF oPanel2 SIZE 60, 60 2007

DEFINE BUTTON OF oBar2 ACTION Print() ;
RESOURCE "attach" PROMPT "Attach" TOOLTIP "Attach"

DEFINE BUTTON OF oBar2 ACTION MsgInfo( "calendar" ) ;
RESOURCE "calendar" PROMPT "Calendar" WHEN .F. TOOLTIP "Calendar"

SET MESSAGE OF oWnd TO "Testing the ButtonBar 2007 Office look" ;
CENTERED CLOCK KEYBOARD 2007

ACTIVATE WINDOW oWnd ON INIT (oPanel2:hide()) ON RESIZE ( oPanel:nRight=oWnd:nWidth() ) ;
VALID MsgYesNo( "Do you want to end?" )

return nil

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

function Print()

local oPrn

PRINTER oPrn PREVIEW
PAGE
oPrn:Say( 2, 2, "Hello" )
ENDPAGE
PAGE
oPrn:Say( 2, 2, "Bye" )
ENDPAGE
ENDPRINT

return nil

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

function Test()

local oDlg, cPass := Space( 4 )

DEFINE DIALOG oDlg RESOURCE "test"

REDEFINE GET cPass ID 100 OF oDlg

ACTIVATE DIALOG oDlg CENTERED

MsgInfo( GetGuiResources() )

return nil

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


procedure AppSys // XBase++ requirement

return

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



func f_tab(nOption,oPanel,oPanel2)
if nOption=2
oPanel:hide()
oPanel2:show()

elseif nOption=1
oPanel2:hide()
oPanel:show()

endif

return


User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Mr Otto

This is very very nice. I wanted to do something like this. :)
Regards

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

Post by nageswaragunupudi »

Easier is to say oWnd:oCilent := oPanel

Can you try to put buttonbar and tabs into Rebar ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello NageswaraRao,
I tried your suggestion but had no success. Maybe this is the wrong place.
Could you please try to compile the source.
Regards,
Otto

@ 8, 0 TABS oTabs2 PROMPTS "&One", "&Two", "T&hree", "&Four" OF oWnd;
BITMAPS "..\bitmaps\16x16\people.bmp", "..\bitmaps\16x16\open2.bmp",;
"..\bitmaps\16x16\print.bmp", "..\bitmaps\16x16\zoom2.bmp" ;
ACTION f_tab(oTabs2:nOption,oPanel,oPanel2)
oWnd:oTop = oTabs2
oPanel := TPanel():New( 18, 0, 75, oWnd:nWidth(), oWnd )
oWnd:oCilent := oPanel
========
Path and name: c:\FWH\samples\test2007.exe (32 bits)
Size: 1,154,048 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 02/15/08, 20:14:48
Error description: Error BASE/1005 Message not found: TWINDOW:_OCILENT
Args:
[ 1] = O Object
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello NageswaraRao, do you think I get a problem if I use for example
nWidht = 2000?

oPanel := TPanel():New( 18, 0, 75, 2000, oWnd )
Regards,
Otto
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Hi Otto,
Otto wrote: oWnd:oTop = oTabs2
oPanel := TPanel():New( 18, 0, 75, oWnd:nWidth(), oWnd )
oWnd:oCilent := oPanel <----
small typo, should be oWnd:oClient

Did you try this ?

Code: Select all

ON RESIZE oPanel:Move (...) 
kind regards
Stefan
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Thank you, danke Stefan.
I will try.
Regards,
Otto
Post Reply