Is there a codeblock for changing active window

Is there a codeblock for changing active window

Postby gkuhnert » Fri Jul 09, 2010 9:49 am

Hi,

I wonder if there is a codeblock that is executed, when the active window changes? Or another approach with the same result? It should fire at the moment that a call oWinClient:GetActive() would give a different response.

(Background info: for example, if mdi-child "A" is active, I want to show a ribbon-group "a", and if mdi-child "B" is active I want to show ribbon-group "b". It is not possible by oWinA:bLostFocus because if I click the ribbon-menu, the focus is lost at this time...)
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Is there a codeblock for changing active window

Postby anserkk » Fri Jul 09, 2010 10:51 am

What about oWinA:bGotFocus or oWinB:bGotFocus ?

Just an idea

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Is there a codeblock for changing active window

Postby gkuhnert » Fri Jul 09, 2010 11:11 am

Anser,

bGotFocus will work for starting the group, but I want to let ribbon-group "A" disappear, when the mdi-child isn't the active window any more. But I can't do that with bLostFocus, because, for example, by clicking the ribbon-menu the mdi-child already looses focus but is still the active window.
Thanks anyway for your suggestion, maybe it's a start...
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Is there a codeblock for changing active window

Postby gkuhnert » Fri Jul 09, 2010 2:00 pm

Ok, now I have implemented oWinChild:bGotFocus and oWinChild:bInit for each mdi-child.
The only problem that is left: if I close all windows or the last window I also want to let the ribbon-group disappear. But a oWin:bGotFocus for the main Window won't help in this case. Has anyone a suggestion?
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Is there a codeblock for changing active window

Postby James Bott » Fri Jul 09, 2010 2:11 pm

How about the window's VALID clause?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Is there a codeblock for changing active window

Postby gkuhnert » Mon Jul 12, 2010 12:38 pm

James Bott wrote:How about the window's VALID clause?

James


It won't work in this case, because I need a block that is called after closing a mdi-child. Because at closing time I don't know, which mdi-child will become the active one after closing. Or is there any method to find out, which mdi-child will become the active one when the actual active one has been closed?
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Is there a codeblock for changing active window

Postby nageswaragunupudi » Mon Jul 12, 2010 3:54 pm

Window:A
bGotFocus ( Hide Group-B and show Group-A )
bPostEnd ( If All windows are closed, hide both groups )

Window-B
bGotFocus ( Hide Group-A and show Group-B )
bPostEnd ( If all windows are closed, hide both groups )

Any other mdichild not A or B
bGotFocus ( Hide both Group-A and Group-B )
Regards

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

Re: Is there a codeblock for changing active window

Postby gkuhnert » Thu Jul 15, 2010 8:17 am

Rao,

many thanks for your hint. This works fine!
bPostEnd is the codeblock I've been searching for :)
Last edited by gkuhnert on Thu Jul 15, 2010 12:10 pm, edited 1 time in total.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Is there a codeblock for changing active window

Postby frose » Thu Jul 15, 2010 9:33 am

I think James means the following combination:

Window:A
bGotFocus ( show Group-A )
VALID ( hide both groups )

It's working perfect for me!
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: Is there a codeblock for changing active window

Postby Antonio Linares » Thu Jul 15, 2010 10:07 am

Many times we forget that bPostEnd is a very usefull codeblock :-)

Thanks Rao :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 84 guests