Re: xControls (Don!)

new topic     » goto parent     » topic index » view thread      » older message » newer message

> -- I modified the geometry example to show what I mean:
> -- why doesn't it take the statusbar into account?
> -- i looked at the code and it seems to be using
> -- getClientRect(), which is the right rect, right?! :)
> -- Don, can you fix this? Thanks!!!
> 
> without warning
> 
> include Win32Lib.ew
> include xControls.ew
> 
> constant
> main		= create( Window, "", NULL, 0.25, 0.25, 0.5, 0.5, 0 ),
> ID1			= create( Window, "", main, 0, 0, 1, 1, {WS_CHILD,WS_VISIBLE} ),
> ID2			= create( Window, "", main, 0, 0, 1, 1, {WS_CHILD,WS_VISIBLE} ),
> sbar		= create( StatusBar, "", main, 0,0,0,0,0 ),
> GMID		= xControl( Geometry, "", main, 0, 0, 0, 0, 0, 0 )
> 
> manage( GMID, ID1, {0.0, 5}, {0, 5}, {0.5, 00}, {1.0 , -5} )
> manage( GMID, ID2, {ID1, 5}, {0, 5}, {1.0, -5}, {0.5 , 00} )
> 
> procedure ModifyWinColors( integer self, integer event, sequence parms )
> 	setWindowBackColor( ID1, #FF0000 )
> 	setWindowBackColor( ID2, #FF00FF )
> end procedure
> setHandler( main, w32HOpen, routine_id("ModifyWinColors") )
> 
> WinMain( main, Normal )
> 
> -- end of program
> 
> -=ck
> "Programming in a state of EUPHORIA."

Yeah, actually I wish I could fix this... well actually I *could* but
it would be a tremedous hassle and slow it down.

GetClientRect itself does not take into account controls in the client
area; it does just what the function implies.  It returns the whole
client rectangle regardless if some portion of the client is "hidden"
by a control.  And of course a Status Bar is a control.

The only way to (currently) get around this is to dynamically modify
the geometry object upon resize... glad I coded it in now =)

-=-=-=-=-=-=-=-=-=-=-=-=-
without warning

include Win32Lib.ew
include xControls.ew

constant
main		= create( Window, "", NULL, 0.25, 0.25, 0.5, 0.5, 0 ),
ID1			= create( Window, "", main, 0, 0, 1, 1, {WS_CHILD,WS_VISIBLE} ),
ID2			= create( Window, "", main, 0, 0, 1, 1, {WS_CHILD,WS_VISIBLE} ),
sbar		= create( StatusBar, "", main, 0,0,0,0,0 ),
GMID		= xControl( Geometry, "", main, 0, 0, 0, 0, 0, 0 )

manage( GMID, ID1, {0.0, 5}, {0, 5}, {0.5, 00}, {1, -5} )
manage( GMID, ID2, {ID1, 5}, {0, 5}, {1.0, -5}, {0.5 , 00} )

procedure ModifyWinColors( integer self, integer event, sequence parms )
	setWindowBackColor( ID1, #FF0000 )
	setWindowBackColor( ID2, #FF00FF )
end procedure
setHandler( main, w32HOpen, routine_id("ModifyWinColors") )

-- use this to dynamically change the offset in case the
-- size of control changes...
procedure AdjustWindow( integer self, integer event, sequence parms )
	sequence Size
	Size = getCtlSize(sbar)
	manage( GMID, ID1, {0.0, 5}, {0, 5}, {0.5, 00}, {1, -Size[2]-3} )
end procedure
setHandler( main, w32HResize, routine_id("AdjustWindow") )

-- force a resize
VOID = invokeHandler( main, w32HResize, {0,0,0} )
WinMain( main, Normal )
-=-=-=-=-=-=-=-=-=-=-=-=-


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu