1. Win32Lib: Must be a Flag

Normally, when a child window is maximized, it fills its parent window.
When the parent window is resized, the child window stays maximized.
However, with Win32Lib, when the parent is resized, the child does NOT
conform to the new size. Is there a flag to use that will cause the
child window to remain maximized when its parent is resized?

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view message » categorize

2. Re: Win32Lib: Must be a Flag

cklester wrote:
> 
> Normally, when a child window is maximized, it fills its parent window.
> When the parent window is resized, the child window stays maximized.
> However, with Win32Lib, when the parent is resized, the child does NOT
> conform to the new size. Is there a flag to use that will cause the
> child window to remain maximized when its parent is resized?

I think you are talking about true MDI (multiple document interface). 

Win32lib does not yet support MDI, but you can easily simulate the effect
you mention. Do something like ...

procedure Resize_MainWin(integer self, integer event, sequence parms)
   sequence lRect

   lRect = getClientRect(self)
   setRect(ChildWin, 0, 0, lRect[3], lRect[4], w32True)
end procedure
setHandler(MainWin, w32HResize, routine_id("Resize_MainWin"))

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

3. Re: Win32Lib: Must be a Flag

Derek Parnell wrote:
> 
> cklester wrote:
> > 
> > Normally, when a child window is maximized, it fills its parent window.
> > When the parent window is resized, the child window stays maximized.
> > However, with Win32Lib, when the parent is resized, the child does NOT
> > conform to the new size. Is there a flag to use that will cause the
> > child window to remain maximized when its parent is resized?
> 
> I think you are talking about true MDI (multiple document interface). 
> 
> Win32lib does not yet support MDI, but you can easily simulate the effect
> you mention. Do something like ...
> 
> procedure Resize_MainWin(integer self, integer event, sequence parms)
>    sequence lRect
> 
>    lRect = getClientRect(self)
>    setRect(ChildWin, 0, 0, lRect[3], lRect[4], w32True)
> end procedure
> setHandler(MainWin, w32HResize, routine_id("Resize_MainWin"))

That almost works... It does resize the child window, but it's not
"maximized." I tried this and it works, but you get flickering. The
reason I have both setWindow()s is because it doesn't work with only
one! Maybe you can explain or improve on it.

procedure Resize_MainWin(integer self, integer event, sequence parms)
   sequence lRect
   lRect = getClientRect(self)
--   setRect(CWindow2, 0, 0, lRect[3], lRect[4], w32True)
   showWindow(CWindow2,SW_MAX) -- why doesn't this ALONE work?
   showWindow(CWindow2,SW_SHOWMAXIMIZED)
end procedure
setHandler(MainWin, w32HResize, routine_id("Resize_MainWin"))



-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

4. Re: Win32Lib: Must be a Flag

> > > Normally, when a child window is maximized, it fills its parent window.
> > > When the parent window is resized, the child window stays maximized.
> > > However, with Win32Lib, when the parent is resized, the child does NOT
> > > conform to the new size. Is there a flag to use that will cause the
> > > child window to remain maximized when its parent is resized?
> > 
> > I think you are talking about true MDI (multiple document interface). 
> > 
> > Win32lib does not yet support MDI, but you can easily simulate the effect
> > you mention. Do something like ...
> > 
> > procedure Resize_MainWin(integer self, integer event, sequence parms)
> >    sequence lRect
> > 
> >    lRect = getClientRect(self)
> >    setRect(ChildWin, 0, 0, lRect[3], lRect[4], w32True)
> > end procedure
> > setHandler(MainWin, w32HResize, routine_id("Resize_MainWin"))
> 
> That almost works... It does resize the child window, but it's not
> "maximized." I tried this and it works, but you get flickering. The
> reason I have both setWindow()s is because it doesn't work with only
> one! Maybe you can explain or improve on it.

If the only problem is flickering, add in the Windows style
WS_CLIPCHILDREN to your parent.  This (should) eliminate it.


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

new topic     » goto parent     » topic index » view message » categorize

5. Re: Win32Lib: Must be a Flag

Don wrote:
> 
> If the only problem is flickering, add in the Windows style
> WS_CLIPCHILDREN to your parent.  This (should) eliminate it.

I couldn't implement that... but here's the code if you want to show me! :)

include Win32Lib.ew
without warning

constant Window1 = createEx( Window, "Window1", 0, Default, Default, 224, 197,
0, 0 )
constant CWindow2 = createEx( Window, "CWindow2", Window1, 8, 8, 200, 100,
or_all({WS_CHILD}), 0 )
openWindow(CWindow2, Normal)

procedure Window1_onResize (integer self, integer event, sequence
params)--params is ( int style, int cx, int cy )
   showWindow(CWindow2,SW_MAX)
   showWindow(CWindow2,SW_SHOWMAXIMIZED)
end procedure
setHandler( Window1, w32HResize, routine_id("Window1_onResize"))

WinMain( Window1,Normal )


-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

6. Re: Win32Lib: Must be a Flag

> > If the only problem is flickering, add in the Windows style
> > WS_CLIPCHILDREN to your parent.  This (should) eliminate it.
> 
> I couldn't implement that... but here's the code if you want to show me! :)
> 
> include Win32Lib.ew
> without warning
> 
> constant Window1 = createEx( Window, "Window1", 0, Default, Default, 224, 197,
> 0, 0
> )
> constant CWindow2 = createEx( Window, "CWindow2", Window1, 8, 8, 200, 100,
> or_all({WS_CHILD}),
> 0 )
> openWindow(CWindow2, Normal)
> 
> procedure Window1_onResize (integer self, integer event, sequence
> params)--params is
> ( int style, int cx, int cy )
>    showWindow(CWindow2,SW_MAX)
>    showWindow(CWindow2,SW_SHOWMAXIMIZED)
> end procedure
> setHandler( Window1, w32HResize, routine_id("Window1_onResize"))
> 
> WinMain( Window1,Normal )

The flickering (in this case) is a combination of using showWindow and
not using WS_CLIPCHILDREN.

Use this one instead...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
include Win32Lib.ew
without warning

constant Window1 = createEx( Window, "Window1", 0, Default, Default, 224, 197,
WS_CLIPCHILDREN, 0 )
constant CWindow2 = createEx( Window, "CWindow2", Window1, 8, 8, 200, 100,
or_all({WS_CHILD}), 0 )
openWindow(CWindow2, Normal)

procedure Window1_onResize (integer self, integer event, sequence
params)--params is ( int style, int cx, int cy )
--   showWindow(CWindow2,SW_MAX)
--   showWindow(CWindow2,SW_SHOWMAXIMIZED)
	setRect( CWindow2, 0, 0, params[2], params[3], 1 )
end procedure
setHandler( Window1, w32HResize, routine_id("Window1_onResize"))

WinMain( Window1,Normal )
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\


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

new topic     » goto parent     » topic index » view message » categorize

7. Re: Win32Lib: Must be a Flag

Don wrote:

> procedure Window1_onResize (integer self, integer event, sequence
> params)--params is
> ( int style, int cx, int cy )
> --   showWindow(CWindow2,SW_MAX)
> --   showWindow(CWindow2,SW_SHOWMAXIMIZED)
> 	setRect( CWindow2, 0, 0, params[2], params[3], 1 )
> end procedure
> setHandler( Window1, w32HResize, routine_id("Window1_onResize"))

Using this method, the child window is no longer maximized. I want it
to remain maximized.

For example, run the code. Then, click the child's maximize button.
Notice how you no longer see the border of the child. Then resize the
parent. You'll notice that the child becomes restored (or whatever)
such that you can see the border. It's no longer maximized.

This:

	showWindow(CWindow2,SW_MAX)

should actually do what I want, according to the Win32Lib docs...

        "Maximize but not activate the window."

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

8. Re: Win32Lib: Must be a Flag

> Using this method, the child window is no longer maximized. I want it
> to remain maximized.
> 
> For example, run the code. Then, click the child's maximize button.
> Notice how you no longer see the border of the child. Then resize the
> parent. You'll notice that the child becomes restored (or whatever)
> such that you can see the border. It's no longer maximized.

Yeah, I didnt see that when I first ran it.  I tried a couple of other things,
but they also did not work.  The best way (imo) would be the code I posted
above, but with some mods.  The border width needs to be taken into account
and the rect adjusted accordingly.  If you dont find out how to do this
before later tonight when I can post a solution ill post again to give you
the routine...


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

new topic     » goto parent     » topic index » view message » categorize

9. Re: Win32Lib: Must be a Flag

Don wrote:
> 
> > Using this method, the child window is no longer maximized. I want it
> > to remain maximized.
> > 
> Yeah, I didnt see that when I first ran it.  I tried a couple of other things,
> but they also did not work.  The best way (imo) would be the code I posted
> above, but with some mods.

If you try it with my original code...

   showWindow(CWindow4,SW_MAX)
   showWindow(CWindow4,SW_SHOWMAXIMIZE) -- or whatever it was

it works like it's supposed to, EXCEPT for that brief flash when the
window is restored by the SW_MAX command... which I don't understand
at all why it does that. :/

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

10. Re: Win32Lib: Must be a Flag

> > Yeah, I didnt see that when I first ran it.  I tried a couple of other
> > things,
> > but they also did not work.  The best way (imo) would be the code I posted
> > above, but with some mods.
> 
> If you try it with my original code...
> 
>    showWindow(CWindow4,SW_MAX)
>    showWindow(CWindow4,SW_SHOWMAXIMIZE) -- or whatever it was
> 
> it works like it's supposed to, EXCEPT for that brief flash when the
> window is restored by the SW_MAX command... which I don't understand
> at all why it does that. :/

It works (apparently) depending on which version of Windows OS your
running.  Im on XP Pro at the moment.  And while it *does* work, it
is obviously does not run like it should.  At least on mine it doesnt.
When I resize the main window, I can actually see it not only flash,
but theres enough time to watch the child window resize to normal and then
resize to max.  Now that I think about it, I bet its the new themes.
Windows (and everything else) are just more animated...

I know how to fix it like you want.  Gimme about 10 minutes from now
(after I read the rest of the posts heh) and itll be good as new.
I hope =)


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

new topic     » goto parent     » topic index » view message » categorize

11. Re: Win32Lib: Must be a Flag

> it works like it's supposed to, EXCEPT for that brief flash when the
> window is restored by the SW_MAX command... which I don't understand
> at all why it does that. :/

Heres a (slightly) modified routine which is better than my first.
I eliminated the flickering and it resizes properly.  It gets the
window border size from the system flags so it should be cross
platform.

Any problems just let me know...

include Win32Lib.ew
without warning

constant Window1 = createEx( Window, "Window1", 0, Default, Default, 224, 197,
WS_CLIPCHILDREN, 0 )
constant CWindow2 = createEx( Window, "CWindow2", Window1, 8, 8, 200, 100,
or_all({WS_CHILD}), 0 )
openWindow(CWindow2, Normal)

procedure Window1_onResize (integer self, integer event, sequence params)
	--params is ( int style, int cx, int cy )
	sequence lValues
	integer Border
	lValues = getWindowInfo( CWindow2, {WINDOWINFO_xWindowBorders} )
	Border = lValues[1]
setRect( CWindow2, -Border, -Border, params[2]+Border*2, params[3]+Border*2, 1
)
end procedure
setHandler( Window1, w32HResize, routine_id("Window1_onResize"))

WinMain( Window1,Normal )



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

new topic     » goto parent     » topic index » view message » categorize

12. Re: Win32Lib: Must be a Flag

Don wrote:
> 
> Heres a (slightly) modified routine which is better than my first.

Yes, that works perfectly.

> I eliminated the flickering and it resizes properly.  It gets the
> window border size from the system flags so it should be cross
> platform.
> 
> Any problems just let me know...

Just one itty-bitty one. When I don't have the child window maximized,
it should not then get maximized with a resize of the parent window. :)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu