Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Resizing Docked Form's Height Programmatically
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01017705
Message ID:
01018217
Views:
65
Yep, with the graphic it looks sweet. Using a graphic does pose some problems such as allowing the developer/user to pick the gradient or basing the gradient off the theme picked in XP, but I must say it does look really nice. As you've noted there are a lot of problems that will need to be worked out, right now if you dock that toolbar it doesn't size the rect right and you just get a sliver of toolbar showing... but that is just a parameter adjustment... also there would need to be some handling in the after dock even in case the develoepr/user put the toolbar on left or right side of the screen. And the container needs to have MouseDown, MouseMove, etc. code added to handle moving the toolbar around on the screen. You probably already have all this stuff in mind and I understand this is jsut a rough draft, but I'm just giving my thoughts on what I see.

>Sir Craig!
>
>> To get rid of more of the margins ... just increase the first two parameters sent to SetDisplayRegion and decrease the last two parameters until all of the border is gone.
>
>Awesome! You da' MAN! HOT POTATO software it is! I can't tell you how unbelievably excited I am that this is possible!!!
>
>:) :) :)
>
>I've posted another tweaked version of your code at the end of this code so you can see what I'm so excited about.
>
>> And, as to the gradient ... that's gonna be a tough one
>
>Oh, yea have little faith! The main container that we add to your magic toolbar takes care of this for us. Just set this master container's .Picture property to a tiny gradient .BMP file and presto, a sexy Office 2003 style container. My tweaked version of your code adds a shape control to provide a border effect. Naturually this is optional and there may be cases where you don't want a border for a truely seamless integration into a specific GUI. Thanks to your code both are possible.
>
>In order to see what I'm seeing you need to supply a gradient image for your container. I've posted a sample 1 x 25 gradient modeled on Office 2003 look and feel at the following (case sensitive) URL. This is a 354 byte download. A lot of visual bang in such a little package.
>
>http://bdurham.com/downloads/tbar_blue.bmp
>
>Here's the modified version of your code that I'm looking at:
>
>
>PUBLIC goToolbar
>goToolbar = CREATEOBJECT("BorderlessToolbar")
>goToolbar.Show()
>
>DEFINE CLASS BorderlessToolbar as Toolbar
>
>	Top  =  0  && hide top margin (take into consideration border, titlebar
>	Left =  0  && hide left margin
>
>	* my init
>	PROCEDURE Init()
>		* add main container which we use to control size and visual presentation (borders, picture, etc)
>		this.AddObject( "cntMain", "Container" )
>		with This.cntMain
>			.Height = 25
>			.Width = 800 && screenwidth + 2
>			.BorderColor = 255
>			.BorderWidth = 1
>			.Backcolor = rgb( 224, 255, 255 )
>			.Picture = "tbar_blue.bmp"
>			
>			* add border since container .Picture overwrites container .Border
>			.AddObject( "shpBorder", "Shape" )
>			.shpBorder.BorderStyle = 1
>			.shpBorder.BackStyle = 0			
>			.shpBorder.Move( 0, 0, .Width, .Height  )
>			.shpBorder.Visible = .T.
>			
>			* add exit button
>			.AddObject( "btnExit", "Exitbutton" )
>			.btnExit.Move( 2, 2, 80, 20 )
>			.btnExit.Visible = .T.
>			
>			.Visible = .T.
>		endwith
>		
>	ENDPROC
>
>	PROCEDURE Show
>		LPARAMETERS nStyle
>		IF DODEFAULT(nStyle)
>			this.Resize()
>		ENDIF
>	ENDPROC
>
>	PROCEDURE Resize
>		this.SetDisplayRegion(3, SYSMETRIC(9) - 5, this.Width + 3, this.Height + SYSMETRIC(9) - 4)
>	ENDPROC
>
>	PROCEDURE AfterDock
>		LPARAMETERS nLocation, oForm
>		this.SetDisplayRegion(0, 0, this.Width, this.Height)
>	ENDPROC
>
>	PROCEDURE Undock
>		LOCAL lnDockPosition
>		lnDockPosition = this.DockPosition
>		IF INLIST(lnDockPosition, 0, 3)
>			this.SetDisplayRegion(3, SYSMETRIC(9) - 5, this.Width - 5, this.Height+ SYSMETRIC(9) - 5)
>		ELSE
>			this.SetDisplayRegion(3, SYSMETRIC(9), this.Width + 1, this.Height + SYSMETRIC(9) - 13)
>		ENDIF
>	ENDPROC
>
>	PROCEDURE SetDisplayRegion(tnX1, tnY1, tnX2, tnY2)
>		DECLARE INTEGER DeleteObject IN gdi32 INTEGER hObject
>		DECLARE INTEGER CreateRectRgn IN gdi32;
>			INTEGER X1, INTEGER Y1, INTEGER X2, INTEGER Y2
>		DECLARE INTEGER SetWindowRgn IN user32 ;
>			INTEGER HWND, INTEGER hRgn , INTEGER bRedraw
>
>		* increase the first two parameters sent to SetDisplayRegion and decrease the last two parameters
>		* until all of the border is gone.
>		tnX1 = tnX1 + 6
>		tnY1 = tnY1 + 3
>		tnX2 = tnX2 - 4
>		tnY2 = tnY2 - 4	
>		
>		RegiondeLinea = CreateRectRgn(tnX1, tnY1, tnX2, tnY2)
>		SetWindowRgn(This.Hwnd, RegiondeLinea, 1)
>		DeleteObject(RegiondeLinea)
>	ENDPROC
>
>ENDDEFINE
>
>DEFINE CLASS ExitButton as CommandButton
>	Caption = "Exit Toolbar"
>	
>	FontSize = 8
>	
>	* updated to reflect parent container
>	PROCEDURE Click
>		this.Parent.Parent.Release()
>	ENDPROC
>ENDDEFINE
>
>
>There's still a lot to be done to repackage all this as a generic reusable class but you've given me and the rest of the VFP community a wonderful foundation on which to build new GUI interfaces. For me, my VFP 9 just got upgraded to VFP 10!
>
>THANK - YOU!
>
>Malcolm
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform