1. Global variables for multiple child windows

Hi,

I have multiple child windows which have to setup a few global variables when
they -

1] open
2] get focus
3] are re-sized - maximized (after being minimized first)
4] moved around - moveZOrder(window, HWND_TOP) or dragged around

I am using a procedure in each window as follows:

global integer MaintWin, MaintStatBar
global sequence ProcModes, UpdtProc, SelCtl

procedure setSocMaintPars(integer self, integer event, sequence params)
	MaintWin     = self
	MaintStatBar = StatusBar380
	ProcModes    = SocProcModes
	UpdtProc     = SocUpdtProc
	SelCtl       = SocSelCtl
	
	setMaintModes()
end procedure
setHandler(SocMaint, {w32HGotFocus, w32HResize, w32HPaint},
routine_id("setSocMaintPars"))


Each window has a similar procedure, where global variables acquire window
specific values.
This procedure works fine except when I have multiple windows open
simultaneously. When the top most window is dragged around, the values of the
window which is overlapped by the dragged one always gets stored in global
variables.

Is there a way to always load the global variables with the values for top most
child window? How to get the id of top most child window?

Regards,
Rad.

new topic     » topic index » view message » categorize

2. Re: Global variables for multiple child windows

Rad wrote:
> 
> Hi,
> 
> I have multiple child windows which have to setup a few global variables when
> they -
> 
> 1] open
> 2] get focus
> 3] are re-sized - maximized (after being minimized first)
> 4] moved around - moveZOrder(window, HWND_TOP) or dragged around
> 
> I am using a procedure in each window as follows:
> 
> }}}
<eucode>
> global integer MaintWin, MaintStatBar
> global sequence ProcModes, UpdtProc, SelCtl
> 
> procedure setSocMaintPars(integer self, integer event, sequence params)
> 	MaintWin     = self
> 	MaintStatBar = StatusBar380
> 	ProcModes    = SocProcModes
> 	UpdtProc     = SocUpdtProc
> 	SelCtl       = SocSelCtl
> 	
> 	setMaintModes()
> end procedure
> setHandler(SocMaint, {w32HGotFocus, w32HResize, w32HPaint},
> routine_id("setSocMaintPars"))
> </eucode>
{{{

> 
> Each window has a similar procedure, where global variables acquire window
> specific
> values.
> This procedure works fine except when I have multiple windows open
> simultaneously.
> When the top most window is dragged around, the values of the window which is
> overlapped by the dragged one always gets stored in global variables.
> 
> Is there a way to always load the global variables with the values for top
> most
> child window? How to get the id of top most child window?
> 
> Regards,
> Rad.

I assume you are using win32lib:
constant GW_CHILD = 5

myTopChildWindow=getId(w32Func(xGetWindow,{getHandle(myMainWindow),GW_CHILD}))

If you don't, check that the GetWindow API is being wrapped, and wrap it if
needed. It's wrapped in win32lib as
xGetWindow          = registerw32Function( user32, "GetWindow",
{C_LONG, C_LONG}, C_LONG)


CChris

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

3. Re: Global variables for multiple child windows

CChris wrote:
> I assume you are using win32lib:
> }}}
<eucode>
> constant GW_CHILD = 5
> 
> myTopChildWindow=getId(w32Func(xGetWindow,{getHandle(myMainWindow),GW_CHILD}))
> </eucode>
{{{

> If you don't, check that the GetWindow API is being wrapped, and wrap it if
> needed. It's wrapped in win32lib as
> }}}
<eucode>    xGetWindow          = registerw32Function( user32, "GetWindow",
> {C_LONG,
> C_LONG}, C_LONG)</eucode>
{{{

> 

Thanks CChris. I got it working with your syntax and combination of
{w32GotFocus, w32Resize, w32Mouse}.

I have one query though.

When a window title is clicked, I am getting that window to be topmost.
But the handler set for GotFocus is not invoked.
I have to click within that window to invoke GotFocus.
Why so? Isn't getting the window to foreground setting focus on that window?

Regards,
Rad.

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

4. Re: Global variables for multiple child windows

Rad wrote:
> 
> CChris wrote:
> > I assume you are using win32lib:
> > }}}
<eucode>
> > constant GW_CHILD = 5
> > 
> >
> > myTopChildWindow=getId(w32Func(xGetWindow,{getHandle(myMainWindow),GW_CHILD}))
> > </eucode>
{{{

> > If you don't, check that the GetWindow API is being wrapped, and wrap it if
> > needed. It's wrapped in win32lib as
> > }}}
<eucode>    xGetWindow          = registerw32Function( user32, "GetWindow",
> > {C_LONG,
> > C_LONG}, C_LONG)</eucode>
{{{

> > 
> 
> Thanks CChris. I got it working with your syntax and combination of
> {w32GotFocus,
> w32Resize, w32Mouse}.
> 
> I have one query though.
> 
> When a window title is clicked, I am getting that window to be topmost.
> But the handler set for GotFocus is not invoked.
> I have to click within that window to invoke GotFocus.
> Why so? Isn't getting the window to foreground setting focus on that window?
> 
> Regards,
> Rad.

No, because if you click in the non client area of a window, the latter will get
a WM_NCLBUTTONDOWN message instead of WM_LBUTTONDOWN etc. And the library
currently doesn't care about these non client mouse messages. You can always trap
WM_NCLBUTTONDOWN (registering the handler using setWinMsgHandler()) and fire the
w32HGotFocus event from there, if you wish.

CChris

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

5. Re: Global variables for multiple child windows

CChris wrote:
> 
> No, because if you click in the non client area of a window, the latter will
> get a WM_NCLBUTTONDOWN message instead of WM_LBUTTONDOWN etc. And the library
> currently doesn't care about these non client mouse messages. You can always
> trap WM_NCLBUTTONDOWN (registering the handler using setWinMsgHandler()) and
> fire the w32HGotFocus event from there, if you wish.
> 
> CChris

Thanks, I will try it out.

Regards,
Rad.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu